Convert tree to using univalue. Eliminate all json_spirit uses.
This commit is contained in:
committed by
Jonas Schnelli
parent
5e3060c0d1
commit
15982a8b69
@@ -16,10 +16,10 @@
|
||||
#include "rpcclient.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "json/json_spirit_value.h"
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
#include "univalue/univalue.h"
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
#include <db_cxx.h>
|
||||
#endif
|
||||
@@ -167,21 +167,25 @@ void RPCExecutor::request(const QString &command)
|
||||
std::string strPrint;
|
||||
// Convert argument list to JSON objects in method-dependent way,
|
||||
// and pass it along with the method name to the dispatcher.
|
||||
json_spirit::Value result = tableRPC.execute(
|
||||
UniValue result = tableRPC.execute(
|
||||
args[0],
|
||||
RPCConvertValues(args[0], std::vector<std::string>(args.begin() + 1, args.end())));
|
||||
|
||||
// Format result reply
|
||||
if (result.type() == json_spirit::null_type)
|
||||
if (result.isNull())
|
||||
strPrint = "";
|
||||
else if (result.type() == json_spirit::str_type)
|
||||
else if (result.isStr())
|
||||
strPrint = result.get_str();
|
||||
else
|
||||
strPrint = write_string(result, true);
|
||||
strPrint = result.write(2);
|
||||
|
||||
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
catch (const json_spirit::Object& objError)
|
||||
=======
|
||||
catch (UniValue& objError)
|
||||
>>>>>>> Convert tree to using univalue. Eliminate all json_spirit uses.
|
||||
{
|
||||
try // Nice formatting for standard-format error
|
||||
{
|
||||
@@ -191,7 +195,7 @@ void RPCExecutor::request(const QString &command)
|
||||
}
|
||||
catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message
|
||||
{ // Show raw JSON object
|
||||
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
|
||||
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(objError.write()));
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
||||
Reference in New Issue
Block a user