Source: freeimage
Severity: normal
Tags: patch
User: debian-powe...@lists.debian.org
Usertags: powerpc ppc64
X-Debbugs-Cc: debian-powe...@lists.debian.org

Hi!

freeimage FTBFS on big-endian PowerPC systems [1][2].

I have created the attached patch which fixes the problem for me.

Could you include it in the next upload?

Thanks,
Adrian

> [1] 
> https://buildd.debian.org/status/fetch.php?pkg=freeimage&arch=powerpc&ver=3.18.0%2Bds2-6&stamp=1640435634&raw=0
> [2] 
> https://buildd.debian.org/status/fetch.php?pkg=freeimage&arch=ppc64&ver=3.18.0%2Bds2-6&stamp=1640435569&raw=0

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Description: Fix FTBFS on big-endian targets
Origin: -
Author: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de>
Bug-Debian: -
Last-update: 2021-12-25
--- freeimage-3.18.0+ds2.orig/Source/FreeImage/PluginBMP.cpp
+++ freeimage-3.18.0+ds2/Source/FreeImage/PluginBMP.cpp
@@ -1419,7 +1419,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_
 
                        free(buffer);
 #ifdef FREEIMAGE_BIGENDIAN
-               } else if (bpp == 16) {
+               } else if (dst_bpp == 16) {
                        int padding = dst_pitch - dst_width * sizeof(WORD);
                        WORD pad = 0;
                        WORD pixel;
@@ -1440,7 +1440,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_
                        }
 #endif
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-               } else if (bpp == 24) {
+               } else if (dst_bpp == 24) {
                        int padding = dst_pitch - dst_width * sizeof(FILE_BGR);
                        DWORD pad = 0;
                        FILE_BGR bgr;
@@ -1461,7 +1461,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_
                                        }
                                }
                        }
-               } else if (bpp == 32) {
+               } else if (dst_bpp == 32) {
                        FILE_BGRA bgra;
                        for(unsigned y = 0; y < dst_height; y++) {
                                BYTE *line = FreeImage_GetScanLine(dib, y);
--- freeimage-3.18.0+ds2.orig/Source/FreeImage/PluginDDS.cpp
+++ freeimage-3.18.0+ds2/Source/FreeImage/PluginDDS.cpp
@@ -356,14 +356,14 @@ SwapHeader(DDSHEADER *header) {
        for(int i=0; i<11; i++) {
                SwapLong(&header->surfaceDesc.dwReserved1[i]);
        }
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwSize);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFlags);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFourCC);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBBitCount);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRBitMask);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwGBitMask);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwBBitMask);
-       SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask);
+       SwapLong(&header->surfaceDesc.ddspf.dwSize);
+       SwapLong(&header->surfaceDesc.ddspf.dwFlags);
+       SwapLong(&header->surfaceDesc.ddspf.dwFourCC);
+       SwapLong(&header->surfaceDesc.ddspf.dwRGBBitCount);
+       SwapLong(&header->surfaceDesc.ddspf.dwRBitMask);
+       SwapLong(&header->surfaceDesc.ddspf.dwGBitMask);
+       SwapLong(&header->surfaceDesc.ddspf.dwBBitMask);
+       SwapLong(&header->surfaceDesc.ddspf.dwRGBAlphaBitMask);
        SwapLong(&header->surfaceDesc.ddsCaps.dwCaps1);
        SwapLong(&header->surfaceDesc.ddsCaps.dwCaps2);
        SwapLong(&header->surfaceDesc.ddsCaps.dwReserved[0]);

Reply via email to