1diff -urEb dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake 2--- dcmtk-3.6.6.orig/CMake/GenerateDCMTKConfigure.cmake 2021-01-26 08:51:48.815071681 +0100 3+++ dcmtk-3.6.6/CMake/GenerateDCMTKConfigure.cmake 2021-01-26 08:52:06.331135995 +0100 4@@ -169,6 +169,8 @@ 5 endif() 6 7 # Check the sizes of various types 8+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") 9+ # This doesn't work for wasm, Orthanc defines the macros manually 10 include (CheckTypeSize) 11 CHECK_TYPE_SIZE("char" SIZEOF_CHAR) 12 CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE) 13@@ -177,6 +179,7 @@ 14 CHECK_TYPE_SIZE("long" SIZEOF_LONG) 15 CHECK_TYPE_SIZE("short" SIZEOF_SHORT) 16 CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P) 17+endif() 18 19 # Check for include files, libraries, and functions 20 include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake") 21diff -urEb dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h 22--- dcmtk-3.6.6.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2021-01-26 08:51:48.859071844 +0100 23+++ dcmtk-3.6.6/dcmdata/include/dcmtk/dcmdata/dcdict.h 2021-01-26 08:52:06.331135995 +0100 24@@ -152,6 +152,12 @@ 25 /// returns an iterator to the end of the repeating tag dictionary 26 DcmDictEntryListIterator repeatingEnd() { return repDict.end(); } 27 28+ // Function by the Orthanc project to load a dictionary from a 29+ // memory buffer, which is necessary in sandboxed 30+ // environments. This is an adapted version of 31+ // DcmDataDictionary::loadDictionary(). 32+ OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue); 33+ 34 private: 35 36 /** private undefined assignment operator 37diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcdicdir.cc dcmtk-3.6.6/dcmdata/libsrc/dcdicdir.cc 38--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdicdir.cc 2021-01-26 08:51:48.863071859 +0100 39+++ dcmtk-3.6.6/dcmdata/libsrc/dcdicdir.cc 2021-01-26 08:56:03.519887982 +0100 40@@ -1032,7 +1032,14 @@ 41 // insert Media Stored SOP Class UID 42 insertMediaSOPUID(metainfo); 43 44- getDirFileFormat().validateMetaInfo(outxfer); 45+ /** 46+ * Patch for Orthanc: In DCMTK 3.6.6, the default value for the 47+ * second argument changed from "EWM_fileformat" to 48+ * "EWM_createNewMeta". This sets "MediaStorageSOPClassUID" 49+ * (0002,0002) in meta-header to "1.2.276.0.7230010.3.1.0.1" 50+ * instead of expected "1.2.840.10008.1.3.10". 51+ **/ 52+ getDirFileFormat().validateMetaInfo(outxfer, EWM_fileformat); 53 54 { 55 // it is important that the cache object is destroyed before the file is renamed! 56diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc 57--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcdict.cc 2021-01-26 08:51:48.863071859 +0100 58+++ dcmtk-3.6.6/dcmdata/libsrc/dcdict.cc 2021-01-26 08:52:06.331135995 +0100 59@@ -900,3 +900,6 @@ 60 wrlock().clear(); 61 wrunlock(); 62 } 63+ 64+ 65+#include "dcdict_orthanc.cc" 66diff -urEb dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc 67--- dcmtk-3.6.6.orig/dcmdata/libsrc/dcpxitem.cc 2021-01-26 08:51:48.863071859 +0100 68+++ dcmtk-3.6.6/dcmdata/libsrc/dcpxitem.cc 2021-01-26 08:52:06.335136010 +0100 69@@ -36,6 +36,9 @@ 70 #include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */ 71 #include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */ 72 73+#undef max 74+#include "dcmtk/ofstd/oflimits.h" 75+ 76 77 // ******************************** 78 79diff -urEb dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h 80--- dcmtk-3.6.6.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2021-01-26 08:51:48.847071800 +0100 81+++ dcmtk-3.6.6/oflog/include/dcmtk/oflog/thread/syncpub.h 2021-01-26 08:52:06.335136010 +0100 82@@ -63,7 +63,7 @@ 83 84 DCMTK_LOG4CPLUS_INLINE_EXPORT 85 Mutex::Mutex (Mutex::Type t) 86- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0) 87+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t))) 88 { } 89 90 91@@ -106,7 +106,7 @@ 92 DCMTK_LOG4CPLUS_INLINE_EXPORT 93 Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max), 94 unsigned DCMTK_LOG4CPLUS_THREADED (initial)) 95- : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)) + 0) 96+ : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial))) 97 { } 98 99 100@@ -148,7 +148,7 @@ 101 102 DCMTK_LOG4CPLUS_INLINE_EXPORT 103 FairMutex::FairMutex () 104- : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex) + 0) 105+ : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::FairMutex)) 106 { } 107 108 109@@ -190,7 +190,7 @@ 110 111 DCMTK_LOG4CPLUS_INLINE_EXPORT 112 ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig)) 113- : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)) + 0) 114+ : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig))) 115 { } 116 117 118@@ -252,7 +252,7 @@ 119 120 DCMTK_LOG4CPLUS_INLINE_EXPORT 121 SharedMutex::SharedMutex () 122- : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex) + 0) 123+ : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex)) 124 { } 125 126 127diff -urEb dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc dcmtk-3.6.6/oflog/libsrc/oflog.cc 128--- dcmtk-3.6.6.orig/oflog/libsrc/oflog.cc 2021-01-26 08:51:48.847071800 +0100 129+++ dcmtk-3.6.6/oflog/libsrc/oflog.cc 2021-01-26 08:52:06.335136010 +0100 130@@ -19,6 +19,10 @@ 131 * 132 */ 133 134+#if defined(_WIN32) 135+# include <winsock2.h> 136+#endif 137+ 138 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 139 #include "dcmtk/oflog/oflog.h" 140 141diff -urEb dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h 142--- dcmtk-3.6.6.orig/ofstd/include/dcmtk/ofstd/offile.h 2021-01-26 08:51:48.863071859 +0100 143+++ dcmtk-3.6.6/ofstd/include/dcmtk/ofstd/offile.h 2021-01-26 08:52:06.335136010 +0100 144@@ -586,7 +586,7 @@ 145 */ 146 void setlinebuf() 147 { 148-#if defined(_WIN32) || defined(__hpux) 149+#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__) 150 this->setvbuf(NULL, _IOLBF, 0); 151 #else 152 :: setlinebuf(file_); 153