X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fdb.cpp;h=e12e11e9f77c6965144c64e5fca561d6028d2df4;hb=2404891de8ac5b357d0abde90f2e286a3153fdef;hp=757a18e40ca9ba747218cdc07aa0011531c211ea;hpb=e10fa48ea2c24f9647668aafa1f9caa48a51de2f;p=novacoin.git diff --git a/src/db.cpp b/src/db.cpp index 757a18e..e12e11e 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -288,7 +288,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) : delete pdb; pdb = NULL; --bitdb.mapFileUseCount[strFile]; - strFile = ""; + strFile.clear(); throw runtime_error(strprintf("CDB() : can't open database file %s, error %d", pszFile, ret)); } @@ -397,7 +397,6 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) Dbc* pcursor = db.GetCursor(); if (pcursor) { - size_t pszSkipLen = strlen(pszSkip); while (fSuccess) { CDataStream ssKey(SER_DISK, CLIENT_VERSION); @@ -414,9 +413,14 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) fSuccess = false; break; } - if (pszSkip && - strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), pszSkipLen)) == 0) - continue; + + if (pszSkip != NULL) + { + size_t pszSkipLen = strlen(pszSkip); + if (strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), pszSkipLen)) == 0) + continue; + } + if (strncmp(&ssKey[0], "\x07version", 8) == 0) { // Update version: