Skip to content

Commit 88fcf3f

Browse files
laanwjcodablock
authored andcommitted
Merge bitcoin#8191: Do not shadow variables in src/wallet
b175cb7 Do not shadow variables. (Pavel Janík)
1 parent 5ce7ba6 commit 88fcf3f

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/wallet/db.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
387387
while (fSuccess) {
388388
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
389389
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
390-
int ret = db.ReadAtCursor(pcursor, ssKey, ssValue);
391-
if (ret == DB_NOTFOUND) {
390+
int ret1 = db.ReadAtCursor(pcursor, ssKey, ssValue);
391+
if (ret1 == DB_NOTFOUND) {
392392
pcursor->close();
393393
break;
394-
} else if (ret != 0) {
394+
} else if (ret1 != 0) {
395395
pcursor->close();
396396
fSuccess = false;
397397
break;

src/wallet/rpcwallet.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,10 +1199,10 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
11991199

12001200
if (fByAccounts)
12011201
{
1202-
tallyitem& item = mapAccountTally[strAccount];
1203-
item.nAmount += nAmount;
1204-
item.nConf = min(item.nConf, nConf);
1205-
item.fIsWatchonly = fIsWatchonly;
1202+
tallyitem& _item = mapAccountTally[strAccount];
1203+
_item.nAmount += nAmount;
1204+
_item.nConf = min(_item.nConf, nConf);
1205+
_item.fIsWatchonly = fIsWatchonly;
12061206
}
12071207
else
12081208
{
@@ -1218,9 +1218,9 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
12181218
UniValue transactions(UniValue::VARR);
12191219
if (it != mapTally.end())
12201220
{
1221-
BOOST_FOREACH(const uint256& item, (*it).second.txids)
1221+
BOOST_FOREACH(const uint256& _item, (*it).second.txids)
12221222
{
1223-
transactions.push_back(item.GetHex());
1223+
transactions.push_back(_item.GetHex());
12241224
}
12251225
}
12261226
obj.push_back(Pair("txids", transactions));

src/wallet/test/wallet_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
217217
// run the 'mtgox' test (see http://blockexplorer.com/tx/29a3efd3ef04f9153d47a990bd7b048a4b2d213daaa5fb8ed670fb85f13bdbcf)
218218
// they tried to consolidate 10 50k coins into one 500k coin, and ended up with 50k in change
219219
empty_wallet();
220-
for (int i = 0; i < 20; i++)
220+
for (int j = 0; j < 20; j++)
221221
add_coin(50000 * COIN);
222222

223223
BOOST_CHECK( wallet.SelectCoinsMinConf(500000 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet));
@@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
296296
BOOST_CHECK(!equal_sets(setCoinsRet, setCoinsRet2));
297297

298298
int fails = 0;
299-
for (int i = 0; i < RANDOM_REPEATS; i++)
299+
for (int j = 0; j < RANDOM_REPEATS; j++)
300300
{
301301
// selecting 1 from 100 identical coins depends on the shuffle; this test will fail 1% of the time
302302
// run the test RANDOM_REPEATS times and only complain if all of them fail
@@ -317,7 +317,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
317317
add_coin(25 * CENT);
318318

319319
fails = 0;
320-
for (int i = 0; i < RANDOM_REPEATS; i++)
320+
for (int j = 0; j < RANDOM_REPEATS; j++)
321321
{
322322
// selecting 1 from 100 identical coins depends on the shuffle; this test will fail 1% of the time
323323
// run the test RANDOM_REPEATS times and only complain if all of them fail

src/wallet/walletdb.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,8 @@ void ThreadFlushWalletDB(const string& strFile)
920920
if (nRefCount == 0)
921921
{
922922
boost::this_thread::interruption_point();
923-
map<string, int>::iterator mi = bitdb.mapFileUseCount.find(strFile);
924-
if (mi != bitdb.mapFileUseCount.end())
923+
map<string, int>::iterator _mi = bitdb.mapFileUseCount.find(strFile);
924+
if (_mi != bitdb.mapFileUseCount.end())
925925
{
926926
LogPrint("db", "Flushing %s\n", strFile);
927927
nLastFlushed = nWalletDBUpdated;
@@ -931,7 +931,7 @@ void ThreadFlushWalletDB(const string& strFile)
931931
bitdb.CloseDb(strFile);
932932
bitdb.CheckpointLSN(strFile);
933933

934-
bitdb.mapFileUseCount.erase(mi++);
934+
bitdb.mapFileUseCount.erase(_mi++);
935935
LogPrint("db", "Flushed %s %dms\n", strFile, GetTimeMillis() - nStart);
936936
}
937937
}

0 commit comments

Comments
 (0)