Skip to content

Commit

Permalink
Merge pull request #3127 from jgarzik/smells-like-json-spirit
Browse files Browse the repository at this point in the history
Revert recent json-spirit changes
  • Loading branch information
Jeff Garzik committed Oct 22, 2013
2 parents b3dd90c + 406b1f0 commit fcb9f26
Show file tree
Hide file tree
Showing 18 changed files with 398 additions and 697 deletions.
12 changes: 5 additions & 7 deletions src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ using namespace boost;
using namespace boost::asio;
using namespace json_spirit;

static const char* Value_type_name[]={"obj", "array", "str", "bool", "int", "real", "null"};

static std::string strRPCUserColonPass;

// These are created by StartRPCThreads, destroyed in StopRPCThreads
Expand Down Expand Up @@ -533,7 +531,7 @@ string JSONRPCRequest(const string& strMethod, const Array& params, const Value&
request.push_back(Pair("method", strMethod));
request.push_back(Pair("params", params));
request.push_back(Pair("id", id));
return write_string(Value(request), raw_utf8) + "\n";
return write_string(Value(request), false) + "\n";
}

Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id)
Expand All @@ -551,7 +549,7 @@ Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id)
string JSONRPCReply(const Value& result, const Value& error, const Value& id)
{
Object reply = JSONRPCReplyObj(result, error, id);
return write_string(Value(reply), raw_utf8) + "\n";
return write_string(Value(reply), false) + "\n";
}

void ErrorReply(std::ostream& stream, const Object& objError, const Value& id)
Expand Down Expand Up @@ -982,7 +980,7 @@ static string JSONRPCExecBatch(const Array& vReq)
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));

return write_string(Value(ret), raw_utf8) + "\n";
return write_string(Value(ret), false) + "\n";
}

void ServiceConnection(AcceptedConnection *conn)
Expand Down Expand Up @@ -1284,7 +1282,7 @@ int CommandLineRPC(int argc, char *argv[])
if (error.type() != null_type)
{
// Error
strPrint = "error: " + write_string(error, raw_utf8);
strPrint = "error: " + write_string(error, false);
int code = find_value(error.get_obj(), "code").get_int();
nRet = abs(code);
}
Expand All @@ -1296,7 +1294,7 @@ int CommandLineRPC(int argc, char *argv[])
else if (result.type() == str_type)
strPrint = result.get_str();
else
strPrint = write_string(result, pretty_print | raw_utf8);
strPrint = write_string(result, true);
}
}
catch (boost::thread_interrupted) {
Expand Down
2 changes: 1 addition & 1 deletion src/json/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2007 - 2010 John W. Wilkinson
Copyright (c) 2007 - 2009 John W. Wilkinson

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
4 changes: 2 additions & 2 deletions src/json/json_spirit.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef JSON_SPIRIT
#define JSON_SPIRIT

// Copyright John W. Wilkinson 2007 - 2013
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt

// json spirit version 4.06
// json spirit version 4.03

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
Expand Down
6 changes: 3 additions & 3 deletions src/json/json_spirit_error_position.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef JSON_SPIRIT_ERROR_POSITION
#define JSON_SPIRIT_ERROR_POSITION

// Copyright John W. Wilkinson 2007 - 2013
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt

// json spirit version 4.06
// json spirit version 4.03

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
Expand Down Expand Up @@ -48,7 +48,7 @@ namespace json_spirit
return ( reason_ == lhs.reason_ ) &&
( line_ == lhs.line_ ) &&
( column_ == lhs.column_ );
}
}
}

#endif
248 changes: 124 additions & 124 deletions src/json/json_spirit_reader.cpp
Original file line number Diff line number Diff line change
@@ -1,137 +1,137 @@
// Copyright John W. Wilkinson 2007 - 2013
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt

// json spirit version 4.06
// json spirit version 4.03

#include "json_spirit_reader.h"
#include "json_spirit_reader_template.h"

using namespace json_spirit;

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

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

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

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

bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}
#endif
bool json_spirit::read( const std::string& s, Value& value )
{
return read_string( s, value );
}

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

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

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

bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}

#ifndef BOOST_NO_STD_WSTRING

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

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

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

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

bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}

#if defined( JSON_SPIRIT_WVALUE_ENABLED ) && !defined( BOOST_NO_STD_WSTRING )
bool json_spirit::read( const std::wstring& s, wValue& value )
{
return read_string( s, value );
}

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

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

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

bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}
#endif

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

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

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

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

bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}
#endif
bool json_spirit::read( const std::string& s, mValue& value )
{
return read_string( s, value );
}

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

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

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

bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}

#ifndef BOOST_NO_STD_WSTRING

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

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

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

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

bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}

#if defined( JSON_SPIRIT_WMVALUE_ENABLED ) && !defined( BOOST_NO_STD_WSTRING )
bool json_spirit::read( const std::wstring& s, wmValue& value )
{
return read_string( s, value );
}

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

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

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

bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, 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 )
{
begin = read_range_or_throw( begin, end, value );
}
#endif
Loading

0 comments on commit fcb9f26

Please sign in to comment.