Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package orthanc-dicomweb for 
openSUSE:Factory checked in at 2021-05-11 23:03:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/orthanc-dicomweb (Old)
 and      /work/SRC/openSUSE:Factory/.orthanc-dicomweb.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "orthanc-dicomweb"

Tue May 11 23:03:58 2021 rev:7 rq:892107 version:1.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/orthanc-dicomweb/orthanc-dicomweb.changes        
2021-01-28 21:28:59.540245858 +0100
+++ 
/work/SRC/openSUSE:Factory/.orthanc-dicomweb.new.2988/orthanc-dicomweb.changes  
    2021-05-11 23:04:03.284986592 +0200
@@ -1,0 +2,10 @@
+Sun May  9 10:14:35 UTC 2021 - Axel Braun <[email protected]>
+
+- Version 1.6 
+* New field "Timeout" in "DicomWeb.Servers" to specify HTTP timeout on a 
per-server basis
+* Reduced memory consumption in STOW-RS server thanks to an optimization of
+  Orthanc::MultipartStreamReader in Orthanc framework 1.9.3
+* Fix issue #194 (Upgrade media types to DICOM 2021a, cf. table 8.7.3-5)
+* Fix issue #196 (STOW-RS: Should return 200 only when successfully stored all 
instances)
+ 
+-------------------------------------------------------------------

Old:
----
  OrthancDicomWeb-1.5.tar.gz

New:
----
  OrthancDicomWeb-1.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ orthanc-dicomweb.spec ++++++
--- /var/tmp/diff_new_pack.a5o3tn/_old  2021-05-11 23:04:03.964983490 +0200
+++ /var/tmp/diff_new_pack.a5o3tn/_new  2021-05-11 23:04:03.964983490 +0200
@@ -21,7 +21,7 @@
 Summary:        WebViewer plugin for Orthanc
 License:        AGPL-3.0-or-later
 Group:          Productivity/Graphics/Viewers
-Version:        1.5
+Version:        1.6
 Release:        0
 URL:            https://orthanc-server.com
 Source0:        
https://www.orthanc-server.com/downloads/get.php?path=/plugin-dicom-web/OrthancDicomWeb-%{version}.tar.gz

++++++ OrthancDicomWeb-1.5.tar.gz -> OrthancDicomWeb-1.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/.hg_archival.txt 
new/OrthancDicomWeb-1.6/.hg_archival.txt
--- old/OrthancDicomWeb-1.5/.hg_archival.txt    2021-01-26 19:18:58.000000000 
+0100
+++ new/OrthancDicomWeb-1.6/.hg_archival.txt    2021-05-07 13:31:18.000000000 
+0200
@@ -1,6 +1,6 @@
 repo: d5f45924411123cfd02d035fd50b8e37536eadef
-node: 37795a3d49021da79ce0651451e19b3ee529e28e
-branch: OrthancDicomWeb-1.5
+node: 01bae1ba951d3c66e55aba6129bcba0ef825d081
+branch: OrthancDicomWeb-1.6
 latesttag: null
-latesttagdistance: 453
-changessincelatesttag: 482
+latesttagdistance: 462
+changessincelatesttag: 491
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/CMakeLists.txt 
new/OrthancDicomWeb-1.6/CMakeLists.txt
--- old/OrthancDicomWeb-1.5/CMakeLists.txt      2021-01-26 19:18:58.000000000 
+0100
+++ new/OrthancDicomWeb-1.6/CMakeLists.txt      2021-05-07 13:31:18.000000000 
+0200
@@ -21,13 +21,13 @@
 
 project(OrthancDicomWeb)
 
-set(ORTHANC_DICOM_WEB_VERSION "1.5")
+set(ORTHANC_DICOM_WEB_VERSION "1.6")
 
 if (ORTHANC_DICOM_WEB_VERSION STREQUAL "mainline")
   set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
 else()
-  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.8.2")
+  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.3")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
 endif()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/NEWS new/OrthancDicomWeb-1.6/NEWS
--- old/OrthancDicomWeb-1.5/NEWS        2021-01-26 19:18:58.000000000 +0100
+++ new/OrthancDicomWeb-1.6/NEWS        2021-05-07 13:31:18.000000000 +0200
@@ -2,6 +2,16 @@
 ===============================
 
 
+Version 1.6 (2021-05-07)
+========================
+
+* New field "Timeout" in "DicomWeb.Servers" to specify HTTP timeout on a 
per-server basis
+* Reduced memory consumption in STOW-RS server thanks to an optimization of
+  Orthanc::MultipartStreamReader in Orthanc framework 1.9.3
+* Fix issue #194 (Upgrade media types to DICOM 2021a, cf. table 8.7.3-5)
+* Fix issue #196 (STOW-RS: Should return 200 only when successfully stored all 
instances)
+
+
 Version 1.5 (2021-01-26)
 ========================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/Plugin/DicomWebServers.cpp 
new/OrthancDicomWeb-1.6/Plugin/DicomWebServers.cpp
--- old/OrthancDicomWeb-1.5/Plugin/DicomWebServers.cpp  2021-01-26 
19:18:58.000000000 +0100
+++ new/OrthancDicomWeb-1.6/Plugin/DicomWebServers.cpp  2021-05-07 
13:31:18.000000000 +0200
@@ -155,6 +155,11 @@
       parameters.GetBooleanUserProperty(HAS_CHUNKED_TRANSFERS, true));
 
     userProperties = parameters.GetUserProperties();
+
+    if (parameters.HasTimeout())
+    {
+      client.SetTimeout(parameters.GetTimeout());
+    }
   }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/Plugin/StowRs.cpp 
new/OrthancDicomWeb-1.6/Plugin/StowRs.cpp
--- old/OrthancDicomWeb-1.5/Plugin/StowRs.cpp   2021-01-26 19:18:58.000000000 
+0100
+++ new/OrthancDicomWeb-1.6/Plugin/StowRs.cpp   2021-05-07 13:31:18.000000000 
+0200
@@ -37,7 +37,9 @@
     isFirst_(true),
     result_(Json::objectValue),
     success_(Json::arrayValue),
