Skip to content

Commit e532748

Browse files
practicalswiftfanquake
authored andcommitted
Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant)
1 parent f436bfd commit e532748

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

src/mapport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static bool ProcessUpnp()
193193
std::string strDesc = PACKAGE_NAME " " + FormatFullVersion();
194194

195195
do {
196-
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
196+
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", nullptr, "0");
197197

198198
if (r != UPNPCOMMAND_SUCCESS) {
199199
ret = false;
@@ -206,7 +206,7 @@ static bool ProcessUpnp()
206206
} while (g_mapport_interrupt.sleep_for(PORT_MAPPING_REANNOUNCE_PERIOD));
207207
g_mapport_interrupt.reset();
208208

209-
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
209+
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", nullptr);
210210
LogPrintf("UPNP_DeletePortMapping() returned: %d\n", r);
211211
freeUPNPDevlist(devlist); devlist = nullptr;
212212
FreeUPNPUrls(&urls);

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ bool ConnectThroughProxy(const Proxy& proxy, const std::string& strDest, uint16_
675675
return false;
676676
}
677677
} else {
678-
if (!Socks5(strDest, port, 0, sock)) {
678+
if (!Socks5(strDest, port, nullptr, sock)) {
679679
return false;
680680
}
681681
}

src/qt/intro.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
226226
}
227227

228228
/* If current default data directory does not exist, let the user choose one */
229-
Intro intro(0, Params().AssumedBlockchainSize(), Params().AssumedChainStateSize());
229+
Intro intro(nullptr, Params().AssumedBlockchainSize(), Params().AssumedChainStateSize());
230230
intro.setDataDirectory(dataDir);
231231
intro.setWindowIcon(QIcon(":icons/bitcoin"));
232232
did_show_intro = true;

src/randomenv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ void RandAddStaticEnv(CSHA512& hasher)
363363

364364
#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
365365
// Network interfaces
366-
struct ifaddrs *ifad = NULL;
366+
struct ifaddrs *ifad = nullptr;
367367
getifaddrs(&ifad);
368368
struct ifaddrs *ifit = ifad;
369-
while (ifit != NULL) {
369+
while (ifit != nullptr) {
370370
hasher.Write((const unsigned char*)&ifit, sizeof(ifit));
371371
hasher.Write((const unsigned char*)ifit->ifa_name, strlen(ifit->ifa_name) + 1);
372372
hasher.Write((const unsigned char*)&ifit->ifa_flags, sizeof(ifit->ifa_flags));

src/support/allocators/secure.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct secure_allocator : public std::allocator<T> {
3737
typedef secure_allocator<_Other> other;
3838
};
3939

40-
T* allocate(std::size_t n, const void* hint = 0)
40+
T* allocate(std::size_t n, const void* hint = nullptr)
4141
{
4242
T* allocation = static_cast<T*>(LockedPoolManager::Instance().alloc(sizeof(T) * n));
4343
if (!allocation) {

src/test/fuzz/crypto_diff_fuzz_chacha20.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void ECRYPT_encrypt_bytes(ECRYPT_ctx* x, const u8* m, u8* c, u32 bytes)
128128
{
129129
u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
130130
u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
131-
u8* ctarget = NULL;
131+
u8* ctarget = nullptr;
132132
u8 tmp[64];
133133
uint32_t i;
134134

src/torcontrol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
306306

307307
TorController::TorController(struct event_base* _base, const std::string& tor_control_center, const CService& target):
308308
base(_base),
309-
m_tor_control_center(tor_control_center), conn(base), reconnect(true), reconnect_ev(0),
309+
m_tor_control_center(tor_control_center), conn(base), reconnect(true), reconnect_ev(nullptr),
310310
reconnect_timeout(RECONNECT_TIMEOUT_START),
311311
m_target(target)
312312
{

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
27682768
} else if (wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS) {
27692769
// Make it impossible to disable private keys after creation
27702770
error = strprintf(_("Error loading %s: Private keys can only be disabled during creation"), walletFile);
2771-
return NULL;
2771+
return nullptr;
27722772
} else if (walletInstance->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
27732773
for (auto spk_man : walletInstance->GetActiveScriptPubKeyMans()) {
27742774
if (spk_man->HavePrivateKeys()) {

0 commit comments

Comments
 (0)