Skip to content

Commit 920ca1f

Browse files
committed
Merge #8655: Do not shadow variables (trivials)
4731cab Do not shadow variables (Pavel Janík)
2 parents 6e54c85 + 4731cab commit 920ca1f

15 files changed

+89
-89
lines changed

src/bloom.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ void CRollingBloomFilter::insert(const std::vector<unsigned char>& vKey)
280280

281281
void CRollingBloomFilter::insert(const uint256& hash)
282282
{
283-
vector<unsigned char> data(hash.begin(), hash.end());
284-
insert(data);
283+
vector<unsigned char> vData(hash.begin(), hash.end());
284+
insert(vData);
285285
}
286286

287287
bool CRollingBloomFilter::contains(const std::vector<unsigned char>& vKey) const
@@ -300,8 +300,8 @@ bool CRollingBloomFilter::contains(const std::vector<unsigned char>& vKey) const
300300

301301
bool CRollingBloomFilter::contains(const uint256& hash) const
302302
{
303-
vector<unsigned char> data(hash.begin(), hash.end());
304-
return contains(data);
303+
vector<unsigned char> vData(hash.begin(), hash.end());
304+
return contains(vData);
305305
}
306306

307307
void CRollingBloomFilter::reset()

src/key.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,12 @@ bool CKey::Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const
243243
return ret;
244244
}
245245

246-
bool CExtKey::Derive(CExtKey &out, unsigned int nChild) const {
246+
bool CExtKey::Derive(CExtKey &out, unsigned int _nChild) const {
247247
out.nDepth = nDepth + 1;
248248
CKeyID id = key.GetPubKey().GetID();
249249
memcpy(&out.vchFingerprint[0], &id, 4);
250-
out.nChild = nChild;
251-
return key.Derive(out.key, out.chaincode, nChild, chaincode);
250+
out.nChild = _nChild;
251+
return key.Derive(out.key, out.chaincode, _nChild, chaincode);
252252
}
253253

254254
void CExtKey::SetMaster(const unsigned char *seed, unsigned int nSeedLen) {

src/main.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,9 +1185,9 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
11851185
bool fReplacementOptOut = true;
11861186
if (fEnableReplacement)
11871187
{
1188-
BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin)
1188+
BOOST_FOREACH(const CTxIn &_txin, ptxConflicting->vin)
11891189
{
1190-
if (txin.nSequence < std::numeric_limits<unsigned int>::max()-1)
1190+
if (_txin.nSequence < std::numeric_limits<unsigned int>::max()-1)
11911191
{
11921192
fReplacementOptOut = false;
11931193
break;
@@ -2499,14 +2499,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
24992499
if (pindex->GetUndoPos().IsNull() || !pindex->IsValid(BLOCK_VALID_SCRIPTS))
25002500
{
25012501
if (pindex->GetUndoPos().IsNull()) {
2502-
CDiskBlockPos pos;
2503-
if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40))
2502+
CDiskBlockPos _pos;
2503+
if (!FindUndoPos(state, pindex->nFile, _pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40))
25042504
return error("ConnectBlock(): FindUndoPos failed");
2505-
if (!UndoWriteToDisk(blockundo, pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart()))
2505+
if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart()))
25062506
return AbortNode(state, "Failed to write undo data");
25072507

25082508
// update nUndoPos in block index
2509-
pindex->nUndoPos = pos.nPos;
2509+
pindex->nUndoPos = _pos.nPos;
25102510
pindex->nStatus |= BLOCK_HAVE_UNDO;
25112511
}
25122512

@@ -3819,10 +3819,10 @@ void PruneOneBlockFile(const int fileNumber)
38193819
// mapBlocksUnlinked or setBlockIndexCandidates.
38203820
std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex->pprev);
38213821
while (range.first != range.second) {
3822-
std::multimap<CBlockIndex *, CBlockIndex *>::iterator it = range.first;
3822+
std::multimap<CBlockIndex *, CBlockIndex *>::iterator _it = range.first;
38233823
range.first++;
3824-
if (it->second == pindex) {
3825-
mapBlocksUnlinked.erase(it);
3824+
if (_it->second == pindex) {
3825+
mapBlocksUnlinked.erase(_it);
38263826
}
38273827
}
38283828
}
@@ -5550,9 +5550,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
55505550
}
55515551
if (!fRejectedParents) {
55525552
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
5553-
CInv inv(MSG_TX, txin.prevout.hash);
5554-
pfrom->AddInventoryKnown(inv);
5555-
if (!AlreadyHave(inv)) pfrom->AskFor(inv);
5553+
CInv _inv(MSG_TX, txin.prevout.hash);
5554+
pfrom->AddInventoryKnown(_inv);
5555+
if (!AlreadyHave(_inv)) pfrom->AskFor(_inv);
55565556
}
55575557
AddOrphanTx(tx, pfrom->GetId());
55585558

@@ -6317,9 +6317,9 @@ class CompareInvMempoolOrder
63176317
{
63186318
CTxMemPool *mp;
63196319
public:
6320-
CompareInvMempoolOrder(CTxMemPool *mempool)
6320+
CompareInvMempoolOrder(CTxMemPool *_mempool)
63216321
{
6322-
mp = mempool;
6322+
mp = _mempool;
63236323
}
63246324

63256325
bool operator()(std::set<uint256>::iterator a, std::set<uint256>::iterator b)

src/pubkey.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,12 @@ void CExtPubKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) {
264264
pubkey.Set(code+41, code+BIP32_EXTKEY_SIZE);
265265
}
266266

