X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fdb.cpp;h=88d9cfd8077ec66e545072a13b5e6bf800f931d1;hb=bc33cfede4c7668b7476e1aa3894cac661c23a62;hp=0a8c8be9d1665138604a0a590823c0d551c21ce0;hpb=7e9ceb798f2685429f3387625beb872bbda1567c;p=novacoin.git diff --git a/src/db.cpp b/src/db.cpp index 0a8c8be..88d9cfd 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -20,7 +20,7 @@ using namespace boost; unsigned int nWalletDBUpdated; - +extern bool fUseMemoryLog; // @@ -156,7 +156,7 @@ void CDBEnv::MakeMock() dbenv.set_lk_max_objects(10000); dbenv.set_flags(DB_AUTO_COMMIT, 1); #ifdef DB_LOG_IN_MEMORY - dbenv.log_set_config(DB_LOG_IN_MEMORY, 1); + dbenv.log_set_config(DB_LOG_IN_MEMORY, fUseMemoryLog ? 1 : 0); #endif int ret = dbenv.open(NULL, DB_CREATE | @@ -254,7 +254,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) : return; fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w')); - bool fCreate = strchr(pszMode, 'c'); + bool fCreate = strchr(pszMode, 'c') != NULL; unsigned int nFlags = DB_THREAD; if (fCreate) nFlags |= DB_CREATE; @@ -463,7 +463,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) void CDBEnv::Flush(bool fShutdown) { - int64 nStart = GetTimeMillis(); + int64_t nStart = GetTimeMillis(); // Flush log data to the actual data file // on all files that are not in use printf("Flush(%s)%s\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started"); @@ -494,7 +494,7 @@ void CDBEnv::Flush(bool fShutdown) else mi++; } - printf("DBFlush(%s)%s ended %15"PRI64d"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); + printf("DBFlush(%s)%s ended %15" PRId64 "ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); if (fShutdown) { char** listp; @@ -543,7 +543,7 @@ bool CAddrDB::Write(const CAddrMan& addr) try { fileout << ssPeers; } - catch (std::exception &e) { + catch (const std::exception&) { return error("CAddrman::Write() : I/O error"); } FileCommit(fileout); @@ -578,7 +578,7 @@ bool CAddrDB::Read(CAddrMan& addr) filein.read((char *)&vchData[0], dataSize); filein >> hashIn; } - catch (std::exception &e) { + catch (const std::exception&) { return error("CAddrman::Read() 2 : I/O error or stream data corrupted"); } filein.fclose(); @@ -602,7 +602,7 @@ bool CAddrDB::Read(CAddrMan& addr) // de-serialize address data into one CAddrMan object ssPeers >> addr; } - catch (std::exception &e) { + catch (const std::exception&) { return error("CAddrman::Read() : I/O error or stream data corrupted"); }