use constant references for strings in functions in wallet/*.*

This commit is contained in:
Philip Kaufmann 2015-03-21 18:40:51 +01:00
parent f3948a30cd
commit 341e2385d5
6 changed files with 10 additions and 10 deletions

View File

@ -148,7 +148,7 @@ void CDBEnv::MakeMock()
fMockDb = true; fMockDb = true;
} }
CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile)) CDBEnv::VerifyResult CDBEnv::Verify(const std::string& strFile, bool (*recoverFunc)(CDBEnv& dbenv, const std::string& strFile))
{ {
LOCK(cs_db); LOCK(cs_db);
assert(mapFileUseCount.count(strFile) == 0); assert(mapFileUseCount.count(strFile) == 0);
@ -165,7 +165,7 @@ CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDB
return (fRecovered ? RECOVER_OK : RECOVER_FAIL); return (fRecovered ? RECOVER_OK : RECOVER_FAIL);
} }
bool CDBEnv::Salvage(std::string strFile, bool fAggressive, std::vector<CDBEnv::KeyValPair>& vResult) bool CDBEnv::Salvage(const std::string& strFile, bool fAggressive, std::vector<CDBEnv::KeyValPair>& vResult)
{ {
LOCK(cs_db); LOCK(cs_db);
assert(mapFileUseCount.count(strFile) == 0); assert(mapFileUseCount.count(strFile) == 0);

View File

@ -59,7 +59,7 @@ public:
enum VerifyResult { VERIFY_OK, enum VerifyResult { VERIFY_OK,
RECOVER_OK, RECOVER_OK,
RECOVER_FAIL }; RECOVER_FAIL };
VerifyResult Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile)); VerifyResult Verify(const std::string& strFile, bool (*recoverFunc)(CDBEnv& dbenv, const std::string& strFile));
/** /**
* Salvage data from a file that Verify says is bad. * Salvage data from a file that Verify says is bad.
* fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation). * fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation).
@ -68,7 +68,7 @@ public:
* for huge databases. * for huge databases.
*/ */
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair; typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair;
bool Salvage(std::string strFile, bool fAggressive, std::vector<KeyValPair>& vResult); bool Salvage(const std::string& strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
bool Open(const boost::filesystem::path& path); bool Open(const boost::filesystem::path& path);
void Close(); void Close();

View File

@ -345,7 +345,7 @@ void CWallet::Flush(bool shutdown)
bitdb.Flush(shutdown); bitdb.Flush(shutdown);
} }
bool CWallet::Verify(const string walletFile, string& warningString, string& errorString) bool CWallet::Verify(const string& walletFile, string& warningString, string& errorString)
{ {
if (!bitdb.Open(GetDataDir())) if (!bitdb.Open(GetDataDir()))
{ {

View File

@ -747,7 +747,7 @@ public:
void Flush(bool shutdown=false); void Flush(bool shutdown=false);
//! Verify the wallet database and perform salvage if required //! Verify the wallet database and perform salvage if required
static bool Verify(const std::string walletFile, std::string& warningString, std::string& errorString); static bool Verify(const std::string& walletFile, std::string& warningString, std::string& errorString);
/** /**
* Address book entry changed. * Address book entry changed.

View File

@ -891,7 +891,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
// //
// Try to (very carefully!) recover wallet.dat if there is a problem. // Try to (very carefully!) recover wallet.dat if there is a problem.
// //
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKeys)
{ {
// Recovery procedure: // Recovery procedure:
// move wallet.dat to wallet.timestamp.bak // move wallet.dat to wallet.timestamp.bak
@ -968,7 +968,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
return fSuccess; return fSuccess;
} }
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename) bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename)
{ {
return CWalletDB::Recover(dbenv, filename, false); return CWalletDB::Recover(dbenv, filename, false);
} }

View File

@ -127,8 +127,8 @@ public:
DBErrors LoadWallet(CWallet* pwallet); DBErrors LoadWallet(CWallet* pwallet);
DBErrors FindWalletTx(CWallet* pwallet, std::vector<uint256>& vTxHash, std::vector<CWalletTx>& vWtx); DBErrors FindWalletTx(CWallet* pwallet, std::vector<uint256>& vTxHash, std::vector<CWalletTx>& vWtx);
DBErrors ZapWalletTx(CWallet* pwallet, std::vector<CWalletTx>& vWtx); DBErrors ZapWalletTx(CWallet* pwallet, std::vector<CWalletTx>& vWtx);
static bool Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys); static bool Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKeys);
static bool Recover(CDBEnv& dbenv, std::string filename); static bool Recover(CDBEnv& dbenv, const std::string& filename);
private: private:
CWalletDB(const CWalletDB&); CWalletDB(const CWalletDB&);