From cdd79eb70fe163a92531a6f11c72bce6d228dac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Tue, 30 Aug 2016 22:41:56 +0200 Subject: [PATCH] C++11: s/boost::scoped_ptr/std::unique_ptr/ --- src/bitcoin-tx.cpp | 2 +- src/dbwrapper.cpp | 2 +- src/init.cpp | 2 +- src/main.cpp | 2 +- src/rpc/blockchain.cpp | 2 +- src/test/dbwrapper_tests.cpp | 6 +++--- src/txdb.cpp | 2 +- src/txdb.h | 2 +- src/wallet/walletdb.cpp | 3 +-- 9 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 5cf9b043e..cb863bda1 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -515,7 +515,7 @@ public: static void MutateTx(CMutableTransaction& tx, const string& command, const string& commandVal) { - boost::scoped_ptr ecc; + std::unique_ptr ecc; if (command == "nversion") MutateTxVersion(tx, commandVal); diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 09c68fbe5..4fa06135d 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -117,7 +117,7 @@ std::vector CDBWrapper::CreateObfuscateKey() const bool CDBWrapper::IsEmpty() { - boost::scoped_ptr it(NewIterator()); + std::unique_ptr it(NewIterator()); it->SeekToFirst(); return !(it->Valid()); } diff --git a/src/init.cpp b/src/init.cpp index 9bd820852..27843fa88 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -162,7 +162,7 @@ public: static CCoinsViewDB *pcoinsdbview = NULL; static CCoinsViewErrorCatcher *pcoinscatcher = NULL; -static boost::scoped_ptr globalVerifyHandle; +static std::unique_ptr globalVerifyHandle; void Interrupt(boost::thread_group& threadGroup) { diff --git a/src/main.cpp b/src/main.cpp index 30edc5dbe..f19fada11 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -196,7 +196,7 @@ namespace { * * Memory used: 1.3 MB */ - boost::scoped_ptr recentRejects; + std::unique_ptr recentRejects; uint256 hashRecentRejectsChainTip; /** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index e3c32d905..0f3edde14 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -632,7 +632,7 @@ struct CCoinsStats //! Calculate statistics about the unspent transaction output set static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) { - boost::scoped_ptr pcursor(view->Cursor()); + std::unique_ptr pcursor(view->Cursor()); CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); stats.hashBlock = pcursor->GetBestBlock(); diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp index a0bdcf4af..d4d825d19 100644 --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator) uint256 in2 = GetRandHash(); BOOST_CHECK(dbw.Write(key2, in2)); - boost::scoped_ptr it(const_cast(&dbw)->NewIterator()); + std::unique_ptr it(const_cast(&dbw)->NewIterator()); // Be sure to seek past the obfuscation key (if it exists) it->Seek(key); @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering) BOOST_CHECK(dbw.Write(key, value)); } - boost::scoped_ptr it(const_cast(&dbw)->NewIterator()); + std::unique_ptr it(const_cast(&dbw)->NewIterator()); for (int c=0; c<2; ++c) { int seek_start; if (c == 0) @@ -290,7 +290,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering) } } - boost::scoped_ptr it(const_cast(&dbw)->NewIterator()); + std::unique_ptr it(const_cast(&dbw)->NewIterator()); for (int c=0; c<2; ++c) { int seek_start; if (c == 0) diff --git a/src/txdb.cpp b/src/txdb.cpp index 078c29def..4f11c7b95 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -173,7 +173,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { bool CBlockTreeDB::LoadBlockIndexGuts(boost::function insertBlockIndex) { - boost::scoped_ptr pcursor(NewIterator()); + std::unique_ptr pcursor(NewIterator()); pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256())); diff --git a/src/txdb.h b/src/txdb.h index 5b98d2792..adb3f6632 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -92,7 +92,7 @@ public: private: CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn): CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {} - boost::scoped_ptr pcursor; + std::unique_ptr pcursor; std::pair keyTmp; friend class CCoinsViewDB; diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 9de0671ea..239b1ac9b 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include using namespace std; @@ -941,7 +940,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKe } LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size()); - boost::scoped_ptr pdbCopy(new Db(dbenv.dbenv, 0)); + std::unique_ptr pdbCopy(new Db(dbenv.dbenv, 0)); int ret = pdbCopy->open(NULL, // Txn pointer filename.c_str(), // Filename "main", // Logical db name