diff --git a/ANNOUNCE b/ANNOUNCE index 7ebf2abed..a8a3ee258 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -71,6 +71,8 @@ version 1.4.5beta06 [November 21, 2010] compression both fail to declare their input buffers with 'const'. version 1.4.5beta07 [November 24, 2010] + Reverted png_get_uint_16 macro to beta05 and added comment about the + potential API incompatibility. Send comments/corrections/commendations to glennrp at users.sourceforge.net or to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 02144eacc..f0348c079 100644 --- a/CHANGES +++ b/CHANGES @@ -2723,6 +2723,8 @@ version 1.4.5beta06 [November 21, 2010] compression both fail to declare their input buffers with 'const'. version 1.4.5beta07 [November 24, 2010] + Reverted png_get_uint_16 macro to beta05 and added comment about the + potential API incompatibility. Send comments/corrections/commendations to glennrp at users.sourceforge.net or to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/png.h b/png.h index 79081f30f..772f8906e 100644 --- a/png.h +++ b/png.h @@ -2649,17 +2649,21 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name) ((png_uint_32)(*((buf) + 1)) << 16) + \ ((png_uint_32)(*((buf) + 2)) << 8) + \ ((png_uint_32)(*((buf) + 3)))) -# ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED /* Undefined in 1.4.x by default. */ -# define png_get_uint_16(buf) \ - ((png_uint_16) \ - (((unsigned int)(*(buf)) << 8) + \ - ((unsigned int)(*((buf) + 1))))) -# else -# define png_get_uint_16(buf) \ - ((png_uint_32) \ - (((unsigned int)(*(buf)) << 8) + \ - ((unsigned int)(*((buf) + 1))))) -# endif + + /* The following definition introduces an API incompatibility (but not + * an ABI incompatibility) with libpng-1.4.0 through 1.4.4. Prior to + * libpng-1.4.5 the macro, which is used by default, returned (incorrectly) + * a (png_uint_32), while the function, if used instead, correctly returned + * a (png_uint_16). + * + * Libpng versions 1.0.x and 1.2.x only used a function so are not affected + * by this potential API incompatibility between macros. + */ +# define png_get_uint_16(buf) \ + ((png_uint_16) \ + (((unsigned int)(*(buf)) << 8) + \ + ((unsigned int)(*((buf) + 1))))) + # define png_get_int_32(buf) \ ((png_int_32)((*(buf) & 0x80) \ ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \