From: DRC Date: Thu, 4 Sep 2014 17:35:22 +0000 (+0000) Subject: When building libjpeg-turbo on Un*x systems, INT32 is usually typedef'ed to long... X-Git-Tag: 1.4.0~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bbd9b7117192e590b5fdec1aa0a8f0b11244a4cc;p=libjpeg-turbo When building libjpeg-turbo on Un*x systems, INT32 is usually typedef'ed to long, not int, so we need to specify an int pointer when doing a 4-byte write to the RGB565 output buffer. On little endian systems, this doesn't matter, but when you write a 32-bit int to a 64-bit long pointer address on a big endian system, you are writing to the upper 4 bytes, not the lower 4 bytes. NOTE: this will probably break on big endian systems that use 16-bit ints (are there any of those still around?) This patch also removes an unneeded macro from jdmerge.c. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1403 632fc199-4ca6-4c93-a231-07263d6284db --- diff --git a/jdcolor.c b/jdcolor.c index 272e855..779fa51 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -559,7 +559,7 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, #define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3) -#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(INT32 *)(addr)) = pixels) +#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(int *)(addr)) = pixels) #define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF)) #define DITHER_565_G(g, dither) ((g) + (((dither) & 0xFF) >> 1)) diff --git a/jdmerge.c b/jdmerge.c index 77e93ad..e13adb9 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -443,8 +443,6 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, ((INT16*)(addr))[0] = (pixels) >> 16; \ } -#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(INT32 *)(addr)) = pixels) - #define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF)) #define DITHER_565_G(g, dither) ((g) + (((dither) & 0xFF) >> 1)) #define DITHER_565_B(b, dither) ((b) + ((dither) & 0xFF))