Skip to content

Commit bb2aaee

Browse files
committed
Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1.
1 parent 3d857f3 commit bb2aaee

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

src/streams.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ class CDataStream
404404
return (*this);
405405
}
406406

407-
void GetAndClear(CSerializeData &data) {
408-
data.insert(data.end(), begin(), end());
407+
void GetAndClear(CSerializeData &d) {
408+
d.insert(d.end(), begin(), end());
409409
clear();
410410
}
411411

src/test/script_tests.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// Uncomment if you want to output updated JSON tests.
3333
// #define UPDATE_JSON_TESTS
3434

35-
static const unsigned int flags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC;
35+
static const unsigned int gFlags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC;
3636

3737
unsigned int ParseScriptFlags(std::string strFlags);
3838
std::string FormatScriptFlags(unsigned int flags);
@@ -1070,18 +1070,18 @@ BOOST_AUTO_TEST_CASE(script_CHECKMULTISIG12)
10701070
CMutableTransaction txTo12 = BuildSpendingTransaction(CScript(), CScriptWitness(), txFrom12);
10711071

10721072
CScript goodsig1 = sign_multisig(scriptPubKey12, key1, txTo12);
1073-
BOOST_CHECK(VerifyScript(goodsig1, scriptPubKey12, NULL, flags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
1073+
BOOST_CHECK(VerifyScript(goodsig1, scriptPubKey12, NULL, gFlags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
10741074
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
10751075
txTo12.vout[0].nValue = 2;
1076-
BOOST_CHECK(!VerifyScript(goodsig1, scriptPubKey12, NULL, flags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
1076+
BOOST_CHECK(!VerifyScript(goodsig1, scriptPubKey12, NULL, gFlags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
10771077
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
10781078

10791079
CScript goodsig2 = sign_multisig(scriptPubKey12, key2, txTo12);
1080-
BOOST_CHECK(VerifyScript(goodsig2, scriptPubKey12, NULL, flags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
1080+
BOOST_CHECK(VerifyScript(goodsig2, scriptPubKey12, NULL, gFlags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
10811081
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
10821082

10831083
CScript badsig1 = sign_multisig(scriptPubKey12, key3, txTo12);
1084-
BOOST_CHECK(!VerifyScript(badsig1, scriptPubKey12, NULL, flags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
1084+
BOOST_CHECK(!VerifyScript(badsig1, scriptPubKey12, NULL, gFlags, MutableTransactionSignatureChecker(&txTo12, 0, txFrom12.vout[0].nValue), &err));
10851085
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
10861086
}
10871087

@@ -1103,54 +1103,54 @@ BOOST_AUTO_TEST_CASE(script_CHECKMULTISIG23)
11031103
std::vector<CKey> keys;
11041104
keys.push_back(key1); keys.push_back(key2);
11051105
CScript goodsig1 = sign_multisig(scriptPubKey23, keys, txTo23);
1106-
BOOST_CHECK(VerifyScript(goodsig1, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1106+
BOOST_CHECK(VerifyScript(goodsig1, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11071107
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
11081108

11091109
keys.clear();
11101110
keys.push_back(key1); keys.push_back(key3);
11111111
CScript goodsig2 = sign_multisig(scriptPubKey23, keys, txTo23);
1112-
BOOST_CHECK(VerifyScript(goodsig2, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1112+
BOOST_CHECK(VerifyScript(goodsig2, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11131113
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
11141114

11151115
keys.clear();
11161116
keys.push_back(key2); keys.push_back(key3);
11171117
CScript goodsig3 = sign_multisig(scriptPubKey23, keys, txTo23);
1118-
BOOST_CHECK(VerifyScript(goodsig3, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1118+
BOOST_CHECK(VerifyScript(goodsig3, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11191119
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
11201120

11211121
keys.clear();
11221122
keys.push_back(key2); keys.push_back(key2); // Can't re-use sig
11231123
CScript badsig1 = sign_multisig(scriptPubKey23, keys, txTo23);
1124-
BOOST_CHECK(!VerifyScript(badsig1, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1124+
BOOST_CHECK(!VerifyScript(badsig1, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11251125
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
11261126

11271127
keys.clear();
11281128
keys.push_back(key2); keys.push_back(key1); // sigs must be in correct order
11291129
CScript badsig2 = sign_multisig(scriptPubKey23, keys, txTo23);
1130-
BOOST_CHECK(!VerifyScript(badsig2, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1130+
BOOST_CHECK(!VerifyScript(badsig2, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11311131
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
11321132

11331133
keys.clear();
11341134
keys.push_back(key3); keys.push_back(key2); // sigs must be in correct order
11351135
CScript badsig3 = sign_multisig(scriptPubKey23, keys, txTo23);
1136-
BOOST_CHECK(!VerifyScript(badsig3, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1136+
BOOST_CHECK(!VerifyScript(badsig3, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11371137
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
11381138

11391139
keys.clear();
11401140
keys.push_back(key4); keys.push_back(key2); // sigs must match pubkeys
11411141
CScript badsig4 = sign_multisig(scriptPubKey23, keys, txTo23);
1142-
BOOST_CHECK(!VerifyScript(badsig4, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1142+
BOOST_CHECK(!VerifyScript(badsig4, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11431143
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
11441144

11451145
keys.clear();
11461146
keys.push_back(key1); keys.push_back(key4); // sigs must match pubkeys
11471147
CScript badsig5 = sign_multisig(scriptPubKey23, keys, txTo23);
1148-
BOOST_CHECK(!VerifyScript(badsig5, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1148+
BOOST_CHECK(!VerifyScript(badsig5, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11491149
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err));
11501150

11511151
keys.clear(); // Must have signatures
11521152
CScript badsig6 = sign_multisig(scriptPubKey23, keys, txTo23);
1153-
BOOST_CHECK(!VerifyScript(badsig6, scriptPubKey23, NULL, flags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
1153+
BOOST_CHECK(!VerifyScript(badsig6, scriptPubKey23, NULL, gFlags, MutableTransactionSignatureChecker(&txTo23, 0, txFrom23.vout[0].nValue), &err));
11541154
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_INVALID_STACK_OPERATION, ScriptErrorString(err));
11551155
}
11561156

src/torcontrol.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -662,26 +662,26 @@ void TorController::reconnect_cb(evutil_socket_t fd, short what, void *arg)
662662
}
663663

664664
/****** Thread ********/
665-
struct event_base *base;
665+
struct event_base *gBase;
666666
boost::thread torControlThread;
667667

668668
static void TorControlThread()
669669
{
670-
TorController ctrl(base, GetArg("-torcontrol", DEFAULT_TOR_CONTROL));
670+
TorController ctrl(gBase, GetArg("-torcontrol", DEFAULT_TOR_CONTROL));
671671

672-
event_base_dispatch(base);
672+
event_base_dispatch(gBase);
673673
}
674674

675675
void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler)
676676
{
677-
assert(!base);
677+
assert(!gBase);
678678
#ifdef WIN32
679679
evthread_use_windows_threads();
680680
#else
681681
evthread_use_pthreads();
682682
#endif
683-
base = event_base_new();
684-
if (!base) {
683+
gBase = event_base_new();
684+
if (!gBase) {
685685
LogPrintf("tor: Unable to create event_base\n");
686686
return;
687687
}
@@ -691,18 +691,18 @@ void StartTorControl(boost::thread_group& threadGroup, CScheduler& scheduler)
691691

692692
void InterruptTorControl()
693693
{
694-
if (base) {
694+
if (gBase) {
695695
LogPrintf("tor: Thread interrupt\n");
696-
event_base_loopbreak(base);
696+
event_base_loopbreak(gBase);
697697
}
698698
}
699699

700700
void StopTorControl()
701701
{
702-
if (base) {
702+
if (gBase) {
703703
torControlThread.join();
704-
event_base_free(base);
705-
base = 0;
704+
event_base_free(gBase);
705+
gBase = 0;
706706
}
707707
}
708708

0 commit comments

Comments
 (0)