Skip to content

Commit 45d6d0b

Browse files
committed
Merge pull request #5933
341e238 use constant references for strings in functions in wallet/*.* (Philip Kaufmann)
2 parents 46ba7a7 + 341e238 commit 45d6d0b

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/wallet/db.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void CDBEnv::MakeMock()
148148
fMockDb = true;
149149
}
150150

151-
CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile))
151+
CDBEnv::VerifyResult CDBEnv::Verify(const std::string& strFile, bool (*recoverFunc)(CDBEnv& dbenv, const std::string& strFile))
152152
{
153153
LOCK(cs_db);
154154
assert(mapFileUseCount.count(strFile) == 0);
@@ -165,7 +165,7 @@ CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDB
165165
return (fRecovered ? RECOVER_OK : RECOVER_FAIL);
166166
}
167167

168-
bool CDBEnv::Salvage(std::string strFile, bool fAggressive, std::vector<CDBEnv::KeyValPair>& vResult)
168+
bool CDBEnv::Salvage(const std::string& strFile, bool fAggressive, std::vector<CDBEnv::KeyValPair>& vResult)
169169
{
170170
LOCK(cs_db);
171171
assert(mapFileUseCount.count(strFile) == 0);

src/wallet/db.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CDBEnv
5959
enum VerifyResult { VERIFY_OK,
6060
RECOVER_OK,
6161
RECOVER_FAIL };
62-
VerifyResult Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile));
62+
VerifyResult Verify(const std::string& strFile, bool (*recoverFunc)(CDBEnv& dbenv, const std::string& strFile));
6363
/**
6464
* Salvage data from a file that Verify says is bad.
6565
* fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation).
@@ -68,7 +68,7 @@ class CDBEnv
6868
* for huge databases.
6969
*/
7070
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair;
71-
bool Salvage(std::string strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
71+
bool Salvage(const std::string& strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
7272

7373
bool Open(const boost::filesystem::path& path);
7474
void Close();

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void CWallet::Flush(bool shutdown)
345345
bitdb.Flush(shutdown);
346346
}
347347

348-
bool CWallet::Verify(const string walletFile, string& warningString, string& errorString)
348+
bool CWallet::Verify(const string& walletFile, string& warningString, string& errorString)
349349
{
350350
if (!bitdb.Open(GetDataDir()))
351351
{

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
747747
void Flush(bool shutdown=false);
748748

749749
//! Verify the wallet database and perform salvage if required
750-
static bool Verify(const std::string walletFile, std::string& warningString, std::string& errorString);
750+
static bool Verify(const std::string& walletFile, std::string& warningString, std::string& errorString);
751751

752752
/**
753753
* Address book entry changed.

src/wallet/walletdb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
891891
//
892892
// Try to (very carefully!) recover wallet.dat if there is a problem.
893893
//
894-
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
894+
bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKeys)
895895
{
896896
// Recovery procedure:
897897
// move wallet.dat to wallet.timestamp.bak
@@ -968,7 +968,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
968968
return fSuccess;
969969
}
970970

971-
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename)
971+
bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename)
972972
{
973973
return CWalletDB::Recover(dbenv, filename, false);
974974
}

src/wallet/walletdb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class CWalletDB : public CDB
127127
DBErrors LoadWallet(CWallet* pwallet);
128128
DBErrors FindWalletTx(CWallet* pwallet, std::vector<uint256>& vTxHash, std::vector<CWalletTx>& vWtx);
129129
DBErrors ZapWalletTx(CWallet* pwallet, std::vector<CWalletTx>& vWtx);
130-
static bool Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys);
131-
static bool Recover(CDBEnv& dbenv, std::string filename);
130+
static bool Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKeys);
131+
static bool Recover(CDBEnv& dbenv, const std::string& filename);
132132

133133
private:
134134
CWalletDB(const CWalletDB&);

0 commit comments

Comments
 (0)