mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge #8629: C++11: s/boost::scoped_ptr/std::unique_ptr/
cdd79eb
C++11: s/boost::scoped_ptr/std::unique_ptr/ (Jorge Timón)
This commit is contained in:
parent
4d0be42c6e
commit
414272af93
@ -509,7 +509,7 @@ public:
|
|||||||
static void MutateTx(CMutableTransaction& tx, const string& command,
|
static void MutateTx(CMutableTransaction& tx, const string& command,
|
||||||
const string& commandVal)
|
const string& commandVal)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<Secp256k1Init> ecc;
|
std::unique_ptr<Secp256k1Init> ecc;
|
||||||
|
|
||||||
if (command == "nversion")
|
if (command == "nversion")
|
||||||
MutateTxVersion(tx, commandVal);
|
MutateTxVersion(tx, commandVal);
|
||||||
|
@ -184,7 +184,7 @@ std::vector<unsigned char> CDBWrapper::CreateObfuscateKey() const
|
|||||||
|
|
||||||
bool CDBWrapper::IsEmpty()
|
bool CDBWrapper::IsEmpty()
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<CDBIterator> it(NewIterator());
|
std::unique_ptr<CDBIterator> it(NewIterator());
|
||||||
it->SeekToFirst();
|
it->SeekToFirst();
|
||||||
return !(it->Valid());
|
return !(it->Valid());
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
|
static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
|
||||||
static boost::scoped_ptr<ECCVerifyHandle> globalVerifyHandle;
|
static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
|
||||||
|
|
||||||
void Interrupt(boost::thread_group& threadGroup)
|
void Interrupt(boost::thread_group& threadGroup)
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,7 @@ namespace {
|
|||||||
*
|
*
|
||||||
* Memory used: 1.3MB
|
* Memory used: 1.3MB
|
||||||
*/
|
*/
|
||||||
boost::scoped_ptr<CRollingBloomFilter> recentRejects;
|
std::unique_ptr<CRollingBloomFilter> recentRejects;
|
||||||
uint256 hashRecentRejectsChainTip;
|
uint256 hashRecentRejectsChainTip;
|
||||||
|
|
||||||
/** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */
|
/** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */
|
||||||
|
@ -769,7 +769,7 @@ static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash,
|
|||||||
//! Calculate statistics about the unspent transaction output set
|
//! Calculate statistics about the unspent transaction output set
|
||||||
static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
|
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);
|
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||||
stats.hashBlock = pcursor->GetBestBlock();
|
stats.hashBlock = pcursor->GetBestBlock();
|
||||||
|
@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
|||||||
uint256 in2 = GetRandHash();
|
uint256 in2 = GetRandHash();
|
||||||
BOOST_CHECK(dbw.Write(key2, in2));
|
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)
|
// Be sure to seek past the obfuscation key (if it exists)
|
||||||
it->Seek(key);
|
it->Seek(key);
|
||||||
@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
|
|||||||
BOOST_CHECK(dbw.Write(key, value));
|
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) {
|
for (int c=0; c<2; ++c) {
|
||||||
int seek_start;
|
int seek_start;
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
@ -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) {
|
for (int c=0; c<2; ++c) {
|
||||||
int seek_start;
|
int seek_start;
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
|
@ -237,7 +237,7 @@ bool CBlockTreeDB::UpdateAddressUnspentIndex(const std::vector<std::pair<CAddres
|
|||||||
bool CBlockTreeDB::ReadAddressUnspentIndex(uint160 addressHash, int type,
|
bool CBlockTreeDB::ReadAddressUnspentIndex(uint160 addressHash, int type,
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs) {
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs) {
|
||||||
|
|
||||||
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
|
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||||
|
|
||||||
pcursor->Seek(make_pair(DB_ADDRESSUNSPENTINDEX, CAddressIndexIteratorKey(type, addressHash)));
|
pcursor->Seek(make_pair(DB_ADDRESSUNSPENTINDEX, CAddressIndexIteratorKey(type, addressHash)));
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ bool CBlockTreeDB::ReadAddressIndex(uint160 addressHash, int type,
|
|||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,
|
std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,
|
||||||
int start, int end) {
|
int start, int end) {
|
||||||
|
|
||||||
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
|
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||||
|
|
||||||
if (start > 0 && end > 0) {
|
if (start > 0 && end > 0) {
|
||||||
pcursor->Seek(make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorHeightKey(type, addressHash, start)));
|
pcursor->Seek(make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorHeightKey(type, addressHash, start)));
|
||||||
@ -316,7 +316,7 @@ bool CBlockTreeDB::WriteTimestampIndex(const CTimestampIndexKey ×tampIndex)
|
|||||||
|
|
||||||
bool CBlockTreeDB::ReadTimestampIndex(const unsigned int &high, const unsigned int &low, std::vector<uint256> &hashes) {
|
bool CBlockTreeDB::ReadTimestampIndex(const unsigned int &high, const unsigned int &low, std::vector<uint256> &hashes) {
|
||||||
|
|
||||||
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
|
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||||
|
|
||||||
pcursor->Seek(make_pair(DB_TIMESTAMPINDEX, CTimestampIndexIteratorKey(low)));
|
pcursor->Seek(make_pair(DB_TIMESTAMPINDEX, CTimestampIndexIteratorKey(low)));
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
|
|||||||
|
|
||||||
bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256&)> insertBlockIndex)
|
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()));
|
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn):
|
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn):
|
||||||
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
|
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
|
||||||
boost::scoped_ptr<CDBIterator> pcursor;
|
std::unique_ptr<CDBIterator> pcursor;
|
||||||
std::pair<char, COutPoint> keyTmp;
|
std::pair<char, COutPoint> keyTmp;
|
||||||
|
|
||||||
friend class CCoinsViewDB;
|
friend class CCoinsViewDB;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/scoped_ptr.hpp>
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -974,7 +973,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKe
|
|||||||
}
|
}
|
||||||
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
|
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
|
int ret = pdbCopy->open(NULL, // Txn pointer
|
||||||
filename.c_str(), // Filename
|
filename.c_str(), // Filename
|
||||||
"main", // Logical db name
|
"main", // Logical db name
|
||||||
|
Loading…
Reference in New Issue
Block a user