Browse Source

C++11: s/boost::scoped_ptr/std::unique_ptr/

0.14
Jorge Timón 8 years ago
parent
commit
cdd79eb70f
  1. 2
      src/bitcoin-tx.cpp
  2. 2
      src/dbwrapper.cpp
  3. 2
      src/init.cpp
  4. 2
      src/main.cpp
  5. 2
      src/rpc/blockchain.cpp
  6. 6
      src/test/dbwrapper_tests.cpp
  7. 2
      src/txdb.cpp
  8. 2
      src/txdb.h
  9. 3
      src/wallet/walletdb.cpp

2
src/bitcoin-tx.cpp

@ -515,7 +515,7 @@ public: @@ -515,7 +515,7 @@ public:
static void MutateTx(CMutableTransaction& tx, const string& command,
const string& commandVal)
{
boost::scoped_ptr<Secp256k1Init> ecc;
std::unique_ptr<Secp256k1Init> ecc;
if (command == "nversion")
MutateTxVersion(tx, commandVal);

2
src/dbwrapper.cpp

@ -117,7 +117,7 @@ std::vector<unsigned char> CDBWrapper::CreateObfuscateKey() const @@ -117,7 +117,7 @@ std::vector<unsigned char> CDBWrapper::CreateObfuscateKey() const
bool CDBWrapper::IsEmpty()
{
boost::scoped_ptr<CDBIterator> it(NewIterator());
std::unique_ptr<CDBIterator> it(NewIterator());
it->SeekToFirst();
return !(it->Valid());
}

2
src/init.cpp

@ -162,7 +162,7 @@ public: @@ -162,7 +162,7 @@ public:
static CCoinsViewDB *pcoinsdbview = NULL;
static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
static boost::scoped_ptr<ECCVerifyHandle> globalVerifyHandle;
static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
void Interrupt(boost::thread_group& threadGroup)
{

2
src/main.cpp

@ -196,7 +196,7 @@ namespace { @@ -196,7 +196,7 @@ namespace {
*
* Memory used: 1.3 MB
*/
boost::scoped_ptr<CRollingBloomFilter> recentRejects;
std::unique_ptr<CRollingBloomFilter> recentRejects;
uint256 hashRecentRejectsChainTip;
/** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */

2
src/rpc/blockchain.cpp

@ -632,7 +632,7 @@ struct CCoinsStats @@ -632,7 +632,7 @@ struct CCoinsStats
//! Calculate statistics about the unspent transaction output set
static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
{
boost::scoped_ptr<CCoinsViewCursor> pcursor(view->Cursor());
std::unique_ptr<CCoinsViewCursor> pcursor(view->Cursor());
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
stats.hashBlock = pcursor->GetBestBlock();

6
src/test/dbwrapper_tests.cpp

@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator) @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
uint256 in2 = GetRandHash();
BOOST_CHECK(dbw.Write(key2, in2));
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&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) @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
BOOST_CHECK(dbw.Write(key, value));
}
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&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) @@ -290,7 +290,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
}
}
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&dbw)->NewIterator());
for (int c=0; c<2; ++c) {
int seek_start;
if (c == 0)

2
src/txdb.cpp

@ -173,7 +173,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { @@ -173,7 +173,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256&)> insertBlockIndex)
{
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
std::unique_ptr<CDBIterator> pcursor(NewIterator());
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));

2
src/txdb.h

@ -92,7 +92,7 @@ public: @@ -92,7 +92,7 @@ public:
private:
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn):
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
boost::scoped_ptr<CDBIterator> pcursor;
std::unique_ptr<CDBIterator> pcursor;
std::pair<char, uint256> keyTmp;
friend class CCoinsViewDB;

3
src/wallet/walletdb.cpp

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/thread.hpp>
using namespace std;
@ -941,7 +940,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKe @@ -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<Db> pdbCopy(new Db(dbenv.dbenv, 0));
std::unique_ptr<Db> pdbCopy(new Db(dbenv.dbenv, 0));
int ret = pdbCopy->open(NULL, // Txn pointer
filename.c_str(), // Filename
"main", // Logical db name

Loading…
Cancel
Save