diff --git a/ANNOUNCE b/ANNOUNCE index 10c97382f..6c2df51d2 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.4.4beta04 - July 24, 2010 +Libpng 1.4.4beta04 - July 31, 2010 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -46,7 +46,8 @@ version 1.4.4beta03 [July 24, 2010] Eliminated the new special case typedef of png_longjmp_ptr for WATCOM and made a special case "#define PNGAPI" in pngconf.h instead. -version 1.4.4beta04 [July 24, 2010] +version 1.4.4beta04 [July 31, 2010] + Updated the read macros and functions from 1.5.0beta38. 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 cf35fcc7b..49ae89b0c 100644 --- a/CHANGES +++ b/CHANGES @@ -2630,7 +2630,8 @@ version 1.4.4beta03 [July 24, 2010] Eliminated the new special case typedef of png_longjmp_ptr for WATCOM and made a special case "#define PNGAPI" in pngconf.h instead. -version 1.4.4beta04 [July 24, 2010] +version 1.4.4beta04 [July 31, 2010] + Updated the read macros and functions from 1.5.0beta38. 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.c b/png.c index ee19871cb..06d60b905 100644 --- a/png.c +++ b/png.c @@ -551,13 +551,13 @@ png_get_copyright(png_structp png_ptr) #else #ifdef __STDC__ return ((png_charp) PNG_STRING_NEWLINE \ - "libpng version 1.4.4beta04 - July 24, 2010" PNG_STRING_NEWLINE \ + "libpng version 1.4.4beta04 - July 31, 2010" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE); #else - return ((png_charp) "libpng version 1.4.4beta04 - July 24, 2010\ + return ((png_charp) "libpng version 1.4.4beta04 - July 31, 2010\ Copyright (c) 1998-2010 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); diff --git a/png.h b/png.h index 908796505..f306a8aa8 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.4.4beta04 - July 24, 2010 + * libpng version 1.4.4beta04 - July 31, 2010 * Copyright (c) 1998-2010 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.4.4beta04 - July 24, 2010: Glenn + * libpng versions 0.97, January 1998, through 1.4.4beta04 - July 31, 2010: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -177,7 +177,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.4.4beta04, July 24, 2010, are + * libpng versions 1.2.6, August 15, 2004, through 1.4.4beta04, July 31, 2010, are * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -289,7 +289,7 @@ * Y2K compliance in libpng: * ========================= * - * July 24, 2010 + * July 31, 2010 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -353,7 +353,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.4.4beta04" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.4.4beta04 - July 24, 2010\n" + " libpng version 1.4.4beta04 - July 31, 2010\n" #define PNG_LIBPNG_VER_SONUM 14 #define PNG_LIBPNG_VER_DLLNUM 14 @@ -2639,7 +2639,6 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name) * The png_get_int_32() routine assumes we are using two's complement * format for negative values, which is almost certainly true. */ -/* We could make special-case BIG_ENDIAN macros that do direct reads here */ # define png_get_uint_32(buf) \ (((png_uint_32)(*(buf)) << 24) + \ ((png_uint_32)(*((buf) + 1)) << 16) + \ @@ -2648,13 +2647,10 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name) # define png_get_uint_16(buf) \ (((png_uint_32)(*(buf)) << 8) + \ ((png_uint_32)(*((buf) + 1)))) -#ifdef PNG_GET_INT_32_SUPPORTED # define png_get_int_32(buf) \ - (((png_int_32)(*(buf)) << 24) + \ - ((png_int_32)(*((buf) + 1)) << 16) + \ - ((png_int_32)(*((buf) + 2)) << 8) + \ - ((png_int_32)(*((buf) + 3)))) -#endif + ((png_int_32)((*(buf) & 0x80) \ + ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffff)+1)) \ + : (png_int_32)png_get_uint_32(buf))) #else PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); diff --git a/pngrutil.c b/pngrutil.c index 603308b7c..8471d9acf 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -30,38 +30,41 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf) } #ifndef PNG_USE_READ_MACROS /* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ -png_uint_32 PNGAPI -png_get_uint_32(png_bytep buf) +png_uint_32 (PNGAPI +png_get_uint_32)(png_bytep buf) { - png_uint_32 i = ((png_uint_32)(*buf) << 24) + - ((png_uint_32)(*(buf + 1)) << 16) + - ((png_uint_32)(*(buf + 2)) << 8) + - (png_uint_32)(*(buf + 3)); + png_uint_32 i = + ((png_uint_32)(*(buf )) << 24) + + ((png_uint_32)(*(buf + 1)) << 16) + + ((png_uint_32)(*(buf + 2)) << 8) + + ((png_uint_32)(*(buf + 3)) ) ; return (i); } /* Grab a signed 32-bit integer from a buffer in big-endian format. The - * data is stored in the PNG file in two's complement format, and it is - * assumed that the machine format for signed integers is the same. + * data is stored in the PNG file in two's complement format and there + * is no guarantee that a 'png_int_32' is exactly 32 bits, therefore + * the following code does a two's complement to native conversion. */ -png_int_32 PNGAPI -png_get_int_32(png_bytep buf) +png_int_32 (PNGAPI +png_get_int_32)(png_bytep buf) { - png_int_32 i = ((png_int_32)(*buf) << 24) + - ((png_int_32)(*(buf + 1)) << 16) + - ((png_int_32)(*(buf + 2)) << 8) + - (png_int_32)(*(buf + 3)); + png_uint_32 u = png_get_uint_32(buf); + if ((u & 0x80000000) == 0) /* non-negative */ + return u; - return (i); + u = (u ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */ + return -(png_int_32)u; } /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ -png_uint_16 PNGAPI -png_get_uint_16(png_bytep buf) +png_uint_16 (PNGAPI +png_get_uint_16)(png_bytep buf) { - png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + - (png_uint_16)(*(buf + 1))); + png_uint_16 i = + ((png_uint_32)(*buf) << 8) + + ((png_uint_32)(*(buf + 1))); return (i); }