Skip to content

Commit 99ba0c3

Browse files
Don't use pass by reference to const for cheaply-copied types (bool, char, etc.).
1 parent 140de14 commit 99ba0c3

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
171171
coinControlUpdateLabels();
172172

173173
// fee section
174-
for (const int &n : confTargets) {
174+
for (const int n : confTargets) {
175175
ui->confTargetSelector->addItem(tr("%1 (%2 blocks)").arg(GUIUtil::formatNiceTimeOffset(n*Params().GetConsensus().nPowTargetSpacing)).arg(n));
176176
}
177177
connect(ui->confTargetSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSmartFeeLabel()));

src/streams.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ class CDataStream
241241
const_reference operator[](size_type pos) const { return vch[pos + nReadPos]; }
242242
reference operator[](size_type pos) { return vch[pos + nReadPos]; }
243243
void clear() { vch.clear(); nReadPos = 0; }
244-
iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); }
245-
void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); }
244+
iterator insert(iterator it, const char x=char()) { return vch.insert(it, x); }
245+
void insert(iterator it, size_type n, const char x) { vch.insert(it, n, x); }
246246
value_type* data() { return vch.data() + nReadPos; }
247247
const value_type* data() const { return vch.data() + nReadPos; }
248248

src/wallet/rpcdump.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,8 @@ UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int6
703703
const std::string& strRedeemScript = data.exists("redeemscript") ? data["redeemscript"].get_str() : "";
704704
const UniValue& pubKeys = data.exists("pubkeys") ? data["pubkeys"].get_array() : UniValue();
705705
const UniValue& keys = data.exists("keys") ? data["keys"].get_array() : UniValue();
706-
const bool& internal = data.exists("internal") ? data["internal"].get_bool() : false;
707-
const bool& watchOnly = data.exists("watchonly") ? data["watchonly"].get_bool() : false;
706+
const bool internal = data.exists("internal") ? data["internal"].get_bool() : false;
707+
const bool watchOnly = data.exists("watchonly") ? data["watchonly"].get_bool() : false;
708708
const std::string& label = data.exists("label") && !internal ? data["label"].get_str() : "";
709709

710710
bool isScript = scriptPubKey.getType() == UniValue::VSTR;

src/wallet/wallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ CAmount CWalletTx::GetAvailableCredit(bool fUseCache) const
18221822
return nCredit;
18231823
}
18241824

1825-
CAmount CWalletTx::GetImmatureWatchOnlyCredit(const bool& fUseCache) const
1825+
CAmount CWalletTx::GetImmatureWatchOnlyCredit(const bool fUseCache) const
18261826
{
18271827
if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain())
18281828
{
@@ -1836,7 +1836,7 @@ CAmount CWalletTx::GetImmatureWatchOnlyCredit(const bool& fUseCache) const
18361836
return 0;
18371837
}
18381838

1839-
CAmount CWalletTx::GetAvailableWatchOnlyCredit(const bool& fUseCache) const
1839+
CAmount CWalletTx::GetAvailableWatchOnlyCredit(const bool fUseCache) const
18401840
{
18411841
if (pwallet == 0)
18421842
return 0;
@@ -2127,7 +2127,7 @@ CAmount CWallet::GetAvailableBalance(const CCoinControl* coinControl) const
21272127
return balance;
21282128
}
21292129

2130-
void CWallet::AvailableCoins(std::vector<COutput> &vCoins, bool fOnlySafe, const CCoinControl *coinControl, const CAmount &nMinimumAmount, const CAmount &nMaximumAmount, const CAmount &nMinimumSumAmount, const uint64_t &nMaximumCount, const int &nMinDepth, const int &nMaxDepth) const
2130+
void CWallet::AvailableCoins(std::vector<COutput> &vCoins, bool fOnlySafe, const CCoinControl *coinControl, const CAmount &nMinimumAmount, const CAmount &nMaximumAmount, const CAmount &nMinimumSumAmount, const uint64_t nMaximumCount, const int nMinDepth, const int nMaxDepth) const
21312131
{
21322132
vCoins.clear();
21332133

src/wallet/wallet.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ class CWalletTx : public CMerkleTx
449449
CAmount GetCredit(const isminefilter& filter) const;
450450
CAmount GetImmatureCredit(bool fUseCache=true) const;
451451
CAmount GetAvailableCredit(bool fUseCache=true) const;
452-
CAmount GetImmatureWatchOnlyCredit(const bool& fUseCache=true) const;
453-
CAmount GetAvailableWatchOnlyCredit(const bool& fUseCache=true) const;
452+
CAmount GetImmatureWatchOnlyCredit(const bool fUseCache=true) const;
453+
CAmount GetAvailableWatchOnlyCredit(const bool fUseCache=true) const;
454454
CAmount GetChange() const;
455455

456456
void GetAmounts(std::list<COutputEntry>& listReceived,
@@ -819,7 +819,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
819819
/**
820820
* populate vCoins with vector of available COutputs.
821821
*/
822-
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlySafe=true, const CCoinControl *coinControl = nullptr, const CAmount& nMinimumAmount = 1, const CAmount& nMaximumAmount = MAX_MONEY, const CAmount& nMinimumSumAmount = MAX_MONEY, const uint64_t& nMaximumCount = 0, const int& nMinDepth = 0, const int& nMaxDepth = 9999999) const;
822+
void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlySafe=true, const CCoinControl *coinControl = nullptr, const CAmount& nMinimumAmount = 1, const CAmount& nMaximumAmount = MAX_MONEY, const CAmount& nMinimumSumAmount = MAX_MONEY, const uint64_t nMaximumCount = 0, const int nMinDepth = 0, const int nMaxDepth = 9999999) const;
823823

824824
/**
825825
* Return list of available coins and locked coins grouped by non-change output address.

0 commit comments

Comments
 (0)