changeset 1738:05dc12df49db

remove calls to deprecated classes of JsonCpp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Dec 2020 09:18:33 +0100
parents ef2f56c0311c
children 9ac2a65d4172
files OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.cpp OrthancStone/Sources/Oracle/HttpCommand.cpp
diffstat 2 files changed, 4 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.cpp	Tue Dec 22 09:16:42 2020 +0100
+++ b/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.cpp	Tue Dec 22 09:18:33 2020 +0100
@@ -433,8 +433,7 @@
                                const std::map<std::string, std::string>& headers) ORTHANC_OVERRIDE
     {
       Json::Value json;
-      Json::Reader reader;
-      if (!reader.parse(body, json) ||
+      if (!Orthanc::Toolbox::ReadJson(json, body) ||
           json.type() != Json::arrayValue)
       {
         throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
--- a/OrthancStone/Sources/Oracle/HttpCommand.cpp	Tue Dec 22 09:16:42 2020 +0100
+++ b/OrthancStone/Sources/Oracle/HttpCommand.cpp	Tue Dec 22 09:18:33 2020 +0100
@@ -24,21 +24,14 @@
 
 #include <Logging.h>
 #include <OrthancException.h>
+#include <Toolbox.h>
 
-#ifdef _MSC_VER
-// 'Json::Reader': Use CharReader and CharReaderBuilder instead
-#pragma warning(disable:4996)
-#endif
-
-#include <json/reader.h>
-#include <json/writer.h>
 
 namespace OrthancStone
 {
   void HttpCommand::SuccessMessage::ParseJsonBody(Json::Value& target) const
   {
-    Json::Reader reader;
-    if (!reader.parse(answer_, target))
+    if (!Orthanc::Toolbox::ReadJson(target, answer_))
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
     }
@@ -55,8 +48,7 @@
 
   void HttpCommand::SetBody(const Json::Value& json)
   {
-    Json::FastWriter writer;
-    body_ = writer.write(json);
+    Orthanc::Toolbox::WriteFastJson(body_, json);
   }