-    failed_(Json::arrayValue)
+    failed_(Json::arrayValue),
+    hasBadSyntax_(false),
+    hasConflict_(false)
   { 
     std::string tmp, contentType, subType, boundary;
     if (!Orthanc::MultipartStreamReader::GetMainContentType(tmp, headers) ||
@@ -111,8 +113,9 @@
 
     if (!ok)
     {
-      // Bad DICOM file => TODO add to error
+      // Bad DICOM file
       LogWarning("STOW-RS cannot parse an incoming DICOM file");
+      hasBadSyntax_ = true;
       return;
     }
 
@@ -127,6 +130,21 @@
         dicom[Orthanc::DICOM_TAG_STUDY_INSTANCE_UID.Format()].type() != 
Json::stringValue)
     {
       LogWarning("STOW-RS: Missing a mandatory tag in incoming DICOM file");
+      hasBadSyntax_ = true;      
+
+      if (dicom.isMember(Orthanc::DICOM_TAG_SOP_CLASS_UID.Format()) &&
+          dicom.isMember(Orthanc::DICOM_TAG_SOP_INSTANCE_UID.Format()) &&
+          dicom[Orthanc::DICOM_TAG_SOP_CLASS_UID.Format()].type() == 
Json::stringValue &&
+          dicom[Orthanc::DICOM_TAG_SOP_INSTANCE_UID.Format()].type() == 
Json::stringValue)
+      {
+        Json::Value item = Json::objectValue;
+        item[DICOM_TAG_REFERENCED_SOP_CLASS_UID.Format()] = 
dicom[Orthanc::DICOM_TAG_SOP_CLASS_UID.Format()].asString();
+        item[DICOM_TAG_REFERENCED_SOP_INSTANCE_UID.Format()] = 
dicom[Orthanc::DICOM_TAG_SOP_INSTANCE_UID.Format()].asString();
+        item[DICOM_TAG_FAILURE_REASON.Format()] =
+          boost::lexical_cast<std::string>(0xC000);  // Error: Cannot 
understand
+        failed_.append(item);
+      }
+
       return;
     }
 
@@ -142,12 +160,14 @@
     if (!expectedStudy_.empty() &&
         studyInstanceUid != expectedStudy_)
     {
-      LogInfo("STOW-RS request restricted to study [" + expectedStudy_ + 
-              "]: Ignoring instance from study [" + studyInstanceUid + "]");
+      LogWarning("STOW-RS request restricted to study [" + expectedStudy_ + 
+                 "], but received instance from study [" + studyInstanceUid + 
"]");
 
-      /*item[DICOM_TAG_WARNING_REASON.Format()] =
-        boost::lexical_cast<std::string>(0xB006);  // Elements discarded
-        success.append(item);*/
+      hasConflict_ = true;
+
+      item[DICOM_TAG_FAILURE_REASON.Format()] =
+        boost::lexical_cast<std::string>(0x0110);  // Processing failure
+      failed_.append(item);
     }
     else
     {
@@ -203,9 +223,23 @@
     
     DicomWebFormatter::Apply(answer, context_, result_, xml_,
                              OrthancPluginDicomWebBinaryMode_Ignore, "");
-      
-    OrthancPluginAnswerBuffer(context_, output, answer.c_str(), answer.size(),
-                              xml_ ? "application/dicom+xml" : 
"application/dicom+json");
+
+    // 
http://dicom.nema.org/medical/dicom/current/output/html/part18.html#table_10.5.3-1
+    if (hasBadSyntax_)
+    {
+      // Error 400
+      OrthancPluginSendHttpStatus(context_, output, 400, answer.c_str(), 
answer.size());
+    }
+    else if (hasConflict_)
+    {
+      // Error 409
+      OrthancPluginSendHttpStatus(context_, output, 409, answer.c_str(), 
answer.size());
+    }
+    else
+    {      
+      OrthancPluginAnswerBuffer(context_, output, answer.c_str(), 
answer.size(),
+                                xml_ ? "application/dicom+xml" : 
"application/dicom+json");
+    }
   };
 
   
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/Plugin/StowRs.h 
new/OrthancDicomWeb-1.6/Plugin/StowRs.h
--- old/OrthancDicomWeb-1.5/Plugin/StowRs.h     2021-01-26 19:18:58.000000000 
+0100
+++ new/OrthancDicomWeb-1.6/Plugin/StowRs.h     2021-05-07 13:31:18.000000000 
+0200
@@ -41,6 +41,8 @@
     Json::Value            result_;
     Json::Value            success_;
     Json::Value            failed_;
+    bool                   hasBadSyntax_;
+    bool                   hasConflict_;
 
     std::unique_ptr<Orthanc::MultipartStreamReader>  parser_;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OrthancDicomWeb-1.5/Plugin/WadoRsRetrieveFrames.cpp 
new/OrthancDicomWeb-1.6/Plugin/WadoRsRetrieveFrames.cpp
--- old/OrthancDicomWeb-1.5/Plugin/WadoRsRetrieveFrames.cpp     2021-01-26 
19:18:58.000000000 +0100
+++ new/OrthancDicomWeb-1.6/Plugin/WadoRsRetrieveFrames.cpp     2021-05-07 
13:31:18.000000000 +0200
@@ -166,19 +166,25 @@
           syntax = Orthanc::DicomTransferSyntax_JPEGProcess14;
           return true;
         }
-        else if (type == "image/x-dicom-rle" && (transferSyntax.empty() ||  // 
Default
-                                                 transferSyntax == 
"1.2.840.10008.1.2.5"))
+        else if ((type == "image/x-dicom-rle" ||   // Table 6.1.1.8-3b of 
DICOM 2017c (backward compatibility)
+                  type == "image/dicom-rle") &&    // Table 8.7.3-5 of DICOM 
2021a
+                 (transferSyntax.empty() ||        // Default
+                  transferSyntax == "1.2.840.10008.1.2.5"))
         {
           syntax = Orthanc::DicomTransferSyntax_RLELossless;
           return true;
         }
-        else if (type == "image/x-jls" && (transferSyntax.empty() ||  // 
Default
-                                           transferSyntax == 
"1.2.840.10008.1.2.4.80"))
+        else if ((type == "image/x-jls" ||   // Table 6.1.1.8-3b of DICOM 
2017c (backward compatibility)
+                  type == "image/jls") &&    // Table 8.7.3-5 of DICOM 2021a
+                 (transferSyntax.empty() ||  // Default
+                  transferSyntax == "1.2.840.10008.1.2.4.80"))
         {
           syntax = Orthanc::DicomTransferSyntax_JPEGLSLossless;
           return true;
         }
