changeset 7080:2663f94c5fc3 streaming

fix compatibility with old windows sdk
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Aug 2026 15:14:35 +0200
parents dcf1dc9e455a
children 8b31c97470a5
files OrthancFramework/Sources/DataSource/DicomSequentialReader.cpp OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp OrthancFramework/UnitTestsSources/SharedLibraryUnitTests.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 5 files changed, 31 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DataSource/DicomSequentialReader.cpp	Wed Aug 12 14:38:58 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DicomSequentialReader.cpp	Wed Aug 12 15:14:35 2026 +0200
@@ -35,6 +35,8 @@
 #include "StorageAreaDataSource.h"
 #include "TranscoderDataSource.h"
 
+#include <dcmtk/dcmdata/dcfilefo.h>
+
 
 namespace Orthanc
 {
--- a/OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp	Wed Aug 12 14:38:58 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.cpp	Wed Aug 12 15:14:35 2026 +0200
@@ -28,6 +28,9 @@
 #include "../Logging.h"
 #include "../OrthancException.h"
 
+#include <dcmtk/dcmdata/dcfilefo.h>
+
+
 namespace Orthanc
 {
   static boost::posix_time::ptime GetNow()
--- a/OrthancFramework/UnitTestsSources/SharedLibraryUnitTests.cpp	Wed Aug 12 14:38:58 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/SharedLibraryUnitTests.cpp	Wed Aug 12 15:14:35 2026 +0200
@@ -41,6 +41,7 @@
 {
   Orthanc::InitializeFramework("", true);
   
+  Orthanc::Logging::SetCurrentThreadName("MAIN");
   Orthanc::Logging::EnableInfoLevel(true);
   Orthanc::Toolbox::DetectEndianness();
   Orthanc::SystemToolbox::MakeDirectory(Orthanc::SystemToolbox::PathFromUtf8("UnitTestsResults"));
--- a/OrthancServer/Sources/ServerContext.cpp	Wed Aug 12 14:38:58 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Wed Aug 12 15:14:35 2026 +0200
@@ -151,13 +151,13 @@
   }
 
 
-  void ServerContext::CreateFile(FileInfo& info,
-                                 const void* data,
-                                 size_t size,
-                                 FileContentType type,
-                                 CompressionType compression,
-                                 const std::string& precomputedMd5,
-                                 const DicomInstanceToStore* instance)
+  void ServerContext::StoreFile(FileInfo& info,
+                                const void* data,
+                                size_t size,
+                                FileContentType type,
+                                CompressionType compression,
+                                const std::string& precomputedMd5,
+                                const DicomInstanceToStore* instance)
   {
     assert(metricsRegistry_.get() != NULL);
     const std::string uuid = Toolbox::GenerateUuid();
@@ -980,7 +980,7 @@
     /**
      * Note that it is not necessary to explicitly invalidate the
      * cache after the removal of an attachment, as each attachment
-     * receives a unique UUID in ServerContext::CreateFile(), even if
+     * receives a unique UUID in ServerContext::StoreFile(), even if
      * the DICOM instance is overwritten. The key of the removed
      * attachment will thus never be seen again as new files are added.
      **/
@@ -1151,8 +1151,8 @@
 
       if (!isAdoption)
       {
-        CreateFile(dicomInfo, dicom.GetBufferData(), dicom.GetBufferSize(),
-                   FileContentType_Dicom, compression, dicomMd5, &dicom);
+        StoreFile(dicomInfo, dicom.GetBufferData(), dicom.GetBufferSize(),
+                  FileContentType_Dicom, compression, dicomMd5, &dicom);
 
         attachments.push_back(dicomInfo);
       }
@@ -1166,8 +1166,8 @@
           (!area_.HasEfficientReadRange() ||
            compressionEnabled_))
       {
-        CreateFile(dicomUntilPixelData, dicom.GetBufferData(), pixelDataOffset, FileContentType_DicomUntilPixelData,
-                   compression, "" /* MD5 will be computed if needed */, NULL);
+        StoreFile(dicomUntilPixelData, dicom.GetBufferData(), pixelDataOffset, FileContentType_DicomUntilPixelData,
+                  compression, "" /* MD5 will be computed if needed */, NULL);
 
         attachments.push_back(dicomUntilPixelData);
       }
@@ -1501,8 +1501,8 @@
     {
       std::unique_ptr<StorageAreaDataSource::Range> range(ReadAttachment(attachment, true /* uncompress */));
 
-      CreateFile(modified, range->GetData(), range->GetSize(), attachmentType, compression,
-                 "" /* MD5 will be computed if needed */, NULL);
+      StoreFile(modified, range->GetData(), range->GetSize(), attachmentType, compression,
+                "" /* MD5 will be computed if needed */, NULL);
     }
 
     try
@@ -1892,7 +1892,7 @@
     assert(attachmentType != FileContentType_Dicom && attachmentType != FileContentType_DicomUntilPixelData); // this method can not be used to store instances
 
     FileInfo attachment;
-    CreateFile(attachment, data, size, attachmentType, compression, "" /* MD5 will be computed if needed */, NULL);
+    StoreFile(attachment, data, size, attachmentType, compression, "" /* MD5 will be computed if needed */, NULL);
 
     try
     {
--- a/OrthancServer/Sources/ServerContext.h	Wed Aug 12 14:38:58 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Wed Aug 12 15:14:35 2026 +0200
@@ -281,14 +281,16 @@
 
     void RemoveFile(const FileInfo& attachment);
 
-    // This method corresponds to StorageAccessor::Write() in Orthanc <= 1.12.11
-    void CreateFile(FileInfo& info,
-                    const void* data,
-                    size_t size,
-                    FileContentType type,
-                    CompressionType compression,
-                    const std::string& precomputedMd5,
-                    const DicomInstanceToStore* instance);
+    // This method corresponds to StorageAccessor::Write() in Orthanc
+    // <= 1.12.11. Don't name this method "CreateFile()", otherwise it
+    // could be renamed "CreateFileA()" by Microsoft Windows SDK macros.
+    void StoreFile(FileInfo& info,
+                   const void* data,
+                   size_t size,
+                   FileContentType type,
+                   CompressionType compression,
+                   const std::string& precomputedMd5,
+                   const DicomInstanceToStore* instance);
 
     // This DicomModification object is intended to be used as a
     // "rules engine" when de-identifying logs for C-Find, C-Get, and