Merge #8166: src/test: Do not shadow local variables

c2715d3 Do not shadow local variables (Pavel Janík)
This commit is contained in:
Wladimir J. van der Laan 2016-06-09 08:25:13 +02:00 committed by Alexander Block
parent aa6cb48bfa
commit 2e3aacf43f
4 changed files with 8 additions and 8 deletions

View File

@ -79,7 +79,7 @@ class TestAddrTypeVisitor : public boost::static_visitor<bool>
private: private:
std::string exp_addrType; std::string exp_addrType;
public: public:
TestAddrTypeVisitor(const std::string &exp_addrType) : exp_addrType(exp_addrType) { } TestAddrTypeVisitor(const std::string &_exp_addrType) : exp_addrType(_exp_addrType) { }
bool operator()(const CKeyID &id) const bool operator()(const CKeyID &id) const
{ {
return (exp_addrType == "pubkey"); return (exp_addrType == "pubkey");
@ -100,7 +100,7 @@ class TestPayloadVisitor : public boost::static_visitor<bool>
private: private:
std::vector<unsigned char> exp_payload; std::vector<unsigned char> exp_payload;
public: public:
TestPayloadVisitor(std::vector<unsigned char> &exp_payload) : exp_payload(exp_payload) { } TestPayloadVisitor(std::vector<unsigned char> &_exp_payload) : exp_payload(_exp_payload) { }
bool operator()(const CKeyID &id) const bool operator()(const CKeyID &id) const
{ {
uint160 exp_key(exp_payload); uint160 exp_key(exp_payload);

View File

@ -387,8 +387,8 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
SetMockTime(0); SetMockTime(0);
mempool.clear(); mempool.clear();
BOOST_FOREACH(CTransaction *tx, txFirst) BOOST_FOREACH(CTransaction *_tx, txFirst)
delete tx; delete _tx;
fCheckpointsEnabled = true; fCheckpointsEnabled = true;
} }

View File

@ -37,8 +37,8 @@ BOOST_AUTO_TEST_CASE(pmt_test1)
seed_insecure_rand(false); seed_insecure_rand(false);
static const unsigned int nTxCounts[] = {1, 4, 7, 17, 56, 100, 127, 256, 312, 513, 1000, 4095}; static const unsigned int nTxCounts[] = {1, 4, 7, 17, 56, 100, 127, 256, 312, 513, 1000, 4095};
for (int n = 0; n < 12; n++) { for (int i = 0; i < 12; i++) {
unsigned int nTx = nTxCounts[n]; unsigned int nTx = nTxCounts[i];
// build a block with some dummy transactions // build a block with some dummy transactions
CBlock block; CBlock block;

View File

@ -217,8 +217,8 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
if (((r >> 21) % 32) == 7) { if (((r >> 21) % 32) == 7) {
int values[4]; int values[4];
int num = 1 + (insecure_rand() % 4); int num = 1 + (insecure_rand() % 4);
for (int i = 0; i < num; i++) { for (int k = 0; k < num; k++) {
values[i] = insecure_rand(); values[k] = insecure_rand();
} }
test.insert_range(insecure_rand() % (test.size() + 1), values, values + num); test.insert_range(insecure_rand() % (test.size() + 1), values, values + num);
} }