-        else if (type == "image/x-jls" && transferSyntax == 
"1.2.840.10008.1.2.4.81")
+        else if ((type == "image/x-jls" ||   // Table 6.1.1.8-3b of DICOM 
2017c (backward compatibility)
+                  type == "image/jls") &&    // Table 8.7.3-5 of DICOM 2021a
+                 transferSyntax == "1.2.840.10008.1.2.4.81")
         {
           syntax = Orthanc::DicomTransferSyntax_JPEGLSLossy;
           return true;
@@ -345,13 +351,16 @@
       return "image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.70";
     
     case Orthanc::DicomTransferSyntax_RLELossless:
-      return "image/x-dicom-rle; transfer-syntax=1.2.840.10008.1.2.5";
+      // Was "image/x-dicom-rle" in DICOMweb <= 1.5
+      return "image/dicom-rle; transfer-syntax=1.2.840.10008.1.2.5";
 
     case Orthanc::DicomTransferSyntax_JPEGLSLossless:
-      return "image/x-jls; transfer-syntax=1.2.840.10008.1.2.4.80";
+      // Was "image/x-jls" in DICOMweb <= 1.5
+      return "image/jls; transfer-syntax=1.2.840.10008.1.2.4.80";
 
     case Orthanc::DicomTransferSyntax_JPEGLSLossy:
-      return "image/x-jls; transfer-syntax=1.2.840.10008.1.2.4.81";
+      // Was "image/x-jls" in DICOMweb <= 1.5
+      return "image/jls; transfer-syntax=1.2.840.10008.1.2.4.81";
 
     case Orthanc::DicomTransferSyntax_JPEG2000LosslessOnly:
       return "image/jp2; transfer-syntax=1.2.840.10008.1.2.4.90";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/OrthancDicomWeb-1.5/Resources/Orthanc/CMake/Compiler.cmake 
new/OrthancDicomWeb-1.6/Resources/Orthanc/CMake/Compiler.cmake
--- old/OrthancDicomWeb-1.5/Resources/Orthanc/CMake/Compiler.cmake      
2021-01-26 19:18:58.000000000 +0100
+++ new/OrthancDicomWeb-1.6/Resources/Orthanc/CMake/Compiler.cmake      
2021-05-07 13:31:18.000000000 +0200
@@ -188,7 +188,7 @@
   add_definitions(
     -D_CRT_SECURE_NO_WARNINGS=1
     )
-  link_libraries(rpcrt4 ws2_32)
+  link_libraries(rpcrt4 ws2_32 iphlpapi)  # "iphlpapi" is for 
"SystemToolbox::GetMacAddresses()"
 
   if (CMAKE_COMPILER_IS_GNUCXX)
     # Some additional C/C++ compiler flags for MinGW
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/OrthancDicomWeb-1.5/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake 
new/OrthancDicomWeb-1.6/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake
--- 
old/OrthancDicomWeb-1.5/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake  
    2021-01-26 19:18:58.000000000 +0100
+++ 
new/OrthancDicomWeb-1.6/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake  
    2021-05-07 13:31:18.000000000 +0200
@@ -122,6 +122,14 @@
         set(ORTHANC_FRAMEWORK_MD5 "db094f96399cbe8b9bbdbce34884c220")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.2")
         set(ORTHANC_FRAMEWORK_MD5 "8bfa10e66c9931e74111be0bfb1f4548")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.0")
+        set(ORTHANC_FRAMEWORK_MD5 "cea0b02ce184671eaf1bd668beefbf28")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.1")
+        set(ORTHANC_FRAMEWORK_MD5 "08eebc66ef93c3b40115c38501db5fbd")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.2")
+        set(ORTHANC_FRAMEWORK_MD5 "3ea66c09f64aca990016683b6375734e")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.3")
+        set(ORTHANC_FRAMEWORK_MD5 "9b86e6f00e03278293cd15643cc0233f")
 
       # Below this point are development snapshots that were used to
       # release some plugin, before an official release of the Orthanc
@@ -426,6 +434,8 @@
 
 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
   set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "")
