From 258ed119ab6ae9782110b71959ee058f1fd5ed61 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 28 Apr 2016 13:40:20 +0200 Subject: [PATCH] =?UTF-8?q?auto=5Fptr=20=E2=86=92=20unique=5Fptr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the few occurrences of the deprecated `auto_ptr` to c++11 `unique_ptr`. Silences the deprecation warnings. Also add a missing `std::` for consistency. --- src/httpserver.cpp | 4 ++-- src/miner.cpp | 4 ++-- src/rpcmining.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 64250ba31ad2c..0315c1e062b22 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -253,7 +253,7 @@ static std::string RequestMethodString(HTTPRequest::RequestMethod m) /** HTTP request callback */ static void http_request_cb(struct evhttp_request* req, void* arg) { - std::auto_ptr hreq(new HTTPRequest(req)); + std::unique_ptr hreq(new HTTPRequest(req)); LogPrint("http", "Received a %s request for %s from %s\n", RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString()); @@ -289,7 +289,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg) // Dispatch to worker thread if (i != iend) { - std::auto_ptr item(new HTTPWorkItem(hreq.release(), path, i->handler)); + std::unique_ptr item(new HTTPWorkItem(hreq.release(), path, i->handler)); assert(workQueue); if (workQueue->Enqueue(item.get())) item.release(); /* if true, queue took ownership */ diff --git a/src/miner.cpp b/src/miner.cpp index d8fef70733993..eb7d896f0b766 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -77,7 +77,7 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& scriptPubKeyIn) { // Create new block - auto_ptr pblocktemplate(new CBlockTemplate()); + std::unique_ptr pblocktemplate(new CBlockTemplate()); if(!pblocktemplate.get()) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience @@ -437,7 +437,7 @@ void static BitcoinMiner(const CChainParams& chainparams) CBlockIndex* pindexPrev = chainActive.Tip(); if(!pindexPrev) break; - auto_ptr pblocktemplate(CreateNewBlock(chainparams, coinbaseScript->reserveScript)); + std::unique_ptr pblocktemplate(CreateNewBlock(chainparams, coinbaseScript->reserveScript)); if (!pblocktemplate.get()) { LogPrintf("DashMiner -- Keypool ran out, please call keypoolrefill before restarting the mining thread\n"); diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index f002502944544..3924bad9fb350 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -165,7 +165,7 @@ UniValue generate(const UniValue& params, bool fHelp) UniValue blockHashes(UniValue::VARR); while (nHeight < nHeightEnd) { - auto_ptr pblocktemplate(CreateNewBlock(Params(), coinbaseScript->reserveScript)); + std::unique_ptr pblocktemplate(CreateNewBlock(Params(), coinbaseScript->reserveScript)); if (!pblocktemplate.get()) throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block"); CBlock *pblock = &pblocktemplate->block;