Mercurial > hg > orthanc
changeset 2977:ee0b2c5ad49b
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Dec 2018 12:27:30 +0100 |
parents | cb5d75143da0 (current diff) e62e296a5714 (diff) |
children | d0250d096acc |
files | |
diffstat | 6 files changed, 30 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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"); } }
--- 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 <boost/lexical_cast.hpp> -#include <boost/lexical_cast/try_lexical_convert.hpp> #include <string> #include <map> @@ -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<int>(str, numericalValue)) + if (Toolbox::IsInteger(str)) { - return static_cast<Enumeration>(numericalValue); + return static_cast<Enumeration>(boost::lexical_cast<int>(str)); } typename StringToEnumeration::const_iterator
--- 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; } }
--- 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,
--- 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
--- 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