[trunk] Update big endian handling no such thing as WORDS_BIGENDIAN (prefer OPJ_BIG_ENDIAN)

Update issue 302
This commit is contained in:
Mathieu Malaterre 2014-03-18 14:37:33 +00:00
parent 79d18f7fd0
commit ae49fd1aa9
2 changed files with 6 additions and 6 deletions

View File

@ -94,7 +94,7 @@ struct tga_header
static unsigned short get_ushort(unsigned short val) { static unsigned short get_ushort(unsigned short val) {
#ifdef WORDS_BIGENDIAN #ifdef OPJ_BIG_ENDIAN
return( ((val & 0xff) << 8) + (val >> 8) ); return( ((val & 0xff) << 8) + (val >> 8) );
#else #else
return( val ); return( val );
@ -181,7 +181,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
return 1; return 1;
} }
#if WORDS_BIGENDIAN == 1 #ifdef OPJ_BIG_ENDIAN
static INLINE int16_t swap16(int16_t x) static INLINE int16_t swap16(int16_t x)
{ {
@ -228,7 +228,7 @@ static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
image_w = (unsigned short)width; image_w = (unsigned short)width;
image_h = (unsigned short) height; image_h = (unsigned short) height;
#if WORDS_BIGENDIAN == 0 #ifndef OPJ_BIG_ENDIAN
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails; if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails; if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
#else #else

View File

@ -94,7 +94,7 @@ struct tga_header
static unsigned short get_ushort(unsigned short val) { static unsigned short get_ushort(unsigned short val) {
#ifdef WORDS_BIGENDIAN #ifdef OPJ_BIG_ENDIAN
return( ((val & 0xff) << 8) + (val >> 8) ); return( ((val & 0xff) << 8) + (val >> 8) );
#else #else
return( val ); return( val );
@ -179,7 +179,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
return 1; return 1;
} }
#if WORDS_BIGENDIAN == 1 #ifdef OPJ_BIG_ENDIAN
static inline int16_t swap16(int16_t x) static inline int16_t swap16(int16_t x)
{ {
@ -226,7 +226,7 @@ static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
image_w = (unsigned short)width; image_w = (unsigned short)width;
image_h = (unsigned short) height; image_h = (unsigned short) height;
#if WORDS_BIGENDIAN == 0 #ifndef OPJ_BIG_ENDIAN
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails; if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails; if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
#else #else