Browse Source

Merge pull request #5933

341e238 use constant references for strings in functions in wallet/*.* (Philip Kaufmann)
0.13
Pieter Wuille 10 years ago
parent
commit
45d6d0bce5
No known key found for this signature in database
GPG Key ID: 57896D2FF8F0B657
  1. 4
      src/wallet/db.cpp
  2. 4
      src/wallet/db.h
  3. 2
      src/wallet/wallet.cpp
  4. 2
      src/wallet/wallet.h
  5. 4
      src/wallet/walletdb.cpp
  6. 4
      src/wallet/walletdb.h

4
src/wallet/db.cpp

@ -148,7 +148,7 @@ void CDBEnv::MakeMock() @@ -148,7 +148,7 @@ void CDBEnv::MakeMock()
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);
assert(mapFileUseCount.count(strFile) == 0);
@ -165,7 +165,7 @@ CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDB @@ -165,7 +165,7 @@ CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDB
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);
assert(mapFileUseCount.count(strFile) == 0);

4
src/wallet/db.h

@ -59,7 +59,7 @@ public: @@ -59,7 +59,7 @@ public:
enum VerifyResult { VERIFY_OK,
RECOVER_OK,
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.
* fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation).
@ -68,7 +68,7 @@ public: @@ -68,7 +68,7 @@ public:
* for huge databases.
*/
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);
void Close();

2
src/wallet/wallet.cpp

@ -345,7 +345,7 @@ void CWallet::Flush(bool shutdown) @@ -345,7 +345,7 @@ void CWallet::Flush(bool 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()))
{

2
src/wallet/wallet.h

@ -747,7 +747,7 @@ public: @@ -747,7 +747,7 @@ public:
void Flush(bool shutdown=false);
//! 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.

4
src/wallet/walletdb.cpp

@ -891,7 +891,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) @@ -891,7 +891,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
//
// 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:
// move wallet.dat to wallet.timestamp.bak
@ -968,7 +968,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) @@ -968,7 +968,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
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);
}

4
src/wallet/walletdb.h

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

Loading…
Cancel
Save