Skip to content

Commit cbe9ae8

Browse files
committed
Merge #8466: [Trivial] Do not shadow variables in networking code
b7c349d Do not shadow variables in networking code (Pavel Janík)
2 parents 381d0dd + b7c349d commit cbe9ae8

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace {
7070
SOCKET socket;
7171
bool whitelisted;
7272

73-
ListenSocket(SOCKET socket, bool whitelisted) : socket(socket), whitelisted(whitelisted) {}
73+
ListenSocket(SOCKET _socket, bool _whitelisted) : socket(_socket), whitelisted(_whitelisted) {}
7474
};
7575
}
7676

src/net.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,21 +512,21 @@ class CNode
512512

513513

514514

515-
void AddAddressKnown(const CAddress& addr)
515+
void AddAddressKnown(const CAddress& _addr)
516516
{
517-
addrKnown.insert(addr.GetKey());
517+
addrKnown.insert(_addr.GetKey());
518518
}
519519

520-
void PushAddress(const CAddress& addr)
520+
void PushAddress(const CAddress& _addr)
521521
{
522522
// Known checking here is only to save space from duplicates.
523523
// SendMessages will filter it again for knowns that were added
524524
// after addresses were pushed.
525-
if (addr.IsValid() && !addrKnown.contains(addr.GetKey())) {
525+
if (_addr.IsValid() && !addrKnown.contains(_addr.GetKey())) {
526526
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
527-
vAddrToSend[insecure_rand() % vAddrToSend.size()] = addr;
527+
vAddrToSend[insecure_rand() % vAddrToSend.size()] = _addr;
528528
} else {
529-
vAddrToSend.push_back(addr);
529+
vAddrToSend.push_back(_addr);
530530
}
531531
}
532532
}

src/netaddress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ bool CNetAddr::IsValid() const
197197
return false;
198198

199199
// unspecified IPv6 address (::/128)
200-
unsigned char ipNone[16] = {};
201-
if (memcmp(ip, ipNone, 16) == 0)
200+
unsigned char ipNone6[16] = {};
201+
if (memcmp(ip, ipNone6, 16) == 0)
202202
return false;
203203

204204
// documentation IPv6 address

src/netbase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest
631631

632632
SplitHostPort(std::string(pszDest), port, strDest);
633633

634-
proxyType nameProxy;
635-
GetNameProxy(nameProxy);
634+
proxyType proxy;
635+
GetNameProxy(proxy);
636636

637637
std::vector<CService> addrResolved;
638638
if (Lookup(strDest.c_str(), addrResolved, port, fNameLookup && !HaveNameProxy(), 256)) {
@@ -646,7 +646,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest
646646

647647
if (!HaveNameProxy())
648648
return false;
649-
return ConnectThroughProxy(nameProxy, strDest, port, hSocketRet, nTimeout, outProxyConnectionFailed);
649+
return ConnectThroughProxy(proxy, strDest, port, hSocketRet, nTimeout, outProxyConnectionFailed);
650650
}
651651

652652
bool LookupSubNet(const char* pszName, CSubNet& ret)

src/netbase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class proxyType
2929
{
3030
public:
3131
proxyType(): randomize_credentials(false) {}
32-
proxyType(const CService &proxy, bool randomize_credentials=false): proxy(proxy), randomize_credentials(randomize_credentials) {}
32+
proxyType(const CService &_proxy, bool _randomize_credentials=false): proxy(_proxy), randomize_credentials(_randomize_credentials) {}
3333

3434
bool IsValid() const { return proxy.IsValid(); }
3535

0 commit comments

Comments
 (0)