From 9c16e0ba1b6cd0ce69716a4be20313fa6e98a18f Mon Sep 17 00:00:00 2001 From: svost Date: Mon, 31 Jan 2022 17:02:57 +0300 Subject: [PATCH] Remove namespace boost --- src/db.cpp | 1 - src/init.cpp | 2 +- src/main.cpp | 2 -- src/net.cpp | 1 - src/qt/qtipcserver.cpp | 24 ++++++++++-------------- src/txdb-leveldb.cpp | 1 - 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 5b6d66b..cc1f3e9 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -16,7 +16,6 @@ #endif using namespace std; -using namespace boost; unsigned int nWalletDBUpdated; diff --git a/src/init.cpp b/src/init.cpp index 665f07e..84749d3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -25,7 +25,7 @@ using namespace std; -using namespace boost; + CWallet* pwalletMain; CClientUIInterface uiInterface; diff --git a/src/main.cpp b/src/main.cpp index b345ef3..27937eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,8 +19,6 @@ #include using namespace std; -using namespace boost; - CCriticalSection cs_setpwalletRegistered; diff --git a/src/net.cpp b/src/net.cpp index f8f296a..00bf067 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -17,7 +17,6 @@ #endif using namespace std; -using namespace boost; static const int MAX_OUTBOUND_CONNECTIONS = 16; diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp index ed4a38f..1421650 100644 --- a/src/qt/qtipcserver.cpp +++ b/src/qt/qtipcserver.cpp @@ -24,10 +24,6 @@ #endif #endif -using namespace boost; -using namespace boost::interprocess; -using namespace boost::posix_time; - #if defined __APPLE__ || defined __FreeBSD__ // URI handling not implemented on OSX yet @@ -54,7 +50,7 @@ static bool ipcScanCmd(int argc, char *argv[], bool fRelay) else if (fRelay) break; } - catch (boost::interprocess::interprocess_exception &ex) { + catch (const boost::interprocess::interprocess_exception &ex) { // don't log the "file not found" exception, because that's normal for // the first start of the first instance if (ex.get_error_code() != boost::interprocess::not_found_error || !fRelay) @@ -95,14 +91,14 @@ static void ipcThread2(void* pArg) { printf("ipcThread started\n"); - message_queue* mq = (message_queue*)pArg; + auto mq = (boost::interprocess::message_queue*)pArg; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; for ( ; ; ) { - ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); + auto d = boost::posix_time::microsec_clock::universal_time() + boost::posix_time::millisec(100); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); @@ -114,25 +110,25 @@ static void ipcThread2(void* pArg) } // Remove message queue - message_queue::remove(BITCOINURI_QUEUE_NAME); + boost::interprocess::message_queue::remove(BITCOINURI_QUEUE_NAME); // Cleanup allocated memory delete mq; } void ipcInit(int argc, char *argv[]) { - message_queue* mq = NULL; + boost::interprocess::message_queue* mq = nullptr; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; try { - mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); + mq = new boost::interprocess::message_queue(boost::interprocess::open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); // Make sure we don't lose any bitcoin: URIs for (int i = 0; i < 2; i++) { - ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1); + auto d = boost::posix_time::microsec_clock::universal_time() + boost::posix_time::millisec(1); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); @@ -142,12 +138,12 @@ void ipcInit(int argc, char *argv[]) } // Make sure only one bitcoin instance is listening - message_queue::remove(BITCOINURI_QUEUE_NAME); + boost::interprocess::message_queue::remove(BITCOINURI_QUEUE_NAME); delete mq; - mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); + mq = new boost::interprocess::message_queue(boost::interprocess::open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); } - catch (interprocess_exception &ex) { + catch (const boost::interprocess::interprocess_exception &ex) { printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); return; } diff --git a/src/txdb-leveldb.cpp b/src/txdb-leveldb.cpp index dd924ad..a6282e8 100644 --- a/src/txdb-leveldb.cpp +++ b/src/txdb-leveldb.cpp @@ -21,7 +21,6 @@ #include "main.h" using namespace std; -using namespace boost; leveldb::DB *txdb; // global pointer for LevelDB object instance -- 1.7.1