Browse Source

Merge pull request #462 from KN4CK3R/fix-461

Fix compiling on Ubuntu 22 (#461)
miguelfreitas
miguelfreitas 2 years ago committed by GitHub
parent
commit
a3a926e3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      libtorrent/include/libtorrent/alert.hpp
  2. 8
      libtorrent/include/libtorrent/alert_manager.hpp
  3. 4
      libtorrent/include/libtorrent/alert_types.hpp
  4. 4
      libtorrent/include/libtorrent/aux_/session_impl.hpp
  5. 4
      libtorrent/include/libtorrent/session.hpp
  6. 24
      libtorrent/src/alert_manager.cpp
  7. 4
      libtorrent/src/session.cpp
  8. 6
      libtorrent/src/session_impl.cpp
  9. 2
      libtorrent/src/torrent_info.cpp
  10. 6
      libtorrent/test/setup_transfer.cpp
  11. 2
      libtorrent/test/setup_transfer.hpp
  12. 14
      src/bitcoinrpc.cpp
  13. 6
      src/db.cpp
  14. 24
      src/init.cpp
  15. 2
      src/key.cpp
  16. 4
      src/leveldb.cpp
  17. 14
      src/leveldb.h
  18. 6
      src/main.cpp
  19. 2
      src/main.h
  20. 6
      src/twister.cpp
  21. 12
      src/walletdb.cpp

8
libtorrent/include/libtorrent/alert.hpp

@ -113,7 +113,7 @@ namespace libtorrent { @@ -113,7 +113,7 @@ namespace libtorrent {
severity_t severity() const TORRENT_DEPRECATED { return warning; }
#endif
virtual std::auto_ptr<alert> clone() const = 0;
virtual std::unique_ptr<alert> clone() const = 0;
private:
ptime m_timestamp;
@ -133,7 +133,7 @@ namespace libtorrent { @@ -133,7 +133,7 @@ namespace libtorrent {
template<class Handler
, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, class T)>
void handle_alert_dispatch(
const std::auto_ptr<alert>& alert_, const Handler& handler
const std::unique_ptr<alert>& alert_, const Handler& handler
, const std::type_info& typeid_
, T0*, BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(TORRENT_MAX_ALERT_TYPES, T, *p))
{
@ -147,7 +147,7 @@ namespace libtorrent { @@ -147,7 +147,7 @@ namespace libtorrent {
template<class Handler>
void handle_alert_dispatch(
const std::auto_ptr<alert>&
const std::unique_ptr<alert>&
, const Handler&
, const std::type_info&
, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, void_* BOOST_PP_INTERCEPT))
@ -162,7 +162,7 @@ namespace libtorrent { @@ -162,7 +162,7 @@ namespace libtorrent {
struct TORRENT_EXPORT handle_alert
{
template<class Handler>
handle_alert(const std::auto_ptr<alert>& alert_
handle_alert(const std::unique_ptr<alert>& alert_
, const Handler& handler)
{
#define ALERT_POINTER_TYPE(z, n, text) (BOOST_PP_CAT(T, n)*)0

8
libtorrent/include/libtorrent/alert_manager.hpp

@ -57,7 +57,7 @@ namespace libtorrent { @@ -57,7 +57,7 @@ namespace libtorrent {
void post_alert(const alert& alert_);
void post_alert_ptr(alert* alert_);
bool pending() const;
std::auto_ptr<alert> get();
std::unique_ptr<alert> get();
void get_all(std::deque<alert*>* alerts);
template <class T>
@ -86,21 +86,21 @@ namespace libtorrent { @@ -86,21 +86,21 @@ namespace libtorrent {
size_t alert_queue_size_limit() const { return m_queue_size_limit; }
size_t set_alert_queue_size_limit(size_t queue_size_limit_);
void set_dispatch_function(boost::function<void(std::auto_ptr<alert>)> const&);
void set_dispatch_function(std::function<void(std::unique_ptr<alert>&&)> const&);
#ifndef TORRENT_DISABLE_EXTENSIONS
void add_extension(boost::shared_ptr<plugin> ext);
#endif
private:
void post_impl(std::auto_ptr<alert>& alert_, mutex::scoped_lock& l);
void post_impl(std::unique_ptr<alert>&& alert_, mutex::scoped_lock& l);
std::deque<alert*> m_alerts;
mutable mutex m_mutex;
condition_variable m_condition;
boost::uint32_t m_alert_mask;
size_t m_queue_size_limit;
boost::function<void(std::auto_ptr<alert>)> m_dispatch;
std::function<void(std::unique_ptr<alert>&&)> m_dispatch;
#ifndef TORRENT_DISABLE_EXTENSIONS
typedef std::list<boost::shared_ptr<plugin> > ses_extension_list_t;

4
libtorrent/include/libtorrent/alert_types.hpp

@ -106,8 +106,8 @@ namespace libtorrent @@ -106,8 +106,8 @@ namespace libtorrent
#define TORRENT_DEFINE_ALERT(name) \
const static int alert_type = __LINE__; \
virtual int type() const { return alert_type; } \
virtual std::auto_ptr<alert> clone() const \
{ return std::auto_ptr<alert>(new name(*this)); } \
virtual std::unique_ptr<alert> clone() const \
{ return std::unique_ptr<alert>(new name(*this)); } \
virtual int category() const { return static_category; } \
virtual char const* what() const { return #name; }

4
libtorrent/include/libtorrent/aux_/session_impl.hpp

@ -380,9 +380,9 @@ namespace libtorrent @@ -380,9 +380,9 @@ namespace libtorrent
void set_alert_mask(boost::uint32_t m);
size_t set_alert_queue_size_limit(size_t queue_size_limit_);
std::auto_ptr<alert> pop_alert();
std::unique_ptr<alert> pop_alert();
void pop_alerts(std::deque<alert*>* alerts);
void set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const&);
void set_alert_dispatch(boost::function<void(std::unique_ptr<alert>)> const&);
void post_alert(const alert& alert_);
alert const* wait_for_alert(time_duration max_wait);

4
libtorrent/include/libtorrent/session.hpp

@ -796,7 +796,7 @@ namespace libtorrent @@ -796,7 +796,7 @@ namespace libtorrent
//
// ``save_resume_data_alert`` and ``save_resume_data_failed_alert`` are always posted, regardelss
// of the alert mask.
std::auto_ptr<alert> pop_alert();
std::unique_ptr<alert> pop_alert();
void pop_alerts(std::deque<alert*>* alerts);
alert const* wait_for_alert(time_duration max_wait);
@ -821,7 +821,7 @@ namespace libtorrent @@ -821,7 +821,7 @@ namespace libtorrent
// The main intention with this function is to support integration with platform-dependent message
// queues or signalling systems. For instance, on windows, one could post a message to an HNWD or
// on linux, write to a pipe or an eventfd.
void set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun);
void set_alert_dispatch(boost::function<void(std::unique_ptr<alert>)> const& fun);
connection_queue& get_connection_queue();

24
libtorrent/src/alert_manager.cpp

@ -72,7 +72,7 @@ namespace libtorrent @@ -72,7 +72,7 @@ namespace libtorrent
return NULL;
}
void alert_manager::set_dispatch_function(boost::function<void(std::auto_ptr<alert>)> const& fun)
void alert_manager::set_dispatch_function(std::function<void(std::unique_ptr<alert>&&)> const& fun)
{
mutex::scoped_lock lock(m_mutex);
@ -85,7 +85,7 @@ namespace libtorrent @@ -85,7 +85,7 @@ namespace libtorrent
while (!alerts.empty())
{
TORRENT_TRY {
m_dispatch(std::auto_ptr<alert>(alerts.front()));
m_dispatch(std::unique_ptr<alert>(alerts.front()));
} TORRENT_CATCH(std::exception&) {}
alerts.pop_front();
}
@ -94,13 +94,13 @@ namespace libtorrent @@ -94,13 +94,13 @@ namespace libtorrent
void dispatch_alert(boost::function<void(alert const&)> dispatcher
, alert* alert_)
{
std::auto_ptr<alert> holder(alert_);
std::unique_ptr<alert> holder(alert_);
dispatcher(*alert_);
}
void alert_manager::post_alert_ptr(alert* alert_)
{
std::auto_ptr<alert> a(alert_);
std::unique_ptr<alert> a(alert_);
#ifndef TORRENT_DISABLE_EXTENSIONS
for (ses_extension_list_t::iterator i = m_ses_extensions.begin()
@ -113,12 +113,12 @@ namespace libtorrent @@ -113,12 +113,12 @@ namespace libtorrent
#endif
mutex::scoped_lock lock(m_mutex);
post_impl(a, lock);
post_impl(std::move(a), lock);
}
void alert_manager::post_alert(const alert& alert_)
{
std::auto_ptr<alert> a(alert_.clone());
std::unique_ptr<alert> a(alert_.clone());
#ifndef TORRENT_DISABLE_EXTENSIONS
for (ses_extension_list_t::iterator i = m_ses_extensions.begin()
@ -131,16 +131,16 @@ namespace libtorrent @@ -131,16 +131,16 @@ namespace libtorrent
#endif
mutex::scoped_lock lock(m_mutex);
post_impl(a, lock);
post_impl(std::move(a), lock);
}
void alert_manager::post_impl(std::auto_ptr<alert>& alert_, mutex::scoped_lock& l)
void alert_manager::post_impl(std::unique_ptr<alert>&& alert_, mutex::scoped_lock& l)
{
if (m_dispatch)
{
TORRENT_ASSERT(m_alerts.empty());
TORRENT_TRY {
m_dispatch(alert_);
m_dispatch(std::move(alert_));
} TORRENT_CATCH(std::exception&) {}
}
else if (m_alerts.size() < m_queue_size_limit || !alert_->discardable())
@ -158,16 +158,16 @@ namespace libtorrent @@ -158,16 +158,16 @@ namespace libtorrent
}
#endif
std::auto_ptr<alert> alert_manager::get()
std::unique_ptr<alert> alert_manager::get()
{
mutex::scoped_lock lock(m_mutex);
if (m_alerts.empty())
return std::auto_ptr<alert>(0);
return std::unique_ptr<alert>(nullptr);
alert* result = m_alerts.front();
m_alerts.pop_front();
return std::auto_ptr<alert>(result);
return std::unique_ptr<alert>(result);
}
void alert_manager::get_all(std::deque<alert*>* alerts)

4
libtorrent/src/session.cpp

@ -1096,12 +1096,12 @@ namespace libtorrent @@ -1096,12 +1096,12 @@ namespace libtorrent
}
#endif // TORRENT_NO_DEPRECATE
void session::set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun)
void session::set_alert_dispatch(boost::function<void(std::unique_ptr<alert>)> const& fun)
{
TORRENT_ASYNC_CALL1(set_alert_dispatch, fun);
}
std::auto_ptr<alert> session::pop_alert()
std::unique_ptr<alert> session::pop_alert()
{
return m_impl->pop_alert();
}

6
libtorrent/src/session_impl.cpp

@ -5037,7 +5037,7 @@ retry: @@ -5037,7 +5037,7 @@ retry:
TORRENT_ASSERT(is_network_thread());
std::auto_ptr<state_update_alert> alert(new state_update_alert());
std::unique_ptr<state_update_alert> alert(new state_update_alert());
alert->status.reserve(m_state_updates.size());
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
@ -6157,12 +6157,12 @@ retry: @@ -6157,12 +6157,12 @@ retry:
}
}
void session_impl::set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun)
void session_impl::set_alert_dispatch(boost::function<void(std::unique_ptr<alert>)> const& fun)
{
m_alerts.set_dispatch_function(fun);
}
std::auto_ptr<alert> session_impl::pop_alert()
std::unique_ptr<alert> session_impl::pop_alert()
{
return m_alerts.get();
}

2
libtorrent/src/torrent_info.cpp

@ -357,7 +357,7 @@ namespace libtorrent @@ -357,7 +357,7 @@ namespace libtorrent
struct string_less_no_case
{
bool operator()(std::string const& lhs, std::string const& rhs)
bool operator()(std::string const& lhs, std::string const& rhs) const
{
char c1, c2;
char const* s1 = lhs.c_str();

6
libtorrent/test/setup_transfer.cpp

@ -73,9 +73,9 @@ void report_failure(char const* err, char const* file, int line) @@ -73,9 +73,9 @@ void report_failure(char const* err, char const* file, int line)
tests_failure = true;
}
std::auto_ptr<alert> wait_for_alert(session& ses, int type)
std::unique_ptr<alert> wait_for_alert(session& ses, int type)
{
std::auto_ptr<alert> ret;
std::unique_ptr<alert> ret;
while (!ret.get())
{
ses.wait_for_alert(milliseconds(5000));
@ -86,7 +86,7 @@ std::auto_ptr<alert> wait_for_alert(session& ses, int type) @@ -86,7 +86,7 @@ std::auto_ptr<alert> wait_for_alert(session& ses, int type)
{
if (!ret.get() && (*i)->type() == type)
{
ret = std::auto_ptr<alert>(*i);
ret = std::unique_ptr<alert>(*i);
}
else
delete *i;

2
libtorrent/test/setup_transfer.hpp

@ -50,7 +50,7 @@ int EXPORT load_file(std::string const& filename, std::vector<char>& v, libtorre @@ -50,7 +50,7 @@ int EXPORT load_file(std::string const& filename, std::vector<char>& v, libtorre
void EXPORT report_failure(char const* err, char const* file, int line);
std::auto_ptr<libtorrent::alert> EXPORT wait_for_alert(libtorrent::session& ses, int type);
std::unique_ptr<libtorrent::alert> EXPORT wait_for_alert(libtorrent::session& ses, int type);
void EXPORT print_ses_rate(float time
, libtorrent::torrent_status const* st1

14
src/bitcoinrpc.cpp

@ -954,14 +954,14 @@ void StartRPCThreads() @@ -954,14 +954,14 @@ void StartRPCThreads()
{
rpc_ssl_context->set_options(ssl::context::no_sslv2);
filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert"));
if (!pathCertFile.is_complete()) pathCertFile = filesystem::path(GetDataDir()) / pathCertFile;
if (filesystem::exists(pathCertFile)) rpc_ssl_context->use_certificate_chain_file(pathCertFile.string());
boost::filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert"));
if (!pathCertFile.is_complete()) pathCertFile = boost::filesystem::path(GetDataDir()) / pathCertFile;
if (boost::filesystem::exists(pathCertFile)) rpc_ssl_context->use_certificate_chain_file(pathCertFile.string());
else printf("ThreadRPCServer ERROR: missing server certificate file %s\n", pathCertFile.string().c_str());
filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem"));
if (!pathPKFile.is_complete()) pathPKFile = filesystem::path(GetDataDir()) / pathPKFile;
if (filesystem::exists(pathPKFile)) rpc_ssl_context->use_private_key_file(pathPKFile.string(), ssl::context::pem);
boost::filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem"));
if (!pathPKFile.is_complete()) pathPKFile = boost::filesystem::path(GetDataDir()) / pathPKFile;
if (boost::filesystem::exists(pathPKFile)) rpc_ssl_context->use_private_key_file(pathPKFile.string(), ssl::context::pem);
else printf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string().c_str());
string strCiphers = GetArg("-rpcsslciphers", "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH");
@ -1182,7 +1182,7 @@ void ServiceConnection(AcceptedConnection *conn) @@ -1182,7 +1182,7 @@ void ServiceConnection(AcceptedConnection *conn)
strURI="/home.html";
if (strURI != "/" && strURI.substr(0, 4) != "/rss" && strURI.find("..") == std::string::npos ) {
filesystem::path pathFile = filesystem::path(GetHTMLDir()) / strURI;
boost::filesystem::path pathFile = boost::filesystem::path(GetHTMLDir()) / strURI;
std::string fname = pathFile.string();
size_t qMarkIdx = fname.find('?');
if( qMarkIdx != string::npos ) {

6
src/db.cpp

@ -68,9 +68,9 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn) @@ -68,9 +68,9 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
boost::this_thread::interruption_point();
path = pathIn;
filesystem::path pathLogDir = path / "database";
filesystem::create_directory(pathLogDir);
filesystem::path pathErrorFile = path / "db.log";
boost::filesystem::path pathLogDir = path / "database";
boost::filesystem::create_directory(pathLogDir);
boost::filesystem::path pathErrorFile = path / "db.log";
printf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str());
unsigned int nEnvFlags = 0;

24
src/init.cpp

@ -313,12 +313,12 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles) @@ -313,12 +313,12 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
}
// hardcoded $DATADIR/bootstrap.dat
filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
if (filesystem::exists(pathBootstrap)) {
boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
if (boost::filesystem::exists(pathBootstrap)) {
FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
if (file) {
CImportingNow imp;
filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
printf("Importing bootstrap.dat...\n");
LoadExternalBlockFile(file);
RenameOver(pathBootstrap, pathBootstrapOld);
@ -571,7 +571,7 @@ bool AppInit2(boost::thread_group& threadGroup) @@ -571,7 +571,7 @@ bool AppInit2(boost::thread_group& threadGroup)
return false;
}
if (filesystem::exists(GetDataDir() / "twisterwallet.dat"))
if (boost::filesystem::exists(GetDataDir() / "twisterwallet.dat"))
{
CDBEnv::VerifyResult r = bitdb.Verify("twisterwallet.dat", CWalletDB::Recover);
if (r == CDBEnv::RECOVER_OK)
@ -700,20 +700,20 @@ bool AppInit2(boost::thread_group& threadGroup) @@ -700,20 +700,20 @@ bool AppInit2(boost::thread_group& threadGroup)
fReindex = GetBoolArg("-reindex", false);
// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
filesystem::path blocksDir = GetDataDir() / "blocks";
if (!filesystem::exists(blocksDir))
boost::filesystem::path blocksDir = GetDataDir() / "blocks";
if (!boost::filesystem::exists(blocksDir))
{
filesystem::create_directories(blocksDir);
boost::filesystem::create_directories(blocksDir);
bool linked = false;
for (unsigned int i = 1; i < 10000; i++) {
filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
if (!filesystem::exists(source)) break;
filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
boost::filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
if (!boost::filesystem::exists(source)) break;
boost::filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
try {
filesystem::create_hard_link(source, dest);
boost::filesystem::create_hard_link(source, dest);
printf("Hardlinked %s -> %s\n", source.string().c_str(), dest.string().c_str());
linked = true;
} catch (filesystem::filesystem_error & e) {
} catch (boost::filesystem::filesystem_error & e) {
// Note: hardlink creation failing is not a disaster, it just means
// blocks will get re-downloaded from peers.
printf("Error hardlinking blk%04u.dat : %s\n", i, e.what());

2
src/key.cpp

@ -111,7 +111,7 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch @@ -111,7 +111,7 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch
if (!BN_bin2bn(msg, msglen, e)) { ret=-1; goto err; }
if (8*msglen > n) BN_rshift(e, e, 8-(n & 7));
zero = BN_CTX_get(ctx);
if (!BN_zero(zero)) { ret=-1; goto err; }
BN_zero(zero);
if (!BN_mod_sub(e, zero, e, order, ctx)) { ret=-1; goto err; }
rr = BN_CTX_get(ctx);
#if (OPENSSL_VERSION_NUMBER < 0x10100000)

4
src/leveldb.cpp

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
#include <boost/filesystem.hpp>
void HandleError(const leveldb::Status &status) throw(leveldb_error) {
void HandleError(const leveldb::Status &status) {
if (status.ok())
return;
if (status.IsCorruption())
@ -72,7 +72,7 @@ CLevelDB::~CLevelDB() { @@ -72,7 +72,7 @@ CLevelDB::~CLevelDB() {
options.env = NULL;
}
bool CLevelDB::WriteBatch(CLevelDBBatch &batch, bool fSync) throw(leveldb_error) {
bool CLevelDB::WriteBatch(CLevelDBBatch &batch, bool fSync) {
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
if (!status.ok()) {
printf("LevelDB write failure: %s\n", status.ToString().c_str());

14
src/leveldb.h

@ -17,7 +17,7 @@ public: @@ -17,7 +17,7 @@ public:
leveldb_error(const std::string &msg) : std::runtime_error(msg) {}
};
void HandleError(const leveldb::Status &status) throw(leveldb_error);
void HandleError(const leveldb::Status &status);
// Batch of changes queued to be written to a CLevelDB
class CLevelDBBatch
@ -83,7 +83,7 @@ public: @@ -83,7 +83,7 @@ public:
CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory = false, bool fWipe = false);
~CLevelDB();
template<typename K, typename V> bool Read(const K& key, V& value) throw(leveldb_error) {
template<typename K, typename V> bool Read(const K& key, V& value) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
ssKey << key;
@ -106,13 +106,13 @@ public: @@ -106,13 +106,13 @@ public:
return true;
}
template<typename K, typename V> bool Write(const K& key, const V& value, bool fSync = false) throw(leveldb_error) {
template<typename K, typename V> bool Write(const K& key, const V& value, bool fSync = false) {
CLevelDBBatch batch;
batch.Write(key, value);
return WriteBatch(batch, fSync);
}
template<typename K> bool Exists(const K& key) throw(leveldb_error) {
template<typename K> bool Exists(const K& key) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
ssKey << key;
@ -129,20 +129,20 @@ public: @@ -129,20 +129,20 @@ public:
return true;
}
template<typename K> bool Erase(const K& key, bool fSync = false) throw(leveldb_error) {
template<typename K> bool Erase(const K& key, bool fSync = false) {
CLevelDBBatch batch;
batch.Erase(key);
return WriteBatch(batch, fSync);
}
bool WriteBatch(CLevelDBBatch &batch, bool fSync = false) throw(leveldb_error);
bool WriteBatch(CLevelDBBatch &batch, bool fSync = false);
// not available for LevelDB; provide for compatibility with BDB
bool Flush() {
return true;
}
bool Sync() throw(leveldb_error) {
bool Sync() {
CLevelDBBatch batch;
return WriteBatch(batch, true);
}

6
src/main.cpp

@ -2093,7 +2093,7 @@ bool AbortNode(const std::string &strMessage) { @@ -2093,7 +2093,7 @@ bool AbortNode(const std::string &strMessage) {
bool CheckDiskSpace(uint64 nAdditionalBytes)
{
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
uint64 nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available;
// Check for nMinDiskSpace bytes (currently 50MB)
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
@ -3819,7 +3819,7 @@ static bool CreateSpamMsgTx(CTransaction &txNew, std::vector<unsigned char> &sal @@ -3819,7 +3819,7 @@ static bool CreateSpamMsgTx(CTransaction &txNew, std::vector<unsigned char> &sal
CBlockTemplate* CreateNewBlock(std::vector<unsigned char> &salt)
{
// Create new block
auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
if(!pblocktemplate.get())
return NULL;
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
@ -4132,7 +4132,7 @@ void static BitcoinMiner(CWallet *pwallet) @@ -4132,7 +4132,7 @@ void static BitcoinMiner(CWallet *pwallet)
unsigned int nTransactionsUpdatedLast = nTransactionsUpdated;
CBlockIndex* pindexPrev = pindexBest;
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(salt));
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(salt));
if (!pblocktemplate.get())
return;
CBlock *pblock = &pblocktemplate->block;

2
src/main.h

@ -815,7 +815,7 @@ public: @@ -815,7 +815,7 @@ public:
struct CBlockIndexWorkComparator
{
bool operator()(CBlockIndex *pa, CBlockIndex *pb) {
bool operator()(CBlockIndex *pa, CBlockIndex *pb) const {
if (pa->nChainWork > pb->nChainWork) return false;
if (pa->nChainWork < pb->nChainWork) return true;

6
src/twister.cpp

@ -784,7 +784,7 @@ void ThreadSessionAlerts() @@ -784,7 +784,7 @@ void ThreadSessionAlerts()
, end(alerts.end()); i != end; ++i)
{
// make sure to delete each alert
std::auto_ptr<alert> a(*i);
std::unique_ptr<alert> a(*i);
dht_reply_data_alert const* rd = alert_cast<dht_reply_data_alert>(*i);
if (rd)
@ -2192,7 +2192,7 @@ Value dhtget(const Array& params, bool fHelp) @@ -2192,7 +2192,7 @@ Value dhtget(const Array& params, bool fHelp)
int repliesReceived = 0;
while( am.wait_for_alert(timeToWait) ) {
std::auto_ptr<alert> a(am.get());
std::unique_ptr<alert> a(am.get());
dht_reply_data_alert const* rd = alert_cast<dht_reply_data_alert>(&(*a));
if( rd ) {
@ -4273,7 +4273,7 @@ Value peekpost(const Array& params, bool fHelp) @@ -4273,7 +4273,7 @@ Value peekpost(const Array& params, bool fHelp)
// this loop receives alerts from both dht network and torrent peek extension
while( h.is_valid() && am.wait_for_alert(timeToWait) ) {
std::auto_ptr<alert> a(am.get());
std::unique_ptr<alert> a(am.get());
dht_reply_data_alert const* rd = alert_cast<dht_reply_data_alert>(&(*a));
if( rd && rd->m_lst.size() ) {

12
src/walletdb.cpp

@ -418,20 +418,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) @@ -418,20 +418,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
bitdb.mapFileUseCount.erase(wallet.strWalletFile);
// Copy twisterwallet.dat
filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
filesystem::path pathDest(strDest);
if (filesystem::is_directory(pathDest))
boost::filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
boost::filesystem::path pathDest(strDest);
if (boost::filesystem::is_directory(pathDest))
pathDest /= wallet.strWalletFile;
try {
#if BOOST_VERSION >= 104000
filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_option::overwrite_if_exists);
#else
filesystem::copy_file(pathSrc, pathDest);
boost::filesystem::copy_file(pathSrc, pathDest);
#endif
printf("copied twisterwallet.dat to %s\n", pathDest.string().c_str());
return true;
} catch(const filesystem::filesystem_error &e) {
} catch(const boost::filesystem::filesystem_error &e) {
printf("error copying twisterwallet.dat to %s - %s\n", pathDest.string().c_str(), e.what());
return false;
}

Loading…
Cancel
Save