You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/media-libs/openexr/files/openexr-2.3.0-bigendian.patch

72 lines
2.2 KiB

Description: Fix test-suite on some big-endian archs
Author: Dennis Gilmore <dennis@ausil.us>
Bug-Debian: https://bugs.debian.org/793040
Origin: vendor, https://github.com/openexr/openexr/issues/81
Reviewed-by: Mathieu Malaterre <malat@debian.org>
Index: openexr/IlmImfTest/testFutureProofing.cpp
===================================================================
--- openexr.orig/IlmImfTest/testFutureProofing.cpp
+++ openexr/IlmImfTest/testFutureProofing.cpp
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <byteswap.h>
#include "tmpDir.h"
#include "testFutureProofing.h"
@@ -64,6 +65,7 @@
#include <ImfNamespace.h>
#include <ImathNamespace.h>
#include <IlmThreadNamespace.h>
+#include <ImfSystemSpecific.h>
namespace IMF = OPENEXR_IMF_NAMESPACE;
using namespace IMF;
@@ -1234,6 +1236,12 @@ modifyType (bool modify_version)
//length of attribute
fread(&length,4,1,f);
+ if (!GLOBAL_SYSTEM_LITTLE_ENDIAN)
+ {
+ int tmp = bswap_32(length);
+ length = tmp;
+ }
+
if(!modify_version && attrib_name=="type")
{
// modify the type of part 1 to be 'X<whatevever>'
Index: openexr/IlmImfTest/testMultiPartFileMixingBasic.cpp
===================================================================
--- openexr.orig/IlmImfTest/testMultiPartFileMixingBasic.cpp
+++ openexr/IlmImfTest/testMultiPartFileMixingBasic.cpp
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <byteswap.h>
#include "tmpDir.h"
#include "testMultiPartFileMixingBasic.h"
@@ -59,6 +60,7 @@
#include <ImfDeepScanLineInputPart.h>
#include <ImfPartType.h>
#include <ImfMisc.h>
+#include <ImfSystemSpecific.h>
namespace IMF = OPENEXR_IMF_NAMESPACE;
using namespace IMF;
@@ -1383,6 +1385,11 @@ killOffsetTables (const std::string & fn
//length of attribute
fread(&length,4,1,f);
+ if (!GLOBAL_SYSTEM_LITTLE_ENDIAN)
+ {
+ int tmp = bswap_32(length);
+ length = tmp;
+ }
//value of attribute
for(int i=0;i<length;i++)