Skip to content

Commit

Permalink
Merge pull request #70 from sjneph/namespace-updates-round1b
Browse files Browse the repository at this point in the history
cleaned up namespaces
  • Loading branch information
cygnusxi authored Feb 4, 2022
2 parents d721c6f + 5a073db commit 1ba9960
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 37 deletions.
48 changes: 24 additions & 24 deletions src/json/json_spirit_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,128 +8,128 @@

using namespace json_spirit;

bool json_spirit::read( const std::string& s, Value& value )
bool json_spirit::read( const std::string& s, json_spirit::Value& value )
{
return read_string( s, value );
}

void json_spirit::read_or_throw( const std::string& s, Value& value )
void json_spirit::read_or_throw( const std::string& s, json_spirit::Value& value )
{
read_string_or_throw( s, value );
}

bool json_spirit::read( std::istream& is, Value& value )
bool json_spirit::read( std::istream& is, json_spirit::Value& value )
{
return read_stream( is, value );
}

void json_spirit::read_or_throw( std::istream& is, Value& value )
void json_spirit::read_or_throw( std::istream& is, json_spirit::Value& value )
{
read_stream_or_throw( is, value );
}

bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value )
bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, json_spirit::Value& value )
{
return read_range( begin, end, value );
}

void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value )
void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, json_spirit::Value& value )
{
begin = read_range_or_throw( begin, end, value );
}

#ifndef BOOST_NO_STD_WSTRING

bool json_spirit::read( const std::wstring& s, wValue& value )
bool json_spirit::read( const std::wstring& s, json_spirit::wValue& value )
{
return read_string( s, value );
}

void json_spirit::read_or_throw( const std::wstring& s, wValue& value )
void json_spirit::read_or_throw( const std::wstring& s, json_spirit::wValue& value )
{
read_string_or_throw( s, value );
}

bool json_spirit::read( std::wistream& is, wValue& value )
bool json_spirit::read( std::wistream& is, json_spirit::wValue& value )
{
return read_stream( is, value );
}

void json_spirit::read_or_throw( std::wistream& is, wValue& value )
void json_spirit::read_or_throw( std::wistream& is, json_spirit::wValue& value )
{
read_stream_or_throw( is, value );
}

bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value )
bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, json_spirit::wValue& value )
{
return read_range( begin, end, value );
}

void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value )
void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, json_spirit::wValue& value )
{
begin = read_range_or_throw( begin, end, value );
}

#endif

bool json_spirit::read( const std::string& s, mValue& value )
bool json_spirit::read( const std::string& s, json_spirit::mValue& value )
{
return read_string( s, value );
}

void json_spirit::read_or_throw( const std::string& s, mValue& value )
void json_spirit::read_or_throw( const std::string& s, json_spirit::mValue& value )
{
read_string_or_throw( s, value );
}

bool json_spirit::read( std::istream& is, mValue& value )
bool json_spirit::read( std::istream& is, json_spirit::mValue& value )
{
return read_stream( is, value );
}

void json_spirit::read_or_throw( std::istream& is, mValue& value )
void json_spirit::read_or_throw( std::istream& is, json_spirit::mValue& value )
{
read_stream_or_throw( is, value );
}

bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value )
bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, json_spirit::mValue& value )
{
return read_range( begin, end, value );
}

void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value )
void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, json_spirit::mValue& value )
{
begin = read_range_or_throw( begin, end, value );
}

#ifndef BOOST_NO_STD_WSTRING

bool json_spirit::read( const std::wstring& s, wmValue& value )
bool json_spirit::read( const std::wstring& s, json_spirit::wmValue& value )
{
return read_string( s, value );
}

void json_spirit::read_or_throw( const std::wstring& s, wmValue& value )
void json_spirit::read_or_throw( const std::wstring& s, json_spirit::wmValue& value )
{
read_string_or_throw( s, value );
}

bool json_spirit::read( std::wistream& is, wmValue& value )
bool json_spirit::read( std::wistream& is, json_spirit::wmValue& value )
{
return read_stream( is, value );
}

void json_spirit::read_or_throw( std::wistream& is, wmValue& value )
void json_spirit::read_or_throw( std::wistream& is, json_spirit::wmValue& value )
{
read_stream_or_throw( is, value );
}

bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value )
bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, json_spirit::wmValue& value )
{
return read_range( begin, end, value );
}

void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value )
void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, json_spirit::wmValue& value )
{
begin = read_range_or_throw( begin, end, value );
}
Expand Down
22 changes: 9 additions & 13 deletions src/qt/qtipcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
#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

using namespace boost;
using namespace boost::interprocess;
using namespace boost::posix_time;

#if defined MAC_OSX || defined __FreeBSD__
// URI handling not implemented on OSX yet

Expand Down Expand Up @@ -93,14 +89,14 @@ static void ipcThread2(void* pArg)
{
printf("ipcThread started\n");

message_queue* mq = (message_queue*)pArg;
boost::interprocess::message_queue* mq = (boost::interprocess::message_queue*)pArg;
char buffer[MAX_URI_LENGTH + 1] = "";
size_t nSize = 0;
unsigned int nPriority = 0;

while (true)
{
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
boost::posix_time::ptime 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));
Expand All @@ -112,25 +108,25 @@ static void ipcThread2(void* pArg)
}

// Remove message queue
message_queue::remove(curecoinURI_QUEUE_NAME);
boost::interprocess::message_queue::remove(curecoinURI_QUEUE_NAME);
// Cleanup allocated memory
delete mq;
}

void ipcInit(int argc, char *argv[])
{
message_queue* mq = NULL;
boost::interprocess::message_queue* mq = NULL;
char buffer[MAX_URI_LENGTH + 1] = "";
size_t nSize = 0;
unsigned int nPriority = 0;

try {
mq = new message_queue(open_or_create, curecoinURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
mq = new boost::interprocess::message_queue(boost::interprocess::open_or_create, curecoinURI_QUEUE_NAME, 2, MAX_URI_LENGTH);

// Make sure we don't lose any curecoin: URIs
for (int i = 0; i < 2; i++)
{
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1);
boost::posix_time::ptime 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));
Expand All @@ -140,12 +136,12 @@ void ipcInit(int argc, char *argv[])
}

// Make sure only one curecoin instance is listening
message_queue::remove(curecoinURI_QUEUE_NAME);
boost::interprocess::message_queue::remove(curecoinURI_QUEUE_NAME);
delete mq;

mq = new message_queue(open_or_create, curecoinURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
mq = new boost::interprocess::message_queue(boost::interprocess::open_or_create, curecoinURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
}
catch (interprocess_exception &ex) {
catch (boost::interprocess::interprocess_exception &ex) {
printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
return;
}
Expand Down

0 comments on commit 1ba9960

Please sign in to comment.