Skip to content

Commit cdd79eb

Browse files
committed
C++11: s/boost::scoped_ptr/std::unique_ptr/
1 parent 2b23dba commit cdd79eb

File tree

9 files changed

+11
-12
lines changed

9 files changed

+11
-12
lines changed

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ class Secp256k1Init
515515
static void MutateTx(CMutableTransaction& tx, const string& command,
516516
const string& commandVal)
517517
{
518-
boost::scoped_ptr<Secp256k1Init> ecc;
518+
std::unique_ptr<Secp256k1Init> ecc;
519519

520520
if (command == "nversion")
521521
MutateTxVersion(tx, commandVal);

src/dbwrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ std::vector<unsigned char> CDBWrapper::CreateObfuscateKey() const
117117

118118
bool CDBWrapper::IsEmpty()
119119
{
120-
boost::scoped_ptr<CDBIterator> it(NewIterator());
120+
std::unique_ptr<CDBIterator> it(NewIterator());
121121
it->SeekToFirst();
122122
return !(it->Valid());
123123
}

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class CCoinsViewErrorCatcher : public CCoinsViewBacked
162162

163163
static CCoinsViewDB *pcoinsdbview = NULL;
164164
static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
165-
static boost::scoped_ptr<ECCVerifyHandle> globalVerifyHandle;
165+
static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
166166

167167
void Interrupt(boost::thread_group& threadGroup)
168168
{

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ namespace {
196196
*
197197
* Memory used: 1.3 MB
198198
*/
199-
boost::scoped_ptr<CRollingBloomFilter> recentRejects;
199+
std::unique_ptr<CRollingBloomFilter> recentRejects;
200200
uint256 hashRecentRejectsChainTip;
201201

202202
/** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ struct CCoinsStats
632632
//! Calculate statistics about the unspent transaction output set
633633
static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
634634
{
635-
boost::scoped_ptr<CCoinsViewCursor> pcursor(view->Cursor());
635+
std::unique_ptr<CCoinsViewCursor> pcursor(view->Cursor());
636636

637637
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
638638
stats.hashBlock = pcursor->GetBestBlock();

src/test/dbwrapper_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
101101
uint256 in2 = GetRandHash();
102102
BOOST_CHECK(dbw.Write(key2, in2));
103103

104-
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
104+
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
105105

106106
// Be sure to seek past the obfuscation key (if it exists)
107107
it->Seek(key);
@@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
214214
BOOST_CHECK(dbw.Write(key, value));
215215
}
216216

217-
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
217+
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
218218
for (int c=0; c<2; ++c) {
219219
int seek_start;
220220
if (c == 0)
@@ -290,7 +290,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
290290
}
291291
}
292292

293-
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
293+
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
294294
for (int c=0; c<2; ++c) {
295295
int seek_start;
296296
if (c == 0)

src/txdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
173173

174174
bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256&)> insertBlockIndex)
175175
{
176-
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
176+
std::unique_ptr<CDBIterator> pcursor(NewIterator());
177177

178178
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
179179

src/txdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class CCoinsViewDBCursor: public CCoinsViewCursor
9292
private:
9393
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn):
9494
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
95-
boost::scoped_ptr<CDBIterator> pcursor;
95+
std::unique_ptr<CDBIterator> pcursor;
9696
std::pair<char, uint256> keyTmp;
9797

9898
friend class CCoinsViewDB;

src/wallet/walletdb.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <boost/version.hpp>
1919
#include <boost/filesystem.hpp>
2020
#include <boost/foreach.hpp>
21-
#include <boost/scoped_ptr.hpp>
2221
#include <boost/thread.hpp>
2322

2423
using namespace std;
@@ -941,7 +940,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKe
941940
}
942941
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
943942

944-
boost::scoped_ptr<Db> pdbCopy(new Db(dbenv.dbenv, 0));
943+
std::unique_ptr<Db> pdbCopy(new Db(dbenv.dbenv, 0));
945944
int ret = pdbCopy->open(NULL, // Txn pointer
946945
filename.c_str(), // Filename
947946
"main", // Logical db name

0 commit comments

Comments
 (0)