+  set(ORTHANC_FRAMEWORK_USE_SHARED ON CACHE BOOL "Whether to use the shared 
library or the static library")
+  set(ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional 
libraries to link against, separated by whitespaces, typically needed if using 
the static library (a common minimal value is \"boost_filesystem 
boost_iostreams boost_locale boost_regex boost_thread jsoncpp pugixml uuid\")")
 
   if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND
       CMAKE_COMPILER_IS_GNUCXX) # MinGW
@@ -442,113 +452,75 @@
   include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
   set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py)
 
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR
-      ORTHANC_FRAMEWORK_STATIC)
-    include_directories(${ORTHANC_FRAMEWORK_ROOT}/..)
+  if (ORTHANC_FRAMEWORK_USE_SHARED)
+    list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
+    list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
+  else()
+    list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
+    list(GET CMAKE_FIND_LIBRARY_SUFFIXES 1 Suffix)
+  endif()
+
+  # The "OrthancFramework" library must be the first one to be included
+  if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
+    set(ORTHANC_FRAMEWORK_LIBRARIES ${Prefix}OrthancFramework${Suffix})
+  else ()
+    set(ORTHANC_FRAMEWORK_LIBRARIES 
${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix})
+  endif()
+
+  if (NOT ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES STREQUAL "")
+    # https://stackoverflow.com/a/5272993/881731
+    string(REPLACE " " ";" tmp ${ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES})
+    list(APPEND ORTHANC_FRAMEWORK_LIBRARIES ${tmp})
+  endif()
+
+  # Look for the version of the mandatory dependency JsonCpp (cf. 
JsonCppConfiguration.cmake)
+  if (CMAKE_CROSSCOMPILING)
+    set(JSONCPP_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}/..)
   else()
-    # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
     find_path(JSONCPP_INCLUDE_DIR json/reader.h
+      ${ORTHANC_FRAMEWORK_ROOT}/..
       /usr/include/jsoncpp
       /usr/local/include/jsoncpp
       )
+  endif()
 
