[libpng16] Made png_user_version_check() ok to use with libpng version 1.10.x

and later.
This commit is contained in:
Glenn Randers-Pehrson 2012-11-22 16:58:30 -06:00
parent 70850fce0c
commit 5f4b95e513
3 changed files with 17 additions and 13 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.0beta32 - November 15, 2012 Libpng 1.6.0beta32 - November 22, 2012
This is not intended to be a public release. It will be replaced 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. within a few weeks by a public version or by another test version.
@ -545,11 +545,12 @@ Version 1.6.0beta31 [November 1, 2012]
gain; implementing full ICC color correction may be desireable but is left gain; implementing full ICC color correction may be desireable but is left
up to applications. up to applications.
Version 1.6.0beta32 [November 15, 2012] Version 1.6.0beta32 [November 22, 2012]
Fixed an intermittent SEGV in pngstest due to an uninitialized array element. Fixed an intermittent SEGV in pngstest due to an uninitialized array element.
Added the ability for contrib/libtests/makepng.c to make a PNG with just one Added the ability for contrib/libtests/makepng.c to make a PNG with just one
color. This is useful for debugging pngstest color inaccuracy reports. color. This is useful for debugging pngstest color inaccuracy reports.
Fixed error checking in the simplified write API (Olaf van der Spek) Fixed error checking in the simplified write API (Olaf van der Spek)
Made png_user_version_check() ok to use with libpng version 1.10.x and later.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -4297,11 +4297,12 @@ Version 1.6.0beta31 [November 1, 2012]
gain; implementing full ICC color correction may be desireable but is left gain; implementing full ICC color correction may be desireable but is left
up to applications. up to applications.
Version 1.6.0beta32 [November 15, 2012] Version 1.6.0beta32 [November 22, 2012]
Fixed an intermittent SEGV in pngstest due to an uninitialized array element. Fixed an intermittent SEGV in pngstest due to an uninitialized array element.
Added the ability for contrib/libtests/makepng.c to make a PNG with just one Added the ability for contrib/libtests/makepng.c to make a PNG with just one
color. This is useful for debugging pngstest color inaccuracy reports. color. This is useful for debugging pngstest color inaccuracy reports.
Fixed error checking in the simplified write API (Olaf van der Spek) Fixed error checking in the simplified write API (Olaf van der Spek)
Made png_user_version_check() ok to use with libpng version 1.10.x and later.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

22
png.c
View File

@ -128,10 +128,10 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
need_crc = 0; need_crc = 0;
} }
/* 'uLong' is defined as unsigned long, this means that on some systems it is /* 'uLong' is defined in zlib.h as unsigned long; this means that on some
* a 64 bit value. crc32, however, returns 32 bits so the following cast is * systems it is a 64 bit value. crc32, however, returns 32 bits so the
* safe. 'uInt' may be no more than 16 bits, so it is necessary to perform a * following cast is safe. 'uInt' may be no more than 16 bits, so it is
* loop here. * necessary to perform a loop here.
*/ */
if (need_crc && length > 0) if (need_crc && length > 0)
{ {
@ -145,7 +145,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
crc = crc32(crc, ptr, safe_length); crc = crc32(crc, ptr, safe_length);
/* The following should never issue compiler warnings, if they do the /* The following should never issue compiler warnings; if they do the
* target system has characteristics that will probably violate other * target system has characteristics that will probably violate other
* assumptions within the libpng code. * assumptions within the libpng code.
*/ */
@ -160,7 +160,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
} }
/* Check a user supplied version number, called from both read and write /* Check a user supplied version number, called from both read and write
* functions that create a png_struct * functions that create a png_struct.
*/ */
int int
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver) png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
@ -184,10 +184,12 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
* we must recompile any applications that use any older library version. * we must recompile any applications that use any older library version.
* For versions after libpng 1.0, we will be compatible, so we need * For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit. * only check the first and third digits (note that when we reach version
* 1.10 we will need to check the fourth symbol, namely user_png_ver[3]).
*/ */
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || (user_png_ver[0] == '1' && (user_png_ver[2] != png_libpng_ver[2] ||
user_png_ver[3] != png_libpng_ver[3])) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9')) (user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{ {
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
@ -766,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.0beta32 - November 1, 2012" PNG_STRING_NEWLINE \ "libpng version 1.6.0beta32 - November 22, 2012" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.0beta32 - November 1, 2012\ return "libpng version 1.6.0beta32 - November 22, 2012\
Copyright (c) 1998-2012 Glenn Randers-Pehrson\ Copyright (c) 1998-2012 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";