From a87c870f991a877458edd19056b8ca2e7dcc994d Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 1 Jan 2010 18:28:50 -0600 Subject: [PATCH] [master] Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr in pngtest.c --- ANNOUNCE | 40 ++++++++++++++++++++++------------------ CHANGES | 4 ++++ pngtest.c | 20 ++++++++++++++------ 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 96ac303e..d538f5e9 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.2.42rc04 - January 1, 2010 +Libpng 1.2.42rc05 - January 2, 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. @@ -9,36 +9,36 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.2.42rc04.tar.xz (LZMA-compressed, recommended) - libpng-1.2.42rc04.tar.gz - libpng-1.2.42rc04.tar.bz2 + libpng-1.2.42rc05.tar.xz (LZMA-compressed, recommended) + libpng-1.2.42rc05.tar.gz + libpng-1.2.42rc05.tar.bz2 Source files with LF line endings (for Unix/Linux) without the "configure" script - libpng-1.2.42rc04-no-config.tar.xz (LZMA-compressed, recommended) - libpng-1.2.42rc04-no-config.tar.gz - libpng-1.2.42rc04-no-config.tar.bz2 + libpng-1.2.42rc05-no-config.tar.xz (LZMA-compressed, recommended) + libpng-1.2.42rc05-no-config.tar.gz + libpng-1.2.42rc05-no-config.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lp1242r04.zip - lp1242r04.7z - lp1242r04.tar.bz2 + lp1242r05.zip + lp1242r05.7z + lp1242r05.tar.bz2 Project files - libpng-1.2.42rc04-project-netware.zip - libpng-1.2.42rc04-project-wince.zip + libpng-1.2.42rc05-project-netware.zip + libpng-1.2.42rc05-project-wince.zip Other information: - libpng-1.2.42rc04-README.txt - libpng-1.2.42rc04-KNOWNBUGS.txt - libpng-1.2.42rc04-LICENSE.txt - libpng-1.2.42rc04-Y2K-compliance.txt - libpng-1.2.42rc04-[previous version]-diff.txt + libpng-1.2.42rc05-README.txt + libpng-1.2.42rc05-KNOWNBUGS.txt + libpng-1.2.42rc05-LICENSE.txt + libpng-1.2.42rc05-Y2K-compliance.txt + libpng-1.2.42rc05-[previous version]-diff.txt Changes since the last public release (1.2.41): @@ -74,7 +74,11 @@ version 1.2.42rc04 [January 1, 2010] Marked png_memcpy_check() and png_memset_check() PNG_DEPRECATED. Updated copyright year. -version 1.0.52 and 1.2.42 [January 1, 2010] +version 1.2.42rc05 [January 2, 2010] + Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr + in pngtest.c + +version 1.0.52 and 1.2.42 [January 2, 2010] Send comments/corrections/commendations to png-mng-implement at lists.sf.net diff --git a/CHANGES b/CHANGES index 9deef527..7441b042 100644 --- a/CHANGES +++ b/CHANGES @@ -2636,6 +2636,10 @@ version 1.2.42rc04 [January 1, 2010] Marked png_memcpy_check() and png_memset_check() PNG_DEPRECATED. Updated copyright year. +version 1.2.42rc05 [January 2, 2010] + Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr + in pngtest.c + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/pngtest.c b/pngtest.c index 0837f1cb..a97578b4 100644 --- a/pngtest.c +++ b/pngtest.c @@ -312,12 +312,17 @@ static int wrote_question = 0; static void pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { - png_size_t check; + png_size_t check = 0; + png_voidp io_ptr; /* fread() returns 0 on error, so it is OK to store this in a png_size_t * instead of an int, which is what fread() actually returns. */ - READFILE((png_FILE_p)png_ptr->io_ptr, data, length, check); + io_ptr = png_get_io_ptr(png_ptr); + if (io_ptr != NULL) + { + READFILE((png_FILE_p)io_ptr, data, length, check); + } if (check != length) { @@ -457,9 +462,12 @@ static void pngtest_warning(png_structp png_ptr, png_const_charp message) { PNG_CONST char *name = "UNKNOWN (ERROR!)"; - if (png_ptr != NULL && png_ptr->error_ptr != NULL) - name = png_ptr->error_ptr; - fprintf(STDERR, "%s: libpng warning: %s\n", name, message); + char *test; + test = png_get_error_ptr(png_ptr); + if (test == NULL) + fprintf(STDERR, "%s: libpng warning: %s\n", name, message); + else + fprintf(STDERR, "%s: libpng warning: %s\n", test, message); } /* This is the default error handling function. Note that replacements for @@ -1690,4 +1698,4 @@ main(int argc, char *argv[]) } /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_42rc04 your_png_h_is_not_version_1_2_42rc04; +typedef version_1_2_42rc05 your_png_h_is_not_version_1_2_42rc05;