[master] Reverted png_get_uint_16 macro to beta05 and added a

comment about the potential API incompatibility.
This commit is contained in:
Glenn Randers-Pehrson 2010-11-24 15:08:39 -06:00
parent ff244b6181
commit e2d740ae04
3 changed files with 19 additions and 11 deletions

View File

@ -71,6 +71,8 @@ version 1.4.5beta06 [November 21, 2010]
compression both fail to declare their input buffers with 'const'. compression both fail to declare their input buffers with 'const'.
version 1.4.5beta07 [November 24, 2010] 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 Send comments/corrections/commendations to glennrp at users.sourceforge.net
or to png-mng-implement at lists.sf.net (subscription required; visit or to png-mng-implement at lists.sf.net (subscription required; visit

View File

@ -2723,6 +2723,8 @@ version 1.4.5beta06 [November 21, 2010]
compression both fail to declare their input buffers with 'const'. compression both fail to declare their input buffers with 'const'.
version 1.4.5beta07 [November 24, 2010] 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 Send comments/corrections/commendations to glennrp at users.sourceforge.net
or to png-mng-implement at lists.sf.net (subscription required; visit or to png-mng-implement at lists.sf.net (subscription required; visit

18
png.h
View File

@ -2649,17 +2649,21 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name)
((png_uint_32)(*((buf) + 1)) << 16) + \ ((png_uint_32)(*((buf) + 1)) << 16) + \
((png_uint_32)(*((buf) + 2)) << 8) + \ ((png_uint_32)(*((buf) + 2)) << 8) + \
((png_uint_32)(*((buf) + 3)))) ((png_uint_32)(*((buf) + 3))))
# ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED /* Undefined in 1.4.x by default. */
/* 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) \ # define png_get_uint_16(buf) \
((png_uint_16) \ ((png_uint_16) \
(((unsigned int)(*(buf)) << 8) + \ (((unsigned int)(*(buf)) << 8) + \
((unsigned int)(*((buf) + 1))))) ((unsigned int)(*((buf) + 1)))))
# else
# define png_get_uint_16(buf) \
((png_uint_32) \
(((unsigned int)(*(buf)) << 8) + \
((unsigned int)(*((buf) + 1)))))
# endif
# define png_get_int_32(buf) \ # define png_get_int_32(buf) \
((png_int_32)((*(buf) & 0x80) \ ((png_int_32)((*(buf) & 0x80) \
? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \