Browse Source

Do not shadow variables.

0.14
Pavel Janík 9 years ago
parent
commit
b175cb755b
  1. 6
      src/wallet/db.cpp
  2. 12
      src/wallet/rpcwallet.cpp
  3. 6
      src/wallet/test/wallet_tests.cpp
  4. 6
      src/wallet/walletdb.cpp

6
src/wallet/db.cpp

@ -387,11 +387,11 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
while (fSuccess) { while (fSuccess) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssKey(SER_DISK, CLIENT_VERSION);
CDataStream ssValue(SER_DISK, CLIENT_VERSION); CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = db.ReadAtCursor(pcursor, ssKey, ssValue); int ret1 = db.ReadAtCursor(pcursor, ssKey, ssValue);
if (ret == DB_NOTFOUND) { if (ret1 == DB_NOTFOUND) {
pcursor->close(); pcursor->close();
break; break;
} else if (ret != 0) { } else if (ret1 != 0) {
pcursor->close(); pcursor->close();
fSuccess = false; fSuccess = false;
break; break;

12
src/wallet/rpcwallet.cpp

@ -1176,10 +1176,10 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
if (fByAccounts) if (fByAccounts)
{ {
tallyitem& item = mapAccountTally[strAccount]; tallyitem& _item = mapAccountTally[strAccount];
item.nAmount += nAmount; _item.nAmount += nAmount;
item.nConf = min(item.nConf, nConf); _item.nConf = min(_item.nConf, nConf);
item.fIsWatchonly = fIsWatchonly; _item.fIsWatchonly = fIsWatchonly;
} }
else else
{ {
@ -1195,9 +1195,9 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
UniValue transactions(UniValue::VARR); UniValue transactions(UniValue::VARR);
if (it != mapTally.end()) if (it != mapTally.end())
{ {
BOOST_FOREACH(const uint256& item, (*it).second.txids) BOOST_FOREACH(const uint256& _item, (*it).second.txids)
{ {
transactions.push_back(item.GetHex()); transactions.push_back(_item.GetHex());
} }
} }
obj.push_back(Pair("txids", transactions)); obj.push_back(Pair("txids", transactions));

6
src/wallet/test/wallet_tests.cpp

@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
// run the 'mtgox' test (see http://blockexplorer.com/tx/29a3efd3ef04f9153d47a990bd7b048a4b2d213daaa5fb8ed670fb85f13bdbcf) // run the 'mtgox' test (see http://blockexplorer.com/tx/29a3efd3ef04f9153d47a990bd7b048a4b2d213daaa5fb8ed670fb85f13bdbcf)
// they tried to consolidate 10 50k coins into one 500k coin, and ended up with 50k in change // they tried to consolidate 10 50k coins into one 500k coin, and ended up with 50k in change
empty_wallet(); empty_wallet();
for (int i = 0; i < 20; i++) for (int j = 0; j < 20; j++)
add_coin(50000 * COIN); add_coin(50000 * COIN);
BOOST_CHECK( wallet.SelectCoinsMinConf(500000 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK( wallet.SelectCoinsMinConf(500000 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet));
@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
BOOST_CHECK(!equal_sets(setCoinsRet, setCoinsRet2)); BOOST_CHECK(!equal_sets(setCoinsRet, setCoinsRet2));
int fails = 0; int fails = 0;
for (int i = 0; i < RANDOM_REPEATS; i++) for (int j = 0; j < RANDOM_REPEATS; j++)
{ {
// selecting 1 from 100 identical coins depends on the shuffle; this test will fail 1% of the time // selecting 1 from 100 identical coins depends on the shuffle; this test will fail 1% of the time
// run the test RANDOM_REPEATS times and only complain if all of them fail // 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)
add_coin(25 * CENT); add_coin(25 * CENT);
fails = 0; fails = 0;
for (int i = 0; i < RANDOM_REPEATS; i++) for (int j = 0; j < RANDOM_REPEATS; j++)
{ {
// selecting 1 from 100 identical coins depends on the shuffle; this test will fail 1% of the time // selecting 1 from 100 identical coins depends on the shuffle; this test will fail 1% of the time
// run the test RANDOM_REPEATS times and only complain if all of them fail // run the test RANDOM_REPEATS times and only complain if all of them fail

6
src/wallet/walletdb.cpp

@ -887,8 +887,8 @@ void ThreadFlushWalletDB(const string& strFile)
if (nRefCount == 0) if (nRefCount == 0)
{ {
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();
map<string, int>::iterator mi = bitdb.mapFileUseCount.find(strFile); map<string, int>::iterator _mi = bitdb.mapFileUseCount.find(strFile);
if (mi != bitdb.mapFileUseCount.end()) if (_mi != bitdb.mapFileUseCount.end())
{ {
LogPrint("db", "Flushing %s\n", strFile); LogPrint("db", "Flushing %s\n", strFile);
nLastFlushed = nWalletDBUpdated; nLastFlushed = nWalletDBUpdated;
@ -898,7 +898,7 @@ void ThreadFlushWalletDB(const string& strFile)
bitdb.CloseDb(strFile); bitdb.CloseDb(strFile);
bitdb.CheckpointLSN(strFile); bitdb.CheckpointLSN(strFile);
bitdb.mapFileUseCount.erase(mi++); bitdb.mapFileUseCount.erase(_mi++);
LogPrint("db", "Flushed %s %dms\n", strFile, GetTimeMillis() - nStart); LogPrint("db", "Flushed %s %dms\n", strFile, GetTimeMillis() - nStart);
} }
} }

Loading…
Cancel
Save