Étienne Mollier, on 2023-08-11:
> I have been devising on the orthanc test failure on big endian
> systems referenced in Debian Bug#1041813, and I came up with the
> patch in attachment.

The patch is in attachment for real this time.  (:
-- 
  .''`.  Étienne Mollier <emoll...@debian.org>
 : :' :  gpg: 8f91 b227 c7d6 f2b1 948c  8236 793c f67e 8f0d 11da
 `. `'   sent from /dev/pts/0, please excuse my verbosity
   `-    on air: The Neal Morse Band - Not Afraid Pt. 2
Description: swab Color16Pattern
 This patch creates new source data for big endian systems, fixing test
 failures on systems such as s390x.
Bug-Debian: https://bugs.debian.org/1041813
Author: Étienne Mollier <emoll...@debian.org>
Last-Update: 2023-08-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- orthanc.orig/OrthancFramework/UnitTestsSources/ImageTests.cpp
+++ orthanc/OrthancFramework/UnitTestsSources/ImageTests.cpp
@@ -91,6 +91,7 @@
   unsigned int pitch = width * 8;
 
   std::vector<uint8_t> image(height * pitch);
+#if ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ )
   for (unsigned int y = 0; y < height; y++)
   {
     uint8_t *p = &image[0] + y * pitch;
@@ -106,6 +107,23 @@
       p[7] = (y % 8 == 7) ? 255 : 0;
     }
   }
+#elif ( __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ )
+  for (unsigned int y = 0; y < height; y++)
+  {
+    uint8_t *p = &image[0] + y * pitch;
+    for (unsigned int x = 0; x < width; x++, p += 8)
+    {
+      p[0] = (y % 8 == 1) ? 255 : 0;
+      p[1] = (y % 8 == 0) ? 255 : 0;
+      p[2] = (y % 8 == 3) ? 255 : 0;
+      p[3] = (y % 8 == 2) ? 255 : 0;
+      p[4] = (y % 8 == 5) ? 255 : 0;
+      p[5] = (y % 8 == 4) ? 255 : 0;
+      p[6] = (y % 8 == 7) ? 255 : 0;
+      p[7] = (y % 8 == 6) ? 255 : 0;
+    }
+  }
+#endif /* __BYTE_ORDER__ */
 
   Orthanc::ImageAccessor accessor;
   accessor.AssignReadOnly(Orthanc::PixelFormat_RGBA64, width, height, pitch, &image[0]);

Attachment: signature.asc
Description: PGP signature

Reply via email to