X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fqtipcserver.cpp;h=142165033498f4742abd5b9b9cfb04cce40913cd;hb=HEAD;hp=739e4d1ec03638837f9ca0f22cade5cc364978b1;hpb=273ceadcc0475b03a2be03ffbeded0831d8232fc;p=novacoin.git diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp index 739e4d1..1421650 100644 --- a/src/qt/qtipcserver.cpp +++ b/src/qt/qtipcserver.cpp @@ -3,14 +3,14 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#if defined(WIN32) && BOOST_VERSION == 104900 +#if defined(WIN32) && BOOST_VERSION <= 104900 #define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME #endif #include "qtipcserver.h" #include "guiconstants.h" -#include "ui_interface.h" +#include "interface.h" #include "util.h" #include @@ -18,15 +18,13 @@ #include #include -#if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) || BOOST_VERSION < 104900) +#ifndef _MSC_VER +#if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME)) && BOOST_VERSION <= 104900 #warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392 #endif +#endif -using namespace boost; -using namespace boost::interprocess; -using namespace boost::posix_time; - -#if defined MAC_OSX || defined __FreeBSD__ +#if defined __APPLE__ || defined __FreeBSD__ // URI handling not implemented on OSX yet void ipcScanRelay(int argc, char *argv[]) { } @@ -52,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) @@ -93,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; - while (true) + 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)); @@ -112,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)); @@ -140,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; }