comparison OrthancServer/Sources/ServerContext.cpp @ 4392:3af1d763763a

confining Json::Reader and Json::*Writer into Toolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Dec 2020 18:09:47 +0100
parents 7e0d015ad109
children f7104e9d044c
comparison
equal deleted inserted replaced
4391:0c4ff5609548 4392:3af1d763763a
257 try 257 try
258 { 258 {
259 Json::Value value; 259 Json::Value value;
260 jobsEngine_.GetRegistry().Serialize(value); 260 jobsEngine_.GetRegistry().Serialize(value);
261 261
262 Json::FastWriter writer; 262 std::string serialized;
263 std::string serialized = writer.write(value); 263 Toolbox::WriteJson(serialized, value, true /* fast */);
264 264
265 index_.SetGlobalProperty(GlobalProperty_JobsRegistry, serialized); 265 index_.SetGlobalProperty(GlobalProperty_JobsRegistry, serialized);
266 } 266 }
267 catch (OrthancException& e) 267 catch (OrthancException& e)
268 { 268 {
820 if (ignoreTagLength.empty()) 820 if (ignoreTagLength.empty())
821 { 821 {
822 std::string tmp; 822 std::string tmp;
823 ReadDicomAsJsonInternal(tmp, instancePublicId); 823 ReadDicomAsJsonInternal(tmp, instancePublicId);
824 824
825 Json::Reader reader; 825 if (!Toolbox::ReadJson(result, tmp))
826 if (!reader.parse(tmp, result))
827 { 826 {
828 throw OrthancException(ErrorCode_CorruptedFile); 827 throw OrthancException(ErrorCode_CorruptedFile);
829 } 828 }
830 } 829 }
831 else 830 else