From 15982a8b69ec6ab3c3a6bf71fc6a9b681d3ff541 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 20 Aug 2014 15:15:16 -0400 Subject: Convert tree to using univalue. Eliminate all json_spirit uses. --- src/rpcprotocol.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/rpcprotocol.cpp') diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 95d6b9e53..72a7b7634 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -23,7 +23,7 @@ #include #include #include -#include "json/json_spirit_writer_template.h" +#include "json_spirit_wrapper.h" using namespace std; using namespace json_spirit; @@ -260,14 +260,14 @@ 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), false) + "\n"; + return request.write() + "\n"; } Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id) { Object reply; - if (error.type() != null_type) - reply.push_back(Pair("result", Value::null)); + if (!error.isNull()) + reply.push_back(Pair("result", NullUniValue)); else reply.push_back(Pair("result", result)); reply.push_back(Pair("error", error)); @@ -278,7 +278,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), false) + "\n"; + return reply.write() + "\n"; } Object JSONRPCError(int code, const string& message) -- cgit v1.2.3 From 53b4671a9de75f7c8e2903d510cf88867c3f6b97 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sun, 10 May 2015 13:35:44 +0200 Subject: extend conversion to UniValue --- src/rpcprotocol.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/rpcprotocol.cpp') diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 72a7b7634..9b422894e 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -256,7 +256,7 @@ int ReadHTTPMessage(std::basic_istream& stream, map Date: Wed, 13 May 2015 21:29:19 +0200 Subject: remove JSON Spirit UniValue wrapper --- src/rpcprotocol.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rpcprotocol.cpp') diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 9b422894e..953e47602 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -256,7 +256,7 @@ int ReadHTTPMessage(std::basic_istream& stream, map Date: Mon, 18 May 2015 14:02:18 +0200 Subject: Remove JSON Spirit wrapper, remove JSON Spirit leftovers - implement find_value() function for UniValue - replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper - remove JSON Spirit sources --- src/rpcprotocol.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/rpcprotocol.cpp') diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 953e47602..090e5ea7f 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -23,10 +23,10 @@ #include #include #include -#include "json_spirit_wrapper.h" + +#include "univalue/univalue.h" using namespace std; -using namespace json_spirit; //! Number of bytes to allocate and read at most at once in post data const size_t POST_READ_SIZE = 256 * 1024; @@ -254,7 +254,7 @@ int ReadHTTPMessage(std::basic_istream& stream, map