267-
bool CExtPubKey::Derive(CExtPubKey &out, unsigned int nChild) const {
267+
bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const {
268268
out.nDepth = nDepth + 1;
269269
CKeyID id = pubkey.GetID();
270270
memcpy(&out.vchFingerprint[0], &id, 4);
271-
out.nChild = nChild;
272-
return pubkey.Derive(out.pubkey, out.chaincode, nChild, chaincode);
271+
out.nChild = _nChild;
272+
return pubkey.Derive(out.pubkey, out.chaincode, _nChild, chaincode);
273273
}
274274

275275
/* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) {

src/pubkey.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ class CPubKey
8888
}
8989

9090
//! Construct a public key from a byte vector.
91-
CPubKey(const std::vector<unsigned char>& vch)
91+
CPubKey(const std::vector<unsigned char>& _vch)
9292
{
93-
Set(vch.begin(), vch.end());
93+
Set(_vch.begin(), _vch.end());
9494
}
9595

9696
//! Simple read-only vector-like interface to the pubkey data.

src/reverselock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class reverse_lock
1313
{
1414
public:
1515

16-
explicit reverse_lock(Lock& lock) : lock(lock) {
17-
lock.unlock();
18-
lock.swap(templock);
16+
explicit reverse_lock(Lock& _lock) : lock(_lock) {
17+
_lock.unlock();
18+
_lock.swap(templock);
1919
}
2020

2121
~reverse_lock() {

src/rpc/blockchain.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@ UniValue getmempoolancestors(const UniValue& params, bool fHelp)
497497
UniValue o(UniValue::VOBJ);
498498
BOOST_FOREACH(CTxMemPool::txiter ancestorIt, setAncestors) {
499499
const CTxMemPoolEntry &e = *ancestorIt;
500-
const uint256& hash = e.GetTx().GetHash();
500+
const uint256& _hash = e.GetTx().GetHash();
501501
UniValue info(UniValue::VOBJ);
502502
entryToJSON(info, e);
503-
o.push_back(Pair(hash.ToString(), info));
503+
o.push_back(Pair(_hash.ToString(), info));
504504
}
505505
return o;
506506
}
@@ -561,10 +561,10 @@ UniValue getmempooldescendants(const UniValue& params, bool fHelp)
561561
UniValue o(UniValue::VOBJ);
562562
BOOST_FOREACH(CTxMemPool::txiter descendantIt, setDescendants) {
563563
const CTxMemPoolEntry &e = *descendantIt;
564-
const uint256& hash = e.GetTx().GetHash();
564+
const uint256& _hash = e.GetTx().GetHash();
565565
UniValue info(UniValue::VOBJ);
566566
entryToJSON(info, e);
567-
o.push_back(Pair(hash.ToString(), info));
567+
o.push_back(Pair(_hash.ToString(), info));
568568
}
569569
return o;
570570
}

src/rpc/mining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
607607

608608
UniValue aRules(UniValue::VARR);
609609
UniValue vbavailable(UniValue::VOBJ);
610-
for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++i) {
611-
Consensus::DeploymentPos pos = Consensus::DeploymentPos(i);
610+
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
611+
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);
612612
ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, versionbitscache);
613613
switch (state) {
614614
case THRESHOLD_DEFINED:

src/support/pagelocker.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ template <class Locker>
2828
class LockedPageManagerBase
2929
{
3030
public:
31-
LockedPageManagerBase(size_t page_size) : page_size(page_size)
31+
LockedPageManagerBase(size_t _page_size) : page_size(_page_size)
3232
{
3333
// Determine bitmask for extracting page from address
34-
assert(!(page_size & (page_size - 1))); // size must be power of two
35-
page_mask = ~(page_size - 1);
34+
assert(!(_page_size & (_page_size - 1))); // size must be power of two
35+
page_mask = ~(_page_size - 1);
3636
}
3737

3838
~LockedPageManagerBase()

src/test/crypto_tests.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad
133133
{
134134
std::vector<unsigned char> sub(i, in.end());
135135
std::vector<unsigned char> subout(sub.size() + AES_BLOCKSIZE);
136-
int size = enc.Encrypt(&sub[0], sub.size(), &subout[0]);
137-
if (size != 0)
136+
int _size = enc.Encrypt(&sub[0], sub.size(), &subout[0]);
137+
if (_size != 0)
138138
{
139-
subout.resize(size);
139+
subout.resize(_size);
140140
std::vector<unsigned char> subdecrypted(subout.size());
141-
size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]);
142-
subdecrypted.resize(size);
141+
_size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]);
142+
subdecrypted.resize(_size);
143143
BOOST_CHECK(decrypted.size() == in.size());
144144
BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + std::string(" != ") + HexStr(sub));
145145
}
@@ -174,13 +174,13 @@ void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad
174174
{
175175
std::vector<unsigned char> sub(i, in.end());
176176
std::vector<unsigned char> subout(sub.size() + AES_BLOCKSIZE);
177-
int size = enc.Encrypt(&sub[0], sub.size(), &subout[0]);
178-
if (size != 0)
177+
int _size = enc.Encrypt(&sub[0], sub.size(), &subout[0]);
178+
if (_size != 0)
179179
{
180-
subout.resize(size);
180+
subout.resize(_size);
181181
std::vector<unsigned char> subdecrypted(subout.size());
182-
size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]);
183-
subdecrypted.resize(size);
182+
_size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]);
183+
subdecrypted.resize(_size);
184184
BOOST_CHECK(decrypted.size() == in.size());
185185
BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + std::string(" != ") + HexStr(sub));
186186
}

0 commit comments

Comments
 (0)