Skip to content

Commit ab21cf7

Browse files
barracuda156sdottaka
authored andcommitted
Fix the build for Big-endian platforms (#17)
* PluginBMP: fix for Big-endian * PluginDDS: fix for Big-endian * ImfFastHuf: backport fix from upstream for 32-bit
1 parent 283fe97 commit ab21cf7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Source/FreeImage/PluginDDS.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,14 @@ SwapHeader(DDSHEADER *header) {
356356
for(int i=0; i<11; i++) {
357357
SwapLong(&header->surfaceDesc.dwReserved1[i]);
358358
}
359+
SwapLong(&header->surfaceDesc.ddspf.dwSize);
360+
SwapLong(&header->surfaceDesc.ddspf.dwFlags);
361+
SwapLong(&header->surfaceDesc.ddspf.dwFourCC);
362+
SwapLong(&header->surfaceDesc.ddspf.dwRGBBitCount);
363+
SwapLong(&header->surfaceDesc.ddspf.dwRBitMask);
364+
SwapLong(&header->surfaceDesc.ddspf.dwGBitMask);
365+
SwapLong(&header->surfaceDesc.ddspf.dwBBitMask);
366+
SwapLong(&header->surfaceDesc.ddspf.dwRGBAlphaBitMask);
359367
SwapLong(&header->surfaceDesc.ddsCaps.dwCaps1);
360368
SwapLong(&header->surfaceDesc.ddsCaps.dwCaps2);
361369
SwapLong(&header->surfaceDesc.ddsCaps.dwReserved[0]);

Source/OpenEXR/IlmImf/ImfFastHuf.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ FastHufDecoder::FastHufDecoder
107107
for (int i = 0; i <= MAX_CODE_LEN; ++i)
108108
{
109109
codeCount[i] = 0;
110-
base[i] = 0xffffffffffffffffL;
110+
base[i] = 0xffffffffffffffffULL;
111111
offset[i] = 0;
112112
}
113113

@@ -352,7 +352,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
352352

353353
for (int i = 0; i <= MAX_CODE_LEN; ++i)
354354
{
355-
if (base[i] != 0xffffffffffffffffL)
355+
if (base[i] != 0xffffffffffffffffULL)
356356
{
357357
_ljBase[i] = base[i] << (64 - i);
358358
}
@@ -362,7 +362,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
362362
// Unused code length - insert dummy values
363363
//
364364

365-
_ljBase[i] = 0xffffffffffffffffL;
365+
_ljBase[i] = 0xffffffffffffffffULL;
366366
}
367367
}
368368

@@ -417,7 +417,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
417417

418418
int minIdx = TABLE_LOOKUP_BITS;
419419

420-
while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffL)
420+
while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffULL)
421421
minIdx--;
422422

423423
if (minIdx < 0)
@@ -427,7 +427,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
427427
// Set the min value such that the table is never tested.
428428
//
429429

430-
_tableMin = 0xffffffffffffffffL;
430+
_tableMin = 0xffffffffffffffffULL;
431431
}
432432
else
433433
{

0 commit comments

Comments
 (0)