-    message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
-    include_directories(${JSONCPP_INCLUDE_DIR})
-    link_libraries(jsoncpp)
-
-    CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
-    if (NOT HAVE_JSONCPP_H)
-      message(FATAL_ERROR "Please install the libjsoncpp-dev package")
-    endif()
-
-    # Switch to the C++11 standard if the version of JsonCpp is 1.y.z
-    # (same as variable JSONCPP_CXX11 in the source code of Orthanc)
-    if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
-      file(STRINGS
-        "${JSONCPP_INCLUDE_DIR}/json/version.h" 
-        JSONCPP_VERSION_MAJOR1 REGEX
-        ".*define JSONCPP_VERSION_MAJOR.*")
-
-      if (NOT JSONCPP_VERSION_MAJOR1)
-        message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
-      endif()
-      
-      string(REGEX REPLACE
-        ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" 
-        JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
-      message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
-
-      if (JSONCPP_VERSION_MAJOR GREATER 0)
-        message("Switching to C++11 standard, as version of JsonCpp is >= 
1.0.0")
-        if (CMAKE_COMPILER_IS_GNUCXX)
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
-        elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-        endif()
-      endif()
-    else()
-      message("Unable to detect the major version of JsonCpp, assuming < 
1.0.0")
-    endif()
+  message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
+  include_directories(${JSONCPP_INCLUDE_DIR})
 
-    # Look for mandatory dependency Boost (cf. BoostConfiguration.cmake)
-    include(FindBoost)
-    find_package(Boost COMPONENTS filesystem thread system date_time regex 
${ORTHANC_BOOST_COMPONENTS})
+  CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
+  if (NOT HAVE_JSONCPP_H)
+    message(FATAL_ERROR "Please install the libjsoncpp-dev package")
+  endif()
+
+  # Switch to the C++11 standard if the version of JsonCpp is 1.y.z
+  # (same as variable JSONCPP_CXX11 in the source code of Orthanc)
+  if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
+    file(STRINGS
+      "${JSONCPP_INCLUDE_DIR}/json/version.h" 
+      JSONCPP_VERSION_MAJOR1 REGEX
+      ".*define JSONCPP_VERSION_MAJOR.*")
 
-    if (NOT Boost_FOUND)
-      message(FATAL_ERROR "Unable to locate Boost on this system")
+    if (NOT JSONCPP_VERSION_MAJOR1)
+      message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
     endif()
     
-    include_directories(${Boost_INCLUDE_DIRS})
-    link_libraries(${Boost_LIBRARIES})
-
-    # Optional component - Lua
-    if (ENABLE_LUA)
-      include(FindLua)
-
-      if (NOT LUA_FOUND)
-        message(FATAL_ERROR "Please install the liblua-dev package")
-      endif()
-
-      include_directories(${LUA_INCLUDE_DIR})
-      link_libraries(${LUA_LIBRARIES})
-    endif()
-
-    # Optional component - SQLite
-    if (ENABLE_SQLITE)    
-      CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H)
-      if (NOT HAVE_SQLITE_H)
-        message(FATAL_ERROR "Please install the libsqlite3-dev package")
-      endif()
-      link_libraries(sqlite3)
-    endif()
-
-    # Optional component - Pugixml
-    if (ENABLE_PUGIXML)
-      CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
-      if (NOT HAVE_PUGIXML_H)
-        message(FATAL_ERROR "Please install the libpugixml-dev package")
-      endif()      
-      link_libraries(pugixml)
-    endif()
-
-    # Optional component - DCMTK
-    if (ENABLE_DCMTK)
-      include(FindDCMTK)
-      include_directories(${DCMTK_INCLUDE_DIRS})
-      link_libraries(${DCMTK_LIBRARIES})
-    endif()
-
-    # Optional component - OpenSSL
-    if (ENABLE_SSL)
-      include(FindOpenSSL)
-      if (NOT ${OPENSSL_FOUND})
-        message(FATAL_ERROR "Unable to find OpenSSL")
+    string(REGEX REPLACE
+      ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" 
+      JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
+    message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
+
+    if (JSONCPP_VERSION_MAJOR GREATER 0)
+      message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0")
+      if (CMAKE_COMPILER_IS_GNUCXX)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
+      elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
       endif()
-      include_directories(${OPENSSL_INCLUDE_DIR})
-      link_libraries(${OPENSSL_LIBRARIES})
     endif()
+  else()
+    message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")
   endif()
-
+  
   # Look for Orthanc framework shared library
   include(CheckCXXSymbolExists)
 
@@ -568,28 +540,17 @@
   
   message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
   include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR})
-  
-  if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
-    set(ORTHANC_FRAMEWORK_LIBRARIES OrthancFramework)
-  else()
-    if (MSVC)
-      set(Suffix ".lib")
-      set(Prefix "")
-    else()
-      list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
-      list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
-    endif()
-    set(ORTHANC_FRAMEWORK_LIBRARIES 
${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix})
-  endif()
 
-  set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
-  set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}")
-  
-  check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" 
HAVE_ORTHANC_FRAMEWORK)
-  if (NOT HAVE_ORTHANC_FRAMEWORK)
-    message(FATAL_ERROR "Cannot find the Orthanc framework")
+  if (ORTHANC_FRAMEWORK_USE_SHARED)
+    set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
+    set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}")
+    
+    check_cxx_symbol_exists("Orthanc::InitializeFramework" 
"OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK)
+    if (NOT HAVE_ORTHANC_FRAMEWORK)
+      message(FATAL_ERROR "Cannot find the Orthanc framework")
+    endif()
+    
+    unset(CMAKE_REQUIRED_INCLUDES)
+    unset(CMAKE_REQUIRED_LIBRARIES)
   endif()
-
-  unset(CMAKE_REQUIRED_INCLUDES)
-  unset(CMAKE_REQUIRED_LIBRARIES)
 endif()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/OrthancDicomWeb-1.5/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp 
new/OrthancDicomWeb-1.6/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
--- 
old/OrthancDicomWeb-1.5/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp   
    2021-01-26 19:18:58.000000000 +0100
+++ 
new/OrthancDicomWeb-1.6/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp   
    2021-05-07 13:31:18.000000000 +0200
@@ -2726,10 +2726,18 @@
           delete *it;
         }
 
+        size_ = 0;
         content_.clear();
       }
 
-      void Flatten(std::string& target) const
+      /**
+       * Since Orthanc 1.9.3, this function also clears the content of
+       * the ChunkedBuffer in order to mimic the behavior of the
+       * original class "Orthanc::ChunkedBuffer". This prevents the
+       * forgetting of calling "Clear()" in order to reduce memory
+       * consumption.
+       **/
+      void Flatten(std::string& target)
       {
         target.resize(size_);
 
@@ -2745,10 +2753,14 @@
             memcpy(&target[pos], (*it)->c_str(), s);
             pos += s;
           }
+
+          delete *it;
         }
 
-        assert(size_ == 0 ||
-               pos == target.size());
+        assert(pos == target.size());
+
+        size_ = 0;
+        content_.clear();
       }
 
       void AddChunk(const void* data,
@@ -2779,7 +2791,7 @@
         return headers_;
       }
 
-      const ChunkedBuffer& GetBody() const
+      ChunkedBuffer& GetBody()
       {
         return body_;
       }

Reply via email to