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.
This commit is contained in:
Wladimir J. van der Laan
2016-04-28 13:40:20 +02:00
committed by Jack Grigg
parent 0e2b1ae259
commit 08c581940a
3 changed files with 5 additions and 5 deletions

View File

@@ -217,7 +217,7 @@ static std::string RequestMethodString(HTTPRequest::RequestMethod m)
/** HTTP request callback */ /** HTTP request callback */
static void http_request_cb(struct evhttp_request* req, void* arg) static void http_request_cb(struct evhttp_request* req, void* arg)
{ {
std::auto_ptr<HTTPRequest> hreq(new HTTPRequest(req)); std::unique_ptr<HTTPRequest> hreq(new HTTPRequest(req));
LogPrint("http", "Received a %s request for %s from %s\n", LogPrint("http", "Received a %s request for %s from %s\n",
RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString()); RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString());
@@ -253,7 +253,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
// Dispatch to worker thread // Dispatch to worker thread
if (i != iend) { if (i != iend) {
std::auto_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler)); std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler));
assert(workQueue); assert(workQueue);
if (workQueue->Enqueue(item.get())) if (workQueue->Enqueue(item.get()))
item.release(); /* if true, queue took ownership */ item.release(); /* if true, queue took ownership */

View File

@@ -110,7 +110,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
{ {
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();
// Create new block // Create new block
unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate()); std::unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
if(!pblocktemplate.get()) if(!pblocktemplate.get())
return NULL; return NULL;
CBlock *pblock = &pblocktemplate->block; // pointer for convenience CBlock *pblock = &pblocktemplate->block; // pointer for convenience

View File

@@ -206,9 +206,9 @@ UniValue generate(const UniValue& params, bool fHelp)
while (nHeight < nHeightEnd) while (nHeight < nHeightEnd)
{ {
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey)); std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
#else #else
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey()); std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey());
#endif #endif
if (!pblocktemplate.get()) if (!pblocktemplate.get())
throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet keypool empty"); throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet keypool empty");