From 6e0cf087ad7c582a5465a74a21542f7f970b7d6a Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 1 Nov 2009 21:40:42 -0600 Subject: [PATCH] [master] Imported from libpng-1.2.41beta11.tar --- INSTALL | 2 +- LICENSE | 4 ++-- README | 2 +- Y2KINFO | 2 +- libpng-1.2.41beta11.txt | 6 +++--- libpng.3 | 14 +++++++------- libpngpf.3 | 2 +- png.5 | 2 +- png.h | 15 ++++++++++----- pngconf.h | 2 +- pngerror.c | 2 +- pngget.c | 2 +- pngread.c | 27 ++++++++++++++++++++++++++- pngrio.c | 2 +- pngrtran.c | 2 +- pngrutil.c | 2 +- pngtest.c | 2 +- pngtrans.c | 2 +- pngwio.c | 2 +- pngwrite.c | 27 ++++++++++++++++++++++++++- pngwtran.c | 2 +- pngwutil.c | 2 +- 22 files changed, 90 insertions(+), 35 deletions(-) diff --git a/INSTALL b/INSTALL index 8f6532b9..758f00cc 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.2.41beta11 - November 1, 2009 +Installing libpng version 1.2.41beta11 - November 2, 2009 On Unix/Linux and similar systems, you can simply type diff --git a/LICENSE b/LICENSE index a8ee4e51..11a5ad5c 100644 --- a/LICENSE +++ b/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.2.41beta11, November 1, 2009, are +libpng versions 1.2.6, August 15, 2004, through 1.2.41beta11, November 2, 2009, are Copyright (c) 2004, 2006-2009 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 @@ -108,4 +108,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -November 1, 2009 +November 2, 2009 diff --git a/README b/README index b9ad166c..e417fa66 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng version 1.2.41beta11 - November 1, 2009 (shared library 12.0) +README for libpng version 1.2.41beta11 - November 2, 2009 (shared library 12.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. diff --git a/Y2KINFO b/Y2KINFO index 9de5dc64..406392de 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,7 +1,7 @@ Y2K compliance in libpng: ========================= - November 1, 2009 + November 2, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng-1.2.41beta11.txt b/libpng-1.2.41beta11.txt index 17b7af26..d30901ca 100644 --- a/libpng-1.2.41beta11.txt +++ b/libpng-1.2.41beta11.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.2.41beta11 - November 1, 2009 + libpng version 1.2.41beta11 - November 2, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.2.41beta11 - November 1, 2009 + libpng versions 0.97, January 1998, through 1.2.41beta11 - November 2, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -3209,7 +3209,7 @@ source. XIII. Y2K Compliance in libpng -November 1, 2009 +November 2, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index 2ea3bed2..c8d0cd23 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "November 1, 2009" +.TH LIBPNG 3 "November 2, 2009" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.2.41beta11 .SH SYNOPSIS @@ -821,7 +821,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.2.41beta11 - November 1, 2009 + libpng version 1.2.41beta11 - November 2, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -832,7 +832,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.2.41beta11 - November 1, 2009 + libpng versions 0.97, January 1998, through 1.2.41beta11 - November 2, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -4030,7 +4030,7 @@ source. .SH XIII. Y2K Compliance in libpng -November 1, 2009 +November 2, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -4376,7 +4376,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.2.41beta11 - November 1, 2009: +Libpng version 1.2.41beta11 - November 2, 2009: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -4399,7 +4399,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.2.41beta11, November 1, 2009, are +libpng versions 1.2.6, August 15, 2004, through 1.2.41beta11, November 2, 2009, are Copyright (c) 2004,2006-2008 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 @@ -4498,7 +4498,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -November 1, 2009 +November 2, 2009 .\" end of man page diff --git a/libpngpf.3 b/libpngpf.3 index 2f71bb8e..9bdb6d22 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,4 +1,4 @@ -.TH LIBPNGPF 3 "November 1, 2009" +.TH LIBPNGPF 3 "November 2, 2009" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.2.41beta11 (private functions) diff --git a/png.5 b/png.5 index aa7e9bac..15e457c8 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "November 1, 2009" +.TH PNG 5 "November 2, 2009" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.h b/png.h index 0d53c1a7..b12fa307 100644 --- a/png.h +++ b/png.h @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library * - * libpng version 1.2.41beta11 - November 1, 2009 + * libpng version 1.2.41beta11 - November 2, 2009 * Copyright (c) 1998-2009 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.) @@ -10,7 +10,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.2.41beta11 - November 1, 2009: Glenn + * libpng versions 0.97, January 1998, through 1.2.41beta11 - November 2, 2009: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -277,7 +277,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.2.41beta11, November 1, 2009, are + * libpng versions 1.2.6, August 15, 2004, through 1.2.41beta11, November 2, 2009, are * Copyright (c) 2004, 2006-2009 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: @@ -389,7 +389,7 @@ * Y2K compliance in libpng: * ========================= * - * November 1, 2009 + * November 2, 2009 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -453,7 +453,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.2.41beta11" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.2.41beta11 - November 1, 2009\n" + " libpng version 1.2.41beta11 - November 2, 2009\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 @@ -1526,6 +1526,11 @@ struct png_struct_def #ifdef PNG_IO_STATE_SUPPORTED png_uint_32 io_state; #endif + +/* New member added in libpng-1.2.41, will be removed from 1.4.0 */ +#ifdef PNG_iTXt_SUPPORTED + png_charp user_png_ver; /* libpng version used to build calling app */ +#endif }; diff --git a/pngconf.h b/pngconf.h index 9a027a5b..f3d289dc 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.2.41beta11 - November 1, 2009 + * libpng version 1.2.41beta11 - November 2, 2009 * Copyright (c) 1998-2009 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.) diff --git a/pngerror.c b/pngerror.c index 8c56f25b..4ce69921 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngget.c b/pngget.c index 1c94f1b4..6cbb6526 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngread.c b/pngread.c index 431797b6..c836e01a 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) @@ -118,6 +118,10 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, * For versions after libpng 1.0, we will be compatible, so we need * only check the first digit. */ +#ifdef PNG_iTXt_SUPPORTED + png_size_t length; +#endif + 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] == '0' && user_png_ver[2] < '9')) @@ -142,6 +146,27 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_error(png_ptr, "Incompatible libpng version in application and library"); } + +#ifdef PNG_iTXt_SUPPORTED + /* Any library mismatch is trouble for png_set_read() in + * libpng-1.2.41 and later 1.2.x, so we store the caller's + * library version string. + */ + + length = (png_size_t)png_strlen(user_png_ver) + 1; + png_debug1(3, "allocating user_png_ver for png_ptr (%lu bytes)", + (unsigned long)length); + png_ptr->user_png_ver = (png_charp)png_malloc_warn(png_ptr, + (png_uint_32)length); + + if (png_ptr->user_png_ver == NULL) + png_warning(png_ptr, "Could not store png_ptr->user_png_ver"); + + else + png_memcpy(png_ptr->user_png_ver, user_png_ver, length); + +#endif /* PNG_iTXt_SUPPORTED */ + } /* Initialize zbuf - compression buffer */ diff --git a/pngrio.c b/pngrio.c index 77f7653e..8d9123af 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngrtran.c b/pngrtran.c index bfa72e86..bbbe032d 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngrutil.c b/pngrutil.c index cbd8e9bc..2bc397af 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngtest.c b/pngtest.c index 0d95b4b9..8fd82e3e 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngtrans.c b/pngtrans.c index 0190b249..bf5f7da4 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngwio.c b/pngwio.c index 2a73ca7c..a1b8a237 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngwrite.c b/pngwrite.c index 49a77648..e08e960c 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) @@ -536,6 +536,10 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) { +#ifdef PNG_iTXt_SUPPORTED + png_size_t length; +#endif + /* 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 @@ -565,6 +569,27 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_error(png_ptr, "Incompatible libpng version in application and library"); } +#ifdef PNG_iTXt_SUPPORTED + + /* Any library mismatch is trouble for png_set_read() in + * libpng-1.2.41 and later 1.2.x, so we store the caller's + * library version string. + */ + + length = (png_size_t)png_strlen(user_png_ver) + 1; + png_debug1(3, "allocating user_png_ver for png_ptr (%lu bytes)", + (unsigned long)length); + png_ptr->user_png_ver = (png_charp)png_malloc_warn(png_ptr, + (png_uint_32)length); + + if (png_ptr->user_png_ver == NULL) + png_warning(png_ptr, "Could not store png_ptr->user_png_ver"); + + else + png_memcpy(png_ptr->user_png_ver, user_png_ver, length); + +#endif /* PNG_iTXt_SUPPORTED */ + } /* Initialize zbuf - compression buffer */ diff --git a/pngwtran.c b/pngwtran.c index 88614c6e..685b2bd4 100644 --- a/pngwtran.c +++ b/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.) diff --git a/pngwutil.c b/pngwutil.c index 03160e23..93830feb 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.2.41 [November 1, 2009] + * Last changed in libpng 1.2.41 [November 2, 2009] * Copyright (c) 1998-2009 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.)