Switch to Json::CharReader

- Fixes depreicated Json::Reader warnings
This commit is contained in:
Mike Wallio
2020-10-24 11:19:27 -04:00
parent edb1a864f0
commit a6998b8a9f

View File

@@ -2,6 +2,7 @@
#include <cstring> #include <cstring>
#include <stdexcept> #include <stdexcept>
#include <iostream> #include <iostream>
#include <memory>
#include <auss.hpp> #include <auss.hpp>
#include <json/json.h> #include <json/json.h>
@@ -22,9 +23,11 @@ std::vector<std::ostream*> g_logging_err_outs = {
#define IPC_JSON_READ(ROOT) \ #define IPC_JSON_READ(ROOT) \
{ \ { \
Json::Reader reader; \ Json::CharReaderBuilder builder; \
if (!reader.parse(std::string(buf->payload, buf->header->size), ROOT, false)) { \ std::unique_ptr<Json::CharReader> reader{builder.newCharReader()}; \
throw invalid_reply_payload_error(auss_t() << "Failed to parse reply on \"" i3IPC_TYPE_STR "\": " << reader.getFormattedErrorMessages()); \ std::string error;\
if (!reader->parse(buf->payload, buf->payload + buf->header->size, &ROOT, &error)) { \
throw invalid_reply_payload_error(auss_t() << "Failed to parse reply on \"" i3IPC_TYPE_STR "\": " << error); \
} \ } \
} }