diff -r e5a433743592 src/grfcodec.cpp --- a/src/grfcodec.cpp Sat Aug 14 21:47:14 2010 +0200 +++ b/src/grfcodec.cpp Wed Sep 08 15:50:52 2010 +0200 @@ -784,7 +784,7 @@ palette = readpal(optarg); break; case 'c': - #ifdef __BIG_ENDIAN__ + #if __BYTE_ORDER == __BIG_ENDIAN printf("Cropping not supported on big endian architectures.\n"); exit(1); #endif diff -r e5a433743592 src/pcxfile.cpp --- a/src/pcxfile.cpp Sat Aug 14 21:47:14 2010 +0200 +++ b/src/pcxfile.cpp Wed Sep 08 15:50:52 2010 +0200 @@ -478,7 +478,7 @@ putcolourmap = map; } -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER == __BIG_ENDIAN void pcxfile::be_swapheader(pcxheader& header) { header.window[0] = BE_SWAP16(header.window[0]); diff -r e5a433743592 src/pcxsprit.cpp --- a/src/pcxsprit.cpp Sat Aug 14 21:47:14 2010 +0200 +++ b/src/pcxsprit.cpp Wed Sep 08 15:50:52 2010 +0200 @@ -208,7 +208,7 @@ header.window[3] = totaly - 1; header.screen[1] = totaly - 1; - #ifdef __BIG_ENDIAN__ + #if __BYTE_ORDER == __BIG_ENDIAN pcxheader le_header = header; be_swapheader(le_header); #else diff -r e5a433743592 src/typesize.h --- a/src/typesize.h Sat Aug 14 21:47:14 2010 +0200 +++ b/src/typesize.h Wed Sep 08 15:50:52 2010 +0200 @@ -148,7 +148,8 @@ S8 s8[4]; }; -#ifdef __BIG_ENDIAN__ +#include <endian.h> +#if __BYTE_ORDER == __BIG_ENDIAN # define BE_SWAP16(b) (*((U8*)(&b))+(*(((U8*)(&b))+1)<<8)) # define BE_SWAP32(b) (*((U8*)(&b))+(*(((U8*)(&b))+1)<<8)+(*(((U8*)(&b))+2)<<16)+(*(((U8*)(&b))+3)<<24)) # define BYTE_OFSL 1
Seems like grfcodec used __BIG_ENDIAN__ in other places as well. The
attached patch removes all traces of __BIG_ENDIAN__ in the same way as
the first patch. However, it still needs to be tested on s390 to be sure
this fixes all problems.
- Bug#596056: grfcodec: unusable on big-endian architectures where ... Rubidium
- Bug#596056: Acknowledgement (grfcodec: unusable on big-endia... Rubidium