X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fdb.cpp;h=81d519a72edfe716fc5b7824b780abd220b09100;hp=6dde84e90fec14f166235d456c382f71e364aeec;hb=40e17afbceaa325776356fd4cd7cc2805cd054c2;hpb=5161066e3cb631292014ee650ab08c012ff4a5c5 diff --git a/src/db.cpp b/src/db.cpp index 6dde84e..81d519a 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -396,7 +396,8 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) } Dbc* pcursor = db.GetCursor(); - if (pcursor) + if (pcursor) { + size_t pszSkipLen = strlen(pszSkip); while (fSuccess) { CDataStream ssKey(SER_DISK, CLIENT_VERSION); @@ -414,7 +415,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) break; } if (pszSkip && - strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) + strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), pszSkipLen)) == 0) continue; if (strncmp(&ssKey[0], "\x07version", 8) == 0) { @@ -428,6 +429,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) if (ret2 > 0) fSuccess = false; } + } if (fSuccess) { db.Close();