# HG changeset patch # User Sebastien Jodogne # Date 1608621677 -3600 # Node ID bcf2a61b5627e97a217b5e9eec18966816eedf58 # Parent 34b47baaec05acb7e1d5d90158f65e1ae796389f remove calls to deprecated Json::Reader diff -r 34b47baaec05 -r bcf2a61b5627 Plugin/Configuration.cpp --- a/Plugin/Configuration.cpp Fri Dec 18 07:18:42 2020 +0100 +++ b/Plugin/Configuration.cpp Tue Dec 22 08:21:17 2020 +0100 @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -156,9 +155,7 @@ void ParseJsonBody(Json::Value& target, const OrthancPluginHttpRequest* request) { - Json::Reader reader; - if (!reader.parse(reinterpret_cast(request->body), - reinterpret_cast(request->body) + request->bodySize, target)) + if (!Orthanc::Toolbox::ReadJson(target, request->body, request->bodySize)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "A JSON file was expected"); diff -r 34b47baaec05 -r bcf2a61b5627 Plugin/DicomWebClient.cpp --- a/Plugin/DicomWebClient.cpp Fri Dec 18 07:18:42 2020 +0100 +++ b/Plugin/DicomWebClient.cpp Tue Dec 22 08:21:17 2020 +0100 @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff -r 34b47baaec05 -r bcf2a61b5627 Plugin/DicomWebFormatter.cpp --- a/Plugin/DicomWebFormatter.cpp Fri Dec 18 07:18:42 2020 +0100 +++ b/Plugin/DicomWebFormatter.cpp Tue Dec 22 08:21:17 2020 +0100 @@ -23,8 +23,8 @@ #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" -#if !defined(NDEBUG) -# include +#if !defined(NDEBUG) // In debug mode, check that the value is actually a JSON string +# include #endif @@ -217,10 +217,8 @@ } #if !defined(NDEBUG) // In debug mode, check that the value is actually a JSON string - Json::Reader reader; Json::Value json; - if (!reader.parse(reinterpret_cast(data), - reinterpret_cast(data) + size, json)) + if (!Orthanc::Toolbox::ReadJson(json, data, size)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } diff -r 34b47baaec05 -r bcf2a61b5627 Plugin/QidoRs.cpp --- a/Plugin/QidoRs.cpp Fri Dec 18 07:18:42 2020 +0100 +++ b/Plugin/QidoRs.cpp Tue Dec 22 08:21:17 2020 +0100 @@ -492,11 +492,7 @@ LOG(INFO) << "Body of the call from QIDO-RS to /tools/find: " << find.toStyledString(); std::string body; - - { - Json::FastWriter writer; - body = writer.write(find); - } + Orthanc::Toolbox::WriteJson(body, find, true /* fast */); Json::Value resources; if (!OrthancPlugins::RestApiPost(resources, "/tools/find", body, false) ||