diff options
Diffstat (limited to 'src/rpc/message.cpp')
-rw-r--r-- | src/rpc/message.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/rpc/message.cpp b/src/rpc/message.cpp index 0d8983cb1..fffb44921 100644 --- a/src/rpc/message.cpp +++ b/src/rpc/message.cpp @@ -62,7 +62,7 @@ const rapidjson::Value& get_method_field(const rapidjson::Value& src) } } -void Message::toJson(rapidjson::Writer<rapidjson::StringBuffer>& dest) const +void Message::toJson(rapidjson::Writer<epee::byte_stream>& dest) const { dest.StartObject(); INSERT_INTO_JSON_OBJECT(dest, status, status); @@ -151,9 +151,9 @@ cryptonote::rpc::error FullMessage::getError() epee::byte_slice FullMessage::getRequest(const std::string& request, const Message& message, const unsigned id) { - rapidjson::StringBuffer buffer; + epee::byte_stream buffer; { - rapidjson::Writer<rapidjson::StringBuffer> dest{buffer}; + rapidjson::Writer<epee::byte_stream> dest{buffer}; dest.StartObject(); INSERT_INTO_JSON_OBJECT(dest, jsonrpc, (boost::string_ref{"2.0", 3})); @@ -172,15 +172,15 @@ epee::byte_slice FullMessage::getRequest(const std::string& request, const Messa if (!dest.IsComplete()) throw std::logic_error{"Invalid JSON tree generated"}; } - return epee::byte_slice{{buffer.GetString(), buffer.GetSize()}}; + return epee::byte_slice{std::move(buffer)}; } epee::byte_slice FullMessage::getResponse(const Message& message, const rapidjson::Value& id) { - rapidjson::StringBuffer buffer; + epee::byte_stream buffer; { - rapidjson::Writer<rapidjson::StringBuffer> dest{buffer}; + rapidjson::Writer<epee::byte_stream> dest{buffer}; dest.StartObject(); INSERT_INTO_JSON_OBJECT(dest, jsonrpc, (boost::string_ref{"2.0", 3})); @@ -207,7 +207,7 @@ epee::byte_slice FullMessage::getResponse(const Message& message, const rapidjso if (!dest.IsComplete()) throw std::logic_error{"Invalid JSON tree generated"}; } - return epee::byte_slice{{buffer.GetString(), buffer.GetSize()}}; + return epee::byte_slice{std::move(buffer)}; } // convenience functions for bad input |