From a0e0c6c8e742c9bda5aba5f2f475c4899d58c0eb Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 1 Jan 2010 18:31:26 -0600 Subject: [PATCH] [devel] Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr in pngtest.c --- ANNOUNCE | 22 +++++++++++++--------- CHANGES | 6 +++++- pngtest.c | 22 +++++++++++++++------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index a4c487195..476f426c0 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.4.0rc07 - January 1, 2010 +Libpng 1.4.0rc08 - 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,20 +9,20 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - 1.4.0rc07.tar.xz (LZMA-compressed, recommended) - 1.4.0rc07.tar.gz - 1.4.0rc07.tar.bz2 + 1.4.0rc08.tar.xz (LZMA-compressed, recommended) + 1.4.0rc08.tar.gz + 1.4.0rc08.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lp140r07.zip - lp140r07.7z + lp140r08.zip + lp140r08.7z Other information: - 1.4.0rc07-README.txt - 1.4.0rc07-LICENSE.txt + 1.4.0rc08-README.txt + 1.4.0rc08-LICENSE.txt Changes since the last public release (1.2.10): @@ -764,7 +764,11 @@ version 1.4.0rc07 [January 1, 2010] Use png_calloc() instead of png_malloc(); png_memset() in pngrutil.c Update copyright year to 2010. -version 1.4.0 [January 1, 2010] +version 1.4.0rc08 [January 2, 2010] + Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr + in pngtest.c + +version 1.4.0 [January 2, 2010] No changes. Send comments/corrections/commendations to png-mng-implement at lists.sf.net diff --git a/CHANGES b/CHANGES index 60aad20ac..45e43de35 100644 --- a/CHANGES +++ b/CHANGES @@ -2451,7 +2451,11 @@ version 1.4.0rc07 [January 1, 2010] Use png_calloc() instead of png_malloc(); png_memset() in pngrutil.c Update copyright year to 2010. -version 1.4.0 [January 1, 2010] +version 1.4.0rc08 [January 2, 2010] + Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr + in pngtest.c + +version 1.4.0 [January 2, 2010] No changes. Send comments/corrections/commendations to png-mng-implement at lists.sf.net diff --git a/pngtest.c b/pngtest.c index 75d432763..39f377807 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.4.0 [January 1, 2010] + * Last changed in libpng 1.4.0 [January 2, 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.) @@ -267,12 +267,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. */ - check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr); + io_ptr = png_get_io_ptr(png_ptr); + if (io_ptr != NULL) + { + check = fread(data, 1, length, (png_FILE_p)io_ptr); + } if (check != length) { @@ -412,9 +417,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 @@ -1619,4 +1627,4 @@ main(int argc, char *argv[]) } /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_4_0rc07 your_png_h_is_not_version_1_4_0rc07; +typedef version_1_4_0rc08 your_png_h_is_not_version_1_4_0rc08;