Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package orthanc-gdcm for openSUSE:Factory checked in at 2022-04-02 18:20:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/orthanc-gdcm (Old) and /work/SRC/openSUSE:Factory/.orthanc-gdcm.new.1900 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "orthanc-gdcm" Sat Apr 2 18:20:43 2022 rev:7 rq:966479 version:1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/orthanc-gdcm/orthanc-gdcm.changes 2021-07-23 23:41:39.717796824 +0200 +++ /work/SRC/openSUSE:Factory/.orthanc-gdcm.new.1900/orthanc-gdcm.changes 2022-04-02 18:20:56.406006006 +0200 @@ -1,0 +2,8 @@ +Fri Mar 25 20:14:59 UTC 2022 - Axel Braun <axel.br...@gmx.de> + +- Version 1.5 +* Take the configuration option "RestrictTransferSyntaxes" into + account not only for decoding, but also for transcoding +* Upgrade to GDCM 3.0.10 for static builds- + +------------------------------------------------------------------- Old: ---- OrthancGdcm-1.4.tar.gz New: ---- OrthancGdcm-1.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ orthanc-gdcm.spec ++++++ --- /var/tmp/diff_new_pack.DdhoNi/_old 2022-04-02 18:20:56.922000214 +0200 +++ /var/tmp/diff_new_pack.DdhoNi/_new 2022-04-02 18:20:56.938000034 +0200 @@ -1,8 +1,8 @@ # # spec file for package orthanc-gdcm # -# Copyright (c) 2021 SUSE LLC -# Copyright (c) 2020 Dr. Axel Braun +# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2020-2022 Dr. Axel Braun # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ Summary: GDCM plugin for Orthanc License: GPL-3.0-or-later Group: Productivity/Graphics/Viewers -Version: 1.4 +Version: 1.5 Release: 0 URL: http://orthanc-server.com Source0: https://www.orthanc-server.com/downloads/get.php?path=/plugin-gdcm/OrthancGdcm-%{version}.tar.gz ++++++ OrthancGdcm-1.4.tar.gz -> OrthancGdcm-1.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/.hg_archival.txt new/OrthancGdcm-1.5/.hg_archival.txt --- old/OrthancGdcm-1.4/.hg_archival.txt 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/.hg_archival.txt 2022-03-23 21:00:20.000000000 +0100 @@ -1,6 +1,6 @@ repo: 108d34b53bb89b998dbe89c3bb031241991f13c7 -node: ef39b0c16e121aa11887e7f3967f849b9dbfa56f -branch: OrthancGdcm-1.4 +node: d5d420f52a3cd33b707b183ac414f95b5351ba98 +branch: OrthancGdcm-1.5 latesttag: null -latesttagdistance: 52 -changessincelatesttag: 56 +latesttagdistance: 58 +changessincelatesttag: 62 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/CMakeLists.txt new/OrthancGdcm-1.5/CMakeLists.txt --- old/OrthancGdcm-1.4/CMakeLists.txt 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/CMakeLists.txt 2022-03-23 21:00:20.000000000 +0100 @@ -21,13 +21,13 @@ project(OrthancGdcm) -SET(PLUGIN_VERSION "1.4" CACHE STRING "Version of the plugin") +SET(PLUGIN_VERSION "1.5" CACHE STRING "Version of the plugin") if (PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() - set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.4") + set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.10.1") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/NEWS new/OrthancGdcm-1.5/NEWS --- old/OrthancGdcm-1.4/NEWS 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/NEWS 2022-03-23 21:00:20.000000000 +0100 @@ -2,6 +2,14 @@ =============================== +Version 1.5 (2022-03-23) +======================== + +* Take the configuration option "RestrictTransferSyntaxes" into + account not only for decoding, but also for transcoding +* Upgrade to GDCM 3.0.10 for static builds + + Version 1.4 (2021-07-06) ======================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Plugin/Plugin.cpp new/OrthancGdcm-1.5/Plugin/Plugin.cpp --- old/OrthancGdcm-1.4/Plugin/Plugin.cpp 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Plugin/Plugin.cpp 2022-03-23 21:00:20.000000000 +0100 @@ -30,12 +30,19 @@ #include <gdcmFileExplicitFilter.h> #include <gdcmImageChangePhotometricInterpretation.h> #include <gdcmImageChangeTransferSyntax.h> +#include <gdcmImageHelper.h> #include <gdcmImageReader.h> #include <gdcmImageWriter.h> #include <gdcmTagKeywords.h> #include <gdcmUIDGenerator.h> #include <gdcmVersion.h> -#include <gdcmImageHelper.h> + +#define GDCM_VERSION_IS_ABOVE(major, minor, revision) \ + (GDCM_MAJOR_VERSION > major || \ + (GDCM_MAJOR_VERSION == major && \ + (GDCM_MINOR_VERSION > minor || \ + (GDCM_MINOR_VERSION == minor && \ + GDCM_BUILD_VERSION >= revision)))) static OrthancPlugins::GdcmDecoderCache cache_; @@ -111,6 +118,20 @@ } } +static bool IsTransferSyntaxEnabled(const std::string& transferSyntax) +{ + if (!restrictTransferSyntaxes_) + { + return true; + } + + if (enabledTransferSyntaxes_.find(transferSyntax) != enabledTransferSyntaxes_.end()) + { + return true; + } + + return false; +} static OrthancPluginErrorCode DecodeImageCallback(OrthancPluginImage** target, const void* dicom, @@ -270,6 +291,24 @@ { try { + std::string sourceTransferSyntax; + ExtractTransferSyntax(sourceTransferSyntax, buffer, size); + + bool pluginShouldHandleTranscoding = false; + for (uint32_t i = 0; i < countSyntaxes; i++) + { + if (IsTransferSyntaxEnabled(sourceTransferSyntax) || IsTransferSyntaxEnabled(allowedSyntaxes[i])) + { + pluginShouldHandleTranscoding = true; + } + } + + if (!pluginShouldHandleTranscoding) + { + return OrthancPluginErrorCode_Plugin; // not really an error but only way to tell Orthanc that the plugin did not handle transcoding + } + + std::unique_ptr<Orthanc::Semaphore::Locker> locker; if (hasThrottling_) @@ -346,19 +385,21 @@ // https://groups.google.com/g/orthanc-users/c/xIwrkFRceuE/m/jwxy50djAQAJ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Cannot transcode 1bpp DICOM images"); } - + +#if !GDCM_VERSION_IS_ABOVE(3, 0, 9) if (reader.GetImage().GetPixelFormat().GetBitsStored() == 16u && syntax == gdcm::TransferSyntax::JPEGExtendedProcess2_4) { /** * This is a temporary workaround for issue #513 in GDCM - * (will be fixed in GDCM 3.0.9): + * that was fixed in GDCM 3.0.9: * https://sourceforge.net/p/gdcm/bugs/513/ * https://groups.google.com/g/orthanc-users/c/xt9hwpj6mlQ **/ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Transcoding 16bpp images to 1.2.840.10008.1.2.4.51 might lead to a crash in GDCM"); } +#endif gdcm::ImageChangeTransferSyntax change; change.SetTransferSyntax(syntax); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/CMake/GdcmConfiguration.cmake new/OrthancGdcm-1.5/Resources/CMake/GdcmConfiguration.cmake --- old/OrthancGdcm-1.4/Resources/CMake/GdcmConfiguration.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/CMake/GdcmConfiguration.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -22,8 +22,8 @@ set(GDCM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gdcm-2.8.9.tar.gz") set(GDCM_MD5 "aeb00e0cb5375d454010a72e2e0f6154") else() - set(GDCM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gdcm-3.0.8.tar.gz") - set(GDCM_MD5 "29e0e60b04183e3eb9c18ad093156b2c") + set(GDCM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gdcm-3.0.10.tar.gz") + set(GDCM_MD5 "28c70d02c2005a8c9d2a5847c8ba3c00") endif() if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/CMake/AutoGeneratedCode.cmake new/OrthancGdcm-1.5/Resources/Orthanc/CMake/AutoGeneratedCode.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/CMake/AutoGeneratedCode.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/CMake/AutoGeneratedCode.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/CMake/Compiler.cmake new/OrthancGdcm-1.5/Resources/Orthanc/CMake/Compiler.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/CMake/Compiler.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/CMake/Compiler.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake new/OrthancGdcm-1.5/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License @@ -71,7 +72,10 @@ if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$") - message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}") + message("Bad version of the Orthanc framework, assuming a pre-release: ${ORTHANC_FRAMEWORK_VERSION}") + set(ORTHANC_FRAMEWORK_MAJOR 999) + set(ORTHANC_FRAMEWORK_MINOR 999) + set(ORTHANC_FRAMEWORK_REVISION 999) endif() if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1") @@ -132,6 +136,16 @@ set(ORTHANC_FRAMEWORK_MD5 "9b86e6f00e03278293cd15643cc0233f") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.4") set(ORTHANC_FRAMEWORK_MD5 "6d5ca4a73ac7d42445041ca79de1624d") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.5") + set(ORTHANC_FRAMEWORK_MD5 "10fc64de1254a095e5d3ed3931f0cfbb") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.6") + set(ORTHANC_FRAMEWORK_MD5 "4b5d05683d747c29b2860ad79d11e62e") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.7") + set(ORTHANC_FRAMEWORK_MD5 "c912bbb860d640d3ae3003b5c9698205") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.10.0") + set(ORTHANC_FRAMEWORK_MD5 "8610c82d9153f22e929f2110f8f60279") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.10.1") + set(ORTHANC_FRAMEWORK_MD5 "caf667fc5ea452b3d0c2f70bfd02599c") # Below this point are development snapshots that were used to # release some plugin, before an official release of the Orthanc @@ -152,6 +166,9 @@ elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "23ad1b9c7800") # For "Toolbox::ReadJson()" and "Toolbox::Write{...}Json()" (pre-1.9.0) set(ORTHANC_FRAMEWORK_MD5 "9af92080e57c60dd288eba46ce606c00") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "b2e08d83e21d") + # WSI 1.1 (framework pre-1.10.0), to remove "-std=c++11" + set(ORTHANC_FRAMEWORK_MD5 "2eaa073cbb4b44ffba199ad93393b2b1") endif() endif() endif() @@ -494,35 +511,6 @@ 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() - # Look for Orthanc framework shared library include(CheckCXXSymbolExists) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/CMake/DownloadPackage.cmake new/OrthancGdcm-1.5/Resources/Orthanc/CMake/DownloadPackage.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/CMake/DownloadPackage.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/CMake/DownloadPackage.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/LinuxStandardBaseToolchain.cmake new/OrthancGdcm-1.5/Resources/Orthanc/LinuxStandardBaseToolchain.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/LinuxStandardBaseToolchain.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/LinuxStandardBaseToolchain.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/MinGW-W64-Toolchain32.cmake new/OrthancGdcm-1.5/Resources/Orthanc/MinGW-W64-Toolchain32.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/MinGW-W64-Toolchain32.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/MinGW-W64-Toolchain32.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/MinGW-W64-Toolchain64.cmake new/OrthancGdcm-1.5/Resources/Orthanc/MinGW-W64-Toolchain64.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/MinGW-W64-Toolchain64.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/MinGW-W64-Toolchain64.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/MinGWToolchain.cmake new/OrthancGdcm-1.5/Resources/Orthanc/MinGWToolchain.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/MinGWToolchain.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/MinGWToolchain.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp 2022-03-23 21:00:20.000000000 +0100 @@ -2,7 +2,8 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2021 Osimis S.A., Belgium + * Copyright (C) 2017-2022 Osimis S.A., Belgium + * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -510,6 +511,22 @@ } + void OrthancString::ToJsonWithoutComments(Json::Value& target) const + { + if (str_ == NULL) + { + LogError("Cannot convert an empty memory buffer to JSON"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + + if (!ReadJsonWithoutComments(target, str_)) + { + LogError("Cannot convert some memory buffer to JSON"); + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); + } + } + + void MemoryBuffer::DicomToJson(Json::Value& target, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, @@ -539,6 +556,13 @@ const std::string& password) { Clear(); + + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + return CheckHttp(OrthancPluginHttpPost(GetGlobalContext(), &buffer_, url.c_str(), body.c_str(), body.size(), username.empty() ? NULL : username.c_str(), @@ -552,6 +576,13 @@ const std::string& password) { Clear(); + + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + return CheckHttp(OrthancPluginHttpPut(GetGlobalContext(), &buffer_, url.c_str(), body.empty() ? NULL : body.c_str(), body.size(), @@ -630,7 +661,7 @@ ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); } - str.ToJson(configuration_); + str.ToJsonWithoutComments(configuration_); if (configuration_.type() != Json::objectValue) { @@ -1892,6 +1923,12 @@ ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPlugins::MemoryBuffer answer; uint16_t status; OrthancPluginErrorCode code = OrthancPluginCallPeerApi @@ -1920,6 +1957,12 @@ ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPlugins::MemoryBuffer answer; uint16_t status; OrthancPluginErrorCode code = OrthancPluginCallPeerApi @@ -2483,7 +2526,7 @@ } catch (...) { - return OrthancPluginErrorCode_InternalError; + return OrthancPluginErrorCode_Plugin; } } } @@ -2569,8 +2612,8 @@ void HttpClient::ClearCredentials() { - username_.empty(); - password_.empty(); + username_.clear(); + password_.clear(); } @@ -2883,6 +2926,12 @@ MemoryBuffer answerBodyBuffer, answerHeadersBuffer; + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPluginErrorCode error = OrthancPluginHttpClient( GetGlobalContext(), *answerBodyBuffer, @@ -3499,4 +3548,238 @@ } } #endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static std::vector<std::string> WebDavConvertPath(uint32_t pathSize, + const char* const* pathItems) + { + std::vector<std::string> result(pathSize); + + for (uint32_t i = 0; i < pathSize; i++) + { + result[i] = pathItems[i]; + } + + return result; + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static OrthancPluginErrorCode WebDavIsExistingFolder(uint8_t* isExisting, + uint32_t pathSize, + const char* const* pathItems, + void* payload) + { + IWebDavCollection& that = *reinterpret_cast<IWebDavCollection*>(payload); + + try + { + *isExisting = (that.IsExistingFolder(WebDavConvertPath(pathSize, pathItems)) ? 1 : 0); + return OrthancPluginErrorCode_Success; + } + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) + { + return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); + } + catch (...) + { + return OrthancPluginErrorCode_Plugin; + } + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static OrthancPluginErrorCode WebDavListFolder(uint8_t* isExisting, + OrthancPluginWebDavCollection* collection, + OrthancPluginWebDavAddFile addFile, + OrthancPluginWebDavAddFolder addFolder, + uint32_t pathSize, + const char* const* pathItems, + void* payload) + { + IWebDavCollection& that = *reinterpret_cast<IWebDavCollection*>(payload); + + try + { + std::list<IWebDavCollection::FileInfo> files; + std::list<IWebDavCollection::FolderInfo> subfolders; + + if (!that.ListFolder(files, subfolders, WebDavConvertPath(pathSize, pathItems))) + { + *isExisting = 0; + } + else + { + *isExisting = 1; + + for (std::list<IWebDavCollection::FileInfo>::const_iterator + it = files.begin(); it != files.end(); ++it) + { + OrthancPluginErrorCode code = addFile( + collection, it->GetName().c_str(), it->GetContentSize(), + it->GetMimeType().c_str(), it->GetDateTime().c_str()); + + if (code != OrthancPluginErrorCode_Success) + { + return code; + } + } + + for (std::list<IWebDavCollection::FolderInfo>::const_iterator it = + subfolders.begin(); it != subfolders.end(); ++it) + { + OrthancPluginErrorCode code = addFolder( + collection, it->GetName().c_str(), it->GetDateTime().c_str()); + + if (code != OrthancPluginErrorCode_Success) + { + return code; + } + } + } + + return OrthancPluginErrorCode_Success; + } + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) + { + return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); + } + catch (...) + { + return OrthancPluginErrorCode_Plugin; + } + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static OrthancPluginErrorCode WebDavRetrieveFile(OrthancPluginWebDavCollection* collection, + OrthancPluginWebDavRetrieveFile retrieveFile, + uint32_t pathSize, + const char* const* pathItems, + void* payload) + { + IWebDavCollection& that = *reinterpret_cast<IWebDavCollection*>(payload); + + try + { + std::string content, mime, dateTime; + + if (that.GetFile(content, mime, dateTime, WebDavConvertPath(pathSize, pathItems))) + { + return retrieveFile(collection, content.empty() ? NULL : content.c_str(), + content.size(), mime.c_str(), dateTime.c_str()); + } + else + { + // Inexisting file + return OrthancPluginErrorCode_Success; + } + } + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) + { + return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); + } + catch (...) + { + return OrthancPluginErrorCode_InternalError; + } + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static OrthancPluginErrorCode WebDavStoreFileCallback(uint8_t* isReadOnly, /* out */ + uint32_t pathSize, + const char* const* pathItems, + const void* data, + uint64_t size, + void* payload) + { + IWebDavCollection& that = *reinterpret_cast<IWebDavCollection*>(payload); + + try + { + *isReadOnly = (that.StoreFile(WebDavConvertPath(pathSize, pathItems), data, size) ? 1 : 0); + return OrthancPluginErrorCode_Success; + } + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) + { + return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); + } + catch (...) + { + return OrthancPluginErrorCode_InternalError; + } + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static OrthancPluginErrorCode WebDavCreateFolderCallback(uint8_t* isReadOnly, /* out */ + uint32_t pathSize, + const char* const* pathItems, + void* payload) + { + IWebDavCollection& that = *reinterpret_cast<IWebDavCollection*>(payload); + + try + { + *isReadOnly = (that.CreateFolder(WebDavConvertPath(pathSize, pathItems)) ? 1 : 0); + return OrthancPluginErrorCode_Success; + } + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) + { + return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); + } + catch (...) + { + return OrthancPluginErrorCode_InternalError; + } + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + static OrthancPluginErrorCode WebDavDeleteItemCallback(uint8_t* isReadOnly, /* out */ + uint32_t pathSize, + const char* const* pathItems, + void* payload) + { + IWebDavCollection& that = *reinterpret_cast<IWebDavCollection*>(payload); + + try + { + *isReadOnly = (that.DeleteItem(WebDavConvertPath(pathSize, pathItems)) ? 1 : 0); + return OrthancPluginErrorCode_Success; + } + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) + { + return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); + } + catch (...) + { + return OrthancPluginErrorCode_InternalError; + } + } +#endif + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + void IWebDavCollection::Register(const std::string& uri, + IWebDavCollection& collection) + { + OrthancPluginErrorCode code = OrthancPluginRegisterWebDavCollection( + GetGlobalContext(), uri.c_str(), WebDavIsExistingFolder, WebDavListFolder, WebDavRetrieveFile, + WebDavStoreFileCallback, WebDavCreateFolderCallback, WebDavDeleteItemCallback, &collection); + + if (code != OrthancPluginErrorCode_Success) + { + ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + } + } +#endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h 2022-03-23 21:00:20.000000000 +0100 @@ -2,7 +2,8 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2021 Osimis S.A., Belgium + * Copyright (C) 2017-2022 Osimis S.A., Belgium + * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -114,6 +115,12 @@ # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 0 #endif +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 10, 1) +# define HAS_ORTHANC_PLUGIN_WEBDAV 1 +#else +# define HAS_ORTHANC_PLUGIN_WEBDAV 0 +#endif + namespace OrthancPlugins @@ -299,7 +306,9 @@ void ToString(std::string& target) const; void ToJson(Json::Value& target) const; - }; + + void ToJsonWithoutComments(Json::Value& target) const; +}; class OrthancConfiguration : public boost::noncopyable @@ -1245,4 +1254,107 @@ const std::string& transferSyntax); #endif }; + + + +#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 + class IWebDavCollection : public boost::noncopyable + { + public: + class FileInfo + { + private: + std::string name_; + uint64_t contentSize_; + std::string mime_; + std::string dateTime_; + + public: + FileInfo(const std::string& name, + uint64_t contentSize, + const std::string& dateTime) : + name_(name), + contentSize_(contentSize), + dateTime_(dateTime) + { + } + + const std::string& GetName() const + { + return name_; + } + + uint64_t GetContentSize() const + { + return contentSize_; + } + + void SetMimeType(const std::string& mime) + { + mime_ = mime; + } + + const std::string& GetMimeType() const + { + return mime_; + } + + const std::string& GetDateTime() const + { + return dateTime_; + } + }; + + class FolderInfo + { + private: + std::string name_; + std::string dateTime_; + + public: + FolderInfo(const std::string& name, + const std::string& dateTime) : + name_(name), + dateTime_(dateTime) + { + } + + const std::string& GetName() const + { + return name_; + } + + const std::string& GetDateTime() const + { + return dateTime_; + } + }; + + virtual ~IWebDavCollection() + { + } + + virtual bool IsExistingFolder(const std::vector<std::string>& path) = 0; + + virtual bool ListFolder(std::list<FileInfo>& files, + std::list<FolderInfo>& subfolders, + const std::vector<std::string>& path) = 0; + + virtual bool GetFile(std::string& content /* out */, + std::string& mime /* out */, + std::string& dateTime /* out */, + const std::vector<std::string>& path) = 0; + + virtual bool StoreFile(const std::vector<std::string>& path, + const void* data, + size_t size) = 0; + + virtual bool CreateFolder(const std::vector<std::string>& path) = 0; + + virtual bool DeleteItem(const std::vector<std::string>& path) = 0; + + static void Register(const std::string& uri, + IWebDavCollection& collection); + }; +#endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginException.h new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginException.h --- old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginException.h 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginException.h 2022-03-23 21:00:20.000000000 +0100 @@ -2,7 +2,8 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2021 Osimis S.A., Belgium + * Copyright (C) 2017-2022 Osimis S.A., Belgium + * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake --- old/OrthancGdcm-1.4/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake 2021-07-06 12:03:21.000000000 +0200 +++ new/OrthancGdcm-1.5/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake 2022-03-23 21:00:20.000000000 +0100 @@ -1,7 +1,8 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium -# Copyright (C) 2017-2021 Osimis S.A., Belgium +# Copyright (C) 2017-2022 Osimis S.A., Belgium +# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as