[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: freeimage: Please add patch to fix FTBFS on some big-endian targets



Control: tags +upstream

Hello!

On 12/25/21 14:05, John Paul Adrian Glaubitz wrote:
> I have created the attached patch which fixes the problem for me.

FWIW, upstream has its own version of the patch, too [1].

I would therefore suggest applying their version of the patch.

Adrian

> [1] https://sourceforge.net/p/freeimage/svn/1809/

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Index: Source/FreeImage/PluginBMP.cpp
===================================================================
--- Source/FreeImage/PluginBMP.cpp	(revision 1808)
+++ Source/FreeImage/PluginBMP.cpp	(revision 1809)
@@ -518,7 +518,7 @@
 				io->read_proc(FreeImage_GetPalette(dib), used_colors * sizeof(RGBQUAD), 1, handle);
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
 				RGBQUAD *pal = FreeImage_GetPalette(dib);
-				for(int i = 0; i < used_colors; i++) {
+				for(unsigned i = 0; i < used_colors; i++) {
 					INPLACESWAP(pal[i].rgbRed, pal[i].rgbBlue);
 				}
 #endif
@@ -1419,7 +1419,7 @@
 
 			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 @@
 			}
 #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 @@
 					}
 				}
 			}
-		} 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);
Index: Source/FreeImage/PluginDDS.cpp
===================================================================
--- Source/FreeImage/PluginDDS.cpp	(revision 1808)
+++ Source/FreeImage/PluginDDS.cpp	(revision 1809)
@@ -356,14 +356,6 @@
 	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.ddsCaps.dwCaps1);
 	SwapLong(&header->surfaceDesc.ddsCaps.dwCaps2);
 	SwapLong(&header->surfaceDesc.ddsCaps.dwReserved[0]);

Reply to: