view OrthancFramework/Resources/Patches/dcmtk-3.6.8.patch @ 5883:96f49b200c15 find-refactoring

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Nov 2024 09:30:50 +0100
parents 50910d241dd7
children 1e51e6299f7a
line wrap: on
line source

diff -urEb dcmtk-DCMTK-3.6.8.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-DCMTK-3.6.8/CMake/GenerateDCMTKConfigure.cmake
--- dcmtk-DCMTK-3.6.8.orig/CMake/GenerateDCMTKConfigure.cmake	2024-01-09 17:13:10.329673608 +0100
+++ dcmtk-DCMTK-3.6.8/CMake/GenerateDCMTKConfigure.cmake	2024-01-09 18:21:52.568142681 +0100
@@ -224,6 +224,8 @@
 
 # Check the sizes of various types
 include (CheckTypeSize)
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+  # This doesn't work for wasm, Orthanc defines the macros manually
 CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
 CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
 CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
@@ -231,6 +233,7 @@
 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
 CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
 CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
+endif()
 
 # Check for include files, libraries, and functions
 include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-DCMTK-3.6.8/dcmdata/include/dcmtk/dcmdata/dcdict.h
--- dcmtk-DCMTK-3.6.8.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h	2024-01-09 17:13:10.337673529 +0100
+++ dcmtk-DCMTK-3.6.8/dcmdata/include/dcmtk/dcmdata/dcdict.h	2024-01-09 18:21:52.568142681 +0100
@@ -162,6 +162,12 @@
     /// returns an iterator to the end of the repeating tag dictionary
     DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
 
+    // Function by the Orthanc project to load a dictionary from a
+    // memory buffer, which is necessary in sandboxed
+    // environments. This is an adapted version of
+    // DcmDataDictionary::loadDictionary().
+    OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
+    
 private:
 
     /** private undefined assignment operator
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcdict.cc dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcdict.cc
--- dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcdict.cc	2024-01-09 17:13:10.337673529 +0100
+++ dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcdict.cc	2024-01-09 18:21:52.568142681 +0100
@@ -914,3 +914,5 @@
   wrlock().clear();
   wrunlock();
 }
+
+#include "dcdict_orthanc.cc"
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcpxitem.cc
--- dcmtk-DCMTK-3.6.8.orig/dcmdata/libsrc/dcpxitem.cc	2024-01-09 17:13:10.337673529 +0100
+++ dcmtk-DCMTK-3.6.8/dcmdata/libsrc/dcpxitem.cc	2024-01-09 18:21:52.568142681 +0100
@@ -31,6 +31,9 @@
 #include "dcmtk/dcmdata/dcostrma.h"    /* for class DcmOutputStream */
 #include "dcmtk/dcmdata/dcwcache.h"    /* for class DcmWriteCache */
 
+#undef max
+#include "dcmtk/ofstd/oflimits.h"
+
 
 // ********************************
 
diff -urEb dcmtk-DCMTK-3.6.8.orig/dcmnet/libsrc/scu.cc dcmtk-DCMTK-3.6.8/dcmnet/libsrc/scu.cc
--- dcmtk-DCMTK-3.6.8.orig/dcmnet/libsrc/scu.cc	2024-01-09 17:13:10.349673411 +0100
+++ dcmtk-DCMTK-3.6.8/dcmnet/libsrc/scu.cc	2024-01-09 18:23:08.723435667 +0100
@@ -19,6 +19,11 @@
  *
  */
 
+#if defined(_WIN32)
+#  define __STDC_LIMIT_MACROS   // Get access to UINT16_MAX
+#  include <stdint.h>
+#endif
+
 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
 
 #include "dcmtk/dcmdata/dcostrmf.h" /* for class DcmOutputFileStream */
diff -urEb dcmtk-DCMTK-3.6.8.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-DCMTK-3.6.8/oflog/include/dcmtk/oflog/thread/syncpub.h
--- dcmtk-DCMTK-3.6.8.orig/oflog/include/dcmtk/oflog/thread/syncpub.h	2024-01-09 17:13:10.389673016 +0100
+++ dcmtk-DCMTK-3.6.8/oflog/include/dcmtk/oflog/thread/syncpub.h	2024-01-09 18:21:52.568142681 +0100
@@ -63,7 +63,7 @@
 
 DCMTK_LOG4CPLUS_INLINE_EXPORT
 Mutex::Mutex (Mutex::Type t)
-    : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t) + 0))
+    : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
 { }
 
 
@@ -106,7 +106,7 @@
 DCMTK_LOG4CPLUS_INLINE_EXPORT
 Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
     unsigned DCMTK_LOG4CPLUS_THREADED (initial))
-    : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial) + 0))
+    : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
 { }
 
 
@@ -190,7 +190,7 @@
 
 DCMTK_LOG4CPLUS_INLINE_EXPORT
 ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
-    : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig) + 0))
+    : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
 { }
 
 
@@ -252,7 +252,7 @@
 
 DCMTK_LOG4CPLUS_INLINE_EXPORT
 SharedMutex::SharedMutex ()
-    : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex + 0))
+    : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
 { }
 
 
diff -urEb dcmtk-DCMTK-3.6.8.orig/oflog/libsrc/oflog.cc dcmtk-DCMTK-3.6.8/oflog/libsrc/oflog.cc
--- dcmtk-DCMTK-3.6.8.orig/oflog/libsrc/oflog.cc	2024-01-09 17:13:10.389673016 +0100
+++ dcmtk-DCMTK-3.6.8/oflog/libsrc/oflog.cc	2024-01-09 18:21:52.568142681 +0100
@@ -19,6 +19,11 @@
  *
  */
 
+
+#if defined(_WIN32)
+#  include <winsock2.h>
+#endif
+
 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
 #include "dcmtk/oflog/oflog.h"
 
diff -urEb dcmtk-DCMTK-3.6.8.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd/offile.h
--- dcmtk-DCMTK-3.6.8.orig/ofstd/include/dcmtk/ofstd/offile.h	2024-01-09 17:13:10.389673016 +0100
+++ dcmtk-DCMTK-3.6.8/ofstd/include/dcmtk/ofstd/offile.h	2024-01-09 18:21:52.568142681 +0100
@@ -570,7 +570,7 @@
    */
   void setlinebuf()
   {
-#if defined(_WIN32) || defined(__hpux)
+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
     this->setvbuf(NULL, _IOLBF, 0);
 #else
     :: setlinebuf(file_);