Skip to content

Commit 258ed11

Browse files
laanwjUdjinM6
authored andcommitted
auto_ptr → unique_ptr
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.
1 parent c0450f6 commit 258ed11

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/httpserver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static std::string RequestMethodString(HTTPRequest::RequestMethod m)
253253
/** HTTP request callback */
254254
static void http_request_cb(struct evhttp_request* req, void* arg)
255255
{
256-
std::auto_ptr<HTTPRequest> hreq(new HTTPRequest(req));
256+
std::unique_ptr<HTTPRequest> hreq(new HTTPRequest(req));
257257

258258
LogPrint("http", "Received a %s request for %s from %s\n",
259259
RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString());
@@ -289,7 +289,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
289289

290290
// Dispatch to worker thread
291291
if (i != iend) {
292-
std::auto_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler));
292+
std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler));
293293
assert(workQueue);
294294
if (workQueue->Enqueue(item.get()))
295295
item.release(); /* if true, queue took ownership */

src/miner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam
7777
CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& scriptPubKeyIn)
7878
{
7979
// Create new block
80-
auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
80+
std::unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
8181
if(!pblocktemplate.get())
8282
return NULL;
8383
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
@@ -437,7 +437,7 @@ void static BitcoinMiner(const CChainParams& chainparams)
437437
CBlockIndex* pindexPrev = chainActive.Tip();
438438
if(!pindexPrev) break;
439439

440-
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(chainparams, coinbaseScript->reserveScript));
440+
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(chainparams, coinbaseScript->reserveScript));
441441
if (!pblocktemplate.get())
442442
{
443443
LogPrintf("DashMiner -- Keypool ran out, please call keypoolrefill before restarting the mining thread\n");

src/rpcmining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ UniValue generate(const UniValue& params, bool fHelp)
165165
UniValue blockHashes(UniValue::VARR);
166166
while (nHeight < nHeightEnd)
167167
{
168-
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(Params(), coinbaseScript->reserveScript));
168+
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(Params(), coinbaseScript->reserveScript));
169169
if (!pblocktemplate.get())
170170
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
171171
CBlock *pblock = &pblocktemplate->block;

0 commit comments

Comments
 (0)