# HG changeset patch # User Sebastien Jodogne # Date 1435329699 -7200 # Node ID 61ffefbc1632f4e068e6c096454b58edd3e998f5 # Parent 574d910a57f03ee590f13d2f83de0f4cc0af52c4 upgrade diff -r 574d910a57f0 -r 61ffefbc1632 CMakeLists.txt --- a/CMakeLists.txt Fri May 29 11:05:18 2015 +0200 +++ b/CMakeLists.txt Fri Jun 26 16:41:39 2015 +0200 @@ -55,9 +55,10 @@ # Check that the Orthanc SDK headers are available or download them set(AUTOGENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED) if (STATIC_BUILD) - set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.8.6") + set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg") + #set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.8.6") file(MAKE_DIRECTORY ${AUTOGENERATED_DIR}/orthanc) - file(DOWNLOAD "${ORTHANC_SDK_URL}/Plugins/Include/OrthancCPlugin.h" + file(DOWNLOAD "${ORTHANC_SDK_URL}/Plugins/Include/orthanc/OrthancCPlugin.h" "${AUTOGENERATED_DIR}/orthanc/OrthancCPlugin.h" SHOW_PROGRESS) if (${MSVC}) add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) diff -r 574d910a57f0 -r 61ffefbc1632 Core/Configuration.cpp --- a/Core/Configuration.cpp Fri May 29 11:05:18 2015 +0200 +++ b/Core/Configuration.cpp Fri Jun 26 16:41:39 2015 +0200 @@ -32,33 +32,30 @@ bool Read(Json::Value& configuration, OrthancPluginContext* context) { - std::string path; + std::string s; { - char* pathTmp = OrthancPluginGetConfigurationPath(context); - if (pathTmp == NULL) + char* tmp = OrthancPluginGetConfiguration(context); + if (tmp == NULL) { - OrthancPluginLogError(context, "No configuration file is provided"); + OrthancPluginLogError(context, "Error while retrieving the configuration from Orthanc"); return false; } - path = std::string(pathTmp); - - OrthancPluginFreeString(context, pathTmp); + s.assign(tmp); + OrthancPluginFreeString(context, tmp); } - std::ifstream f(path.c_str()); - Json::Reader reader; - if (!reader.parse(f, configuration) || - configuration.type() != Json::objectValue) + if (reader.parse(s, configuration)) { - std::string s = "Unable to parse the configuration file: " + std::string(path); - OrthancPluginLogError(context, s.c_str()); + return true; + } + else + { + OrthancPluginLogError(context, "Unable to parse the configuration"); return false; } - - return true; }