changeset 2034:07f2ba3677df

Fix of Debian bug #823139 ("orthanc: Please provide RecoverCompressedFile.cpp")
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 Jun 2016 12:58:25 +0200
parents bfdf24883ff3
children 9dd1ee869b88
files CMakeLists.txt NEWS Resources/Samples/Tools/CMakeLists.txt Resources/Samples/Tools/RecoverCompressedFile.cpp
diffstat 4 files changed, 65 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Jun 21 11:10:34 2016 +0200
+++ b/CMakeLists.txt	Tue Jun 21 12:58:25 2016 +0200
@@ -29,8 +29,9 @@
 SET(ENABLE_JPEG ON CACHE BOOL "Enable JPEG decompression")
 SET(ENABLE_JPEG_LOSSLESS ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression")
 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins")
-SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Build the ServeFolders plugin")
-SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Build the sample plugin to serve modality worklists")
+SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin")
+SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists")
+SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc")
 SET(USE_DCMTK_361 OFF CACHE BOOL "Use forthcoming DCMTK version 3.6.1 in static builds (instead of 3.6.0)")
 SET(ENABLE_PKCS11 OFF CACHE BOOL "Enable PKCS#11 for HTTPS client authentication using hardware security modules and smart cards")
 
@@ -597,6 +598,58 @@
 
 
 #####################################################################
+## Build the companion tool to recover files compressed using Orthanc
+#####################################################################
+
+if (BUILD_RECOVER_COMPRESSED_FILE)
+  set(RECOVER_COMPRESSED_SOURCES
+    Resources/Samples/Tools/RecoverCompressedFile.cpp
+    )
+
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+    execute_process(
+      COMMAND 
+      ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
+      ${ORTHANC_VERSION} OrthancRecoverCompressedFile OrthancRecoverCompressedFile.exe
+      "Lightweight, RESTful DICOM server for medical imaging"
+      ERROR_VARIABLE Failure
+      OUTPUT_FILE ${AUTOGENERATED_DIR}/OrthancRecoverCompressedFile.rc
+      )
+
+    if (Failure)
+      message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+    endif()
+
+    list(APPEND RECOVER_COMPRESSED_SOURCES
+      ${AUTOGENERATED_DIR}/OrthancRecoverCompressedFile.rc
+      )
+  endif()
+
+  add_executable(OrthancRecoverCompressedFile
+    ${RECOVER_COMPRESSED_SOURCES}
+    ${ZLIB_SOURCES}
+    ${BOOST_SOURCES}
+    ${JSONCPP_SOURCES}
+    ${PUGIXML_SOURCES}
+    ${CMAKE_SOURCE_DIR}/Core/ChunkedBuffer.cpp
+    ${CMAKE_SOURCE_DIR}/Core/Logging.cpp
+    ${CMAKE_SOURCE_DIR}/Core/Enumerations.cpp
+    ${CMAKE_SOURCE_DIR}/Core/Toolbox.cpp
+    ${CMAKE_SOURCE_DIR}/Core/Compression/DeflateBaseCompressor.cpp
+    ${CMAKE_SOURCE_DIR}/Core/Compression/ZlibCompressor.cpp
+    ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/md5/md5.c
+    ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/base64/base64.cpp
+    )
+
+  install(
+    TARGETS OrthancRecoverCompressedFile
+    RUNTIME DESTINATION bin
+    )
+endif()
+
+
+
+#####################################################################
 ## Generate the documentation if Doxygen is present
 #####################################################################
 
--- a/NEWS	Tue Jun 21 11:10:34 2016 +0200
+++ b/NEWS	Tue Jun 21 12:58:25 2016 +0200
@@ -54,6 +54,7 @@
 * Fix issue 11 (is_regular_file() fails for FILE_ATTRIBUTE_REPARSE_POINT)
 * Fix issue 16 ("Limit" parameter error in REST API /tools/find method)
 * Fix of Debian bug #818512 ("FTBFS: Please install libdcmtk*-dev")
+* Fix of Debian bug #823139 ("orthanc: Please provide RecoverCompressedFile.cpp")
 * Replaced "localhost" by "127.0.0.1", as it might impact performance on Windows
 * Compatibility with CMake >= 3.5.0
 * Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
--- a/Resources/Samples/Tools/CMakeLists.txt	Tue Jun 21 11:10:34 2016 +0200
+++ b/Resources/Samples/Tools/CMakeLists.txt	Tue Jun 21 12:58:25 2016 +0200
@@ -20,12 +20,12 @@
 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
 include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake)
 include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/GoogleLogConfiguration.cmake)
+include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake)
 
 add_library(CommonLibraries
   ${BOOST_SOURCES}
-  ${THIRD_PARTY_SOURCES}
-  ${ORTHANC_ROOT}/Core/OrthancException.cpp
+  ${JSONCPP_SOURCES}
+  ${ORTHANC_ROOT}/Core/Enumerations.cpp
   ${ORTHANC_ROOT}/Core/Toolbox.cpp
   ${ORTHANC_ROOT}/Core/Uuid.cpp
   ${ORTHANC_ROOT}/Resources/ThirdParty/md5/md5.c
@@ -34,8 +34,9 @@
 
 add_executable(RecoverCompressedFile
   RecoverCompressedFile.cpp
-  ${ORTHANC_ROOT}/Core/Compression/BufferCompressor.cpp
+  ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp
   ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp
+  ${ZLIB_SOURCES}
   )
 
-target_link_libraries(RecoverCompressedFile CommonLibraries GoogleLog)
+target_link_libraries(RecoverCompressedFile CommonLibraries)
--- a/Resources/Samples/Tools/RecoverCompressedFile.cpp	Tue Jun 21 11:10:34 2016 +0200
+++ b/Resources/Samples/Tools/RecoverCompressedFile.cpp	Tue Jun 21 12:58:25 2016 +0200
@@ -47,7 +47,9 @@
 
     Orthanc::ZlibCompressor compressor;
     std::string uncompressed;
-    compressor.Uncompress(uncompressed, content);
+    compressor.Uncompress(uncompressed, 
+                          content.empty() ? NULL : content.c_str(), 
+                          content.size());
 
     fprintf(stderr, "Writing the uncompressed data...\n");
     fflush(stderr);