# HG changeset patch # User Sebastien Jodogne # Date 1544095650 -3600 # Node ID ee0b2c5ad49bd289c3e15bc200e515bde321736e # Parent cb5d75143da03f126b7609d7cf20ac4ecd29a665# Parent e62e296a5714bff5cbf602af36345778eb529e41 merge diff -r cb5d75143da0 -r ee0b2c5ad49b Core/DicomFormat/DicomInstanceHasher.cpp --- a/Core/DicomFormat/DicomInstanceHasher.cpp Thu Dec 06 12:23:46 2018 +0100 +++ b/Core/DicomFormat/DicomInstanceHasher.cpp Thu Dec 06 12:27:30 2018 +0100 @@ -53,7 +53,7 @@ seriesUid_.size() == 0 || instanceUid_.size() == 0) { - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, "missing StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID"); } } diff -r cb5d75143da0 -r ee0b2c5ad49b Core/EnumerationDictionary.h --- a/Core/EnumerationDictionary.h Thu Dec 06 12:23:46 2018 +0100 +++ b/Core/EnumerationDictionary.h Thu Dec 06 12:27:30 2018 +0100 @@ -37,7 +37,6 @@ #include "Toolbox.h" #include -#include #include #include @@ -85,10 +84,9 @@ Enumeration Translate(const std::string& str) const { - int numericalValue; // at this stage, we don't know if str is an alias or a numerical value - if (boost::conversion::try_lexical_convert(str, numericalValue)) + if (Toolbox::IsInteger(str)) { - return static_cast(numericalValue); + return static_cast(boost::lexical_cast(str)); } typename StringToEnumeration::const_iterator diff -r cb5d75143da0 -r ee0b2c5ad49b Plugins/Samples/Common/OrthancPluginCppWrapper.cpp --- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Dec 06 12:23:46 2018 +0100 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Dec 06 12:27:30 2018 +0100 @@ -1152,7 +1152,10 @@ } else { - answer.ToJson(result); + if (!answer.IsEmpty()) + { + answer.ToJson(result); + } return true; } } @@ -1172,7 +1175,10 @@ } else { - answer.ToJson(result); + if (!answer.IsEmpty()) + { + answer.ToJson(result); + } return true; } } @@ -1202,7 +1208,10 @@ } else { - answer.ToJson(result); + if (!answer.IsEmpty()) // i.e, on a PUT to metadata/..., orthand returns an empty response + { + answer.ToJson(result); + } return true; } } diff -r cb5d75143da0 -r ee0b2c5ad49b Plugins/Samples/Common/OrthancPluginCppWrapper.h --- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h Thu Dec 06 12:23:46 2018 +0100 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h Thu Dec 06 12:27:30 2018 +0100 @@ -140,6 +140,11 @@ return buffer_.size; } + bool IsEmpty() const + { + return GetSize() == 0 || GetData() == NULL; + } + void Clear(); void ToString(std::string& target) const; @@ -443,6 +448,15 @@ body.size(), applyPlugins); } + inline bool RestApiPost(Json::Value& result, + const std::string& uri, + const MemoryBuffer& body, + bool applyPlugins) + { + return RestApiPost(result, uri, body.GetData(), + body.GetSize(), applyPlugins); + } + bool RestApiPut(Json::Value& result, const std::string& uri, const char* body, diff -r cb5d75143da0 -r ee0b2c5ad49b Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Thu Dec 06 12:23:46 2018 +0100 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Thu Dec 06 12:27:30 2018 +0100 @@ -125,6 +125,7 @@ ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp + ${ORTHANC_ROOT}/Core/EnumerationDictionary.h ${ORTHANC_ROOT}/Core/Enumerations.cpp ${ORTHANC_ROOT}/Core/FileStorage/MemoryStorageArea.cpp ${ORTHANC_ROOT}/Core/Logging.cpp diff -r cb5d75143da0 -r ee0b2c5ad49b TODO --- a/TODO Thu Dec 06 12:23:46 2018 +0100 +++ b/TODO Thu Dec 06 12:27:30 2018 +0100 @@ -134,8 +134,6 @@ Release() and Acquire()) * Avoid direct calls to FromDcmtkBridge (make most of its methods private), go through ParsedDicomFile wherever possible -* avoid boost::bad_lexical_cast exception at least in happy path - by using boost::conversion::try_lexical_convert ================= Platform-specific