diff --git a/src/httprpc.cpp b/src/httprpc.cpp --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -62,7 +62,7 @@ }; /* Stored RPC timer interface (for unregistration) */ -static HTTPRPCTimerInterface *httpRPCTimerInterface = 0; +static HTTPRPCTimerInterface *httpRPCTimerInterface = nullptr; static void JSONErrorReply(HTTPRequest *req, const UniValue &objError, const UniValue &id) { @@ -408,6 +408,6 @@ if (httpRPCTimerInterface) { RPCUnsetTimerInterface(httpRPCTimerInterface); delete httpRPCTimerInterface; - httpRPCTimerInterface = 0; + httpRPCTimerInterface = nullptr; } } diff --git a/src/httpserver.cpp b/src/httpserver.cpp --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -155,13 +155,13 @@ /** HTTP module state */ //! libevent event loop -static struct event_base *eventBase = 0; +static struct event_base *eventBase = nullptr; //! HTTP server -struct evhttp *eventHTTP = 0; +struct evhttp *eventHTTP = nullptr; //! List of subnets to allow RPC connections from static std::vector rpc_allow_subnets; //! Work queue for handling longer requests off the event loop thread -static WorkQueue *workQueue = 0; +static WorkQueue *workQueue = nullptr; //! Handlers for (sub)paths std::vector pathHandlers; //! Bound listening sockets @@ -505,11 +505,11 @@ } if (eventHTTP) { evhttp_free(eventHTTP); - eventHTTP = 0; + eventHTTP = nullptr; } if (eventBase) { event_base_free(eventBase); - eventBase = 0; + eventBase = nullptr; } LogPrint(BCLog::HTTP, "Stopped HTTP server\n"); } @@ -608,10 +608,10 @@ new HTTPEvent(eventBase, true, std::bind(evhttp_send_reply, req, nStatus, (const char *)nullptr, (struct evbuffer *)nullptr)); - ev->trigger(0); + ev->trigger(nullptr); replySent = true; // transferred back to main thread. - req = 0; + req = nullptr; } CService HTTPRequest::GetPeer() { diff --git a/src/support/lockedpool.h b/src/support/lockedpool.h --- a/src/support/lockedpool.h +++ b/src/support/lockedpool.h @@ -162,7 +162,7 @@ * proceeds, but it could warn. */ LockedPool(std::unique_ptr allocator, - LockingFailed_Callback lf_cb_in = 0); + LockingFailed_Callback lf_cb_in = nullptr); ~LockedPool(); /** diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -130,7 +130,7 @@ }; TorControlConnection::TorControlConnection(struct event_base *_base) - : base(_base), b_conn(0) {} + : base(_base), b_conn(nullptr) {} TorControlConnection::~TorControlConnection() { if (b_conn) { @@ -246,7 +246,7 @@ if (b_conn) { bufferevent_free(b_conn); } - b_conn = 0; + b_conn = nullptr; return true; } @@ -468,7 +468,7 @@ TorController::~TorController() { if (reconnect_ev) { event_free(reconnect_ev); - reconnect_ev = 0; + reconnect_ev = nullptr; } if (service.IsValid()) { RemoveLocal(service); diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -522,7 +522,7 @@ public: CScriptCheck() - : amount(), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), + : amount(), ptxTo(nullptr), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR), txdata() {} CScriptCheck(const CScript &scriptPubKeyIn, const Amount amountIn, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1890,11 +1890,11 @@ for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { CWalletTx *const pwtx = (*it).second.first; - if (pwtx != 0) { + if (pwtx != nullptr) { ListTransactions(pwallet, *pwtx, strAccount, 0, true, ret, filter); } CAccountingEntry *const pacentry = (*it).second.second; - if (pacentry != 0) { + if (pacentry != nullptr) { AcentryToJSON(*pacentry, strAccount, ret); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -796,7 +796,7 @@ CWalletTx *const pwtx = (*it).second.first; CAccountingEntry *const pacentry = (*it).second.second; int64_t &nOrderPos = - (pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos; + (pwtx != nullptr) ? pwtx->nOrderPos : pacentry->nOrderPos; if (nOrderPos == -1) { nOrderPos = nOrderPosNext++; @@ -1875,7 +1875,7 @@ } Amount CWalletTx::GetAvailableCredit(bool fUseCache) const { - if (pwallet == 0) { + if (pwallet == nullptr) { return Amount::zero(); } @@ -1922,7 +1922,7 @@ } Amount CWalletTx::GetAvailableWatchOnlyCredit(const bool &fUseCache) const { - if (pwallet == 0) { + if (pwallet == nullptr) { return Amount::zero(); } diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -634,8 +634,8 @@ pwallet->laccentries.clear(); ListAccountCreditDebit("*", pwallet->laccentries); for (CAccountingEntry &entry : pwallet->laccentries) { - pwallet->wtxOrdered.insert(std::make_pair( - entry.nOrderPos, CWallet::TxPair((CWalletTx *)0, &entry))); + pwallet->wtxOrdered.insert( + std::make_pair(entry.nOrderPos, CWallet::TxPair(nullptr, &entry))); } return result; diff --git a/src/zmq/zmqabstractnotifier.h b/src/zmq/zmqabstractnotifier.h --- a/src/zmq/zmqabstractnotifier.h +++ b/src/zmq/zmqabstractnotifier.h @@ -14,7 +14,7 @@ class CZMQAbstractNotifier { public: - CZMQAbstractNotifier() : psocket(0) {} + CZMQAbstractNotifier() : psocket(nullptr) {} virtual ~CZMQAbstractNotifier(); template static CZMQAbstractNotifier *Create() { diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp --- a/src/zmq/zmqnotificationinterface.cpp +++ b/src/zmq/zmqnotificationinterface.cpp @@ -112,7 +112,7 @@ } zmq_ctx_destroy(pcontext); - pcontext = 0; + pcontext = nullptr; } } diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -116,7 +116,7 @@ zmq_close(psocket); } - psocket = 0; + psocket = nullptr; } bool CZMQAbstractPublishNotifier::SendMessage(const char *command, @@ -127,7 +127,7 @@ uint8_t msgseq[sizeof(uint32_t)]; WriteLE32(&msgseq[0], nSequence); int rc = zmq_send_multipart(psocket, command, strlen(command), data, size, - msgseq, (size_t)sizeof(uint32_t), (void *)0); + msgseq, (size_t)sizeof(uint32_t), nullptr); if (rc == -1) { return false; }