Description: Fix build on big-endian architectures
Author: Sebastien Jodogne <s.jodogne@orthanc-labs.com>
Forwarded: yes
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: Orthanc-1.9.0/OrthancFramework/Sources/Compression/ZlibCompressor.cpp
===================================================================
--- Orthanc-1.9.0.orig/OrthancFramework/Sources/Compression/ZlibCompressor.cpp
+++ Orthanc-1.9.0/OrthancFramework/Sources/Compression/ZlibCompressor.cpp
@@ -123,6 +123,9 @@ namespace Orthanc
 
     uint64_t uncompressedSize = ReadUncompressedSizePrefix(compressed, compressedSize);
     
+    // New in Orthanc 1.9.0: Explicitly use litte-endian encoding in size prefix
+    uncompressedSize = le64toh(uncompressedSize);
+
     try
     {
       uncompressed.resize(static_cast<size_t>(uncompressedSize));
@@ -132,9 +135,6 @@ namespace Orthanc
       throw OrthancException(ErrorCode_NotEnoughMemory);
     }
 
-    // New in Orthanc 1.9.0: Explicitly use litte-endian encoding in size prefix
-    uncompressedSize = le64toh(uncompressedSize);
-
     uLongf tmp = static_cast<uLongf>(uncompressedSize);
     int error = uncompress
       (reinterpret_cast<uint8_t*>(&uncompressed[0]), 
