[libpng16] Made png_user_version_check() ok to use with libpng version 1.10.x
and later.
diff --git a/ANNOUNCE b/ANNOUNCE
index 22ce328..a54736a 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
within a few weeks by a public version or by another test version.
@@ -545,11 +545,12 @@
gain; implementing full ICC color correction may be desireable but is left
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.
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.
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
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index 1b0e2f1..246610f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4297,11 +4297,12 @@
gain; implementing full ICC color correction may be desireable but is left
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.
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.
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
(subscription required; visit
diff --git a/png.c b/png.c
index 0fe8046..20484aa 100644
--- a/png.c
+++ b/png.c
@@ -128,10 +128,10 @@
need_crc = 0;
}
- /* 'uLong' is defined as unsigned long, this means that on some systems it is
- * a 64 bit value. crc32, however, returns 32 bits so the following cast is
- * safe. 'uInt' may be no more than 16 bits, so it is necessary to perform a
- * loop here.
+ /* 'uLong' is defined in zlib.h as unsigned long; this means that on some
+ * systems it is a 64 bit value. crc32, however, returns 32 bits so the
+ * following cast is safe. 'uInt' may be no more than 16 bits, so it is
+ * necessary to perform a loop here.
*/
if (need_crc && length > 0)
{
@@ -145,7 +145,7 @@
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
* assumptions within the libpng code.
*/
@@ -160,7 +160,7 @@
}
/* 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
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
@@ -184,10 +184,12 @@
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
* we must recompile any applications that use any older library version.
* 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] ||
- (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'))
{
#ifdef PNG_WARNINGS_SUPPORTED
@@ -766,13 +768,13 @@
#else
# ifdef __STDC__
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) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# 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) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";