changeset 6787:0ab9e0f34268

fix build if zlib is disabled
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 14 May 2026 10:31:17 +0200
parents e10d890319c5
children 91ed79f64b74
files OrthancFramework/Sources/DataSource/StorageAreaDataSource.cpp OrthancFramework/Sources/DataSource/StorageAreaDataSource.h
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DataSource/StorageAreaDataSource.cpp	Thu May 14 10:27:26 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/StorageAreaDataSource.cpp	Thu May 14 10:31:17 2026 +0200
@@ -25,12 +25,15 @@
 #include "../PrecompiledHeaders.h"
 #include "StorageAreaDataSource.h"
 
-#include "../Compression/ZlibCompressor.h"
 #include "../OrthancException.h"
 #include "../StringMemoryBuffer.h"
 #include "../Toolbox.h"
 #include "DataSourceReader.h"
 
+#if ORTHANC_ENABLE_ZLIB == 1
+#  include "../Compression/ZlibCompressor.h"
+#endif
+
 #include <boost/lexical_cast.hpp>
 #include <cassert>
 
@@ -203,6 +206,7 @@
 
         case CompressionType_ZlibWithSize:
         {
+#if ORTHANC_ENABLE_ZLIB == 1
           ZlibCompressor zlib;
 
           std::string content;
@@ -221,6 +225,9 @@
 
           boost::shared_ptr<Value> value(new Value(StringMemoryBuffer::CreateFromSwap(content)));
           return new Range(value);
+#else
+          throw OrthancException(ErrorCode_InternalError, "Support for zlib is disabled, cannot uncompress attachment");
+#endif
         }
 
         default:
--- a/OrthancFramework/Sources/DataSource/StorageAreaDataSource.h	Thu May 14 10:27:26 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/StorageAreaDataSource.h	Thu May 14 10:31:17 2026 +0200
@@ -24,6 +24,10 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_ZLIB)
+#  error The macro ORTHANC_ENABLE_ZLIB must be defined
+#endif
+
 #include "../Compatibility.h"
 #include "../FileStorage/FileInfo.h"
 #include "../FileStorage/IStorageArea.h"