[alpha] Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr

in pngtest.c
This commit is contained in:
Glenn Randers-Pehrson
2010-01-01 18:34:19 -06:00
parent 7be38989f2
commit 298a278cc7
3 changed files with 21 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.5.0alpha01 - January 1, 2010 Libpng 1.5.0alpha01 - January 2, 2010
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.
@@ -55,7 +55,7 @@ version 1.4.1alpha02 [December 11, 2009]
change in version 1.2.41beta08 caused transparency to be handled wrong change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai). in some 16-bit datastreams (Yusaku Sugai).
version 1.5.0alpha01 [January 1, 2010] version 1.5.0alpha01 [January 2, 2010]
Bump version to 1.5.0alpha01 Bump version to 1.5.0alpha01
Add "depth" parameter to private png_build_gamma_table() Add "depth" parameter to private png_build_gamma_table()
Declared png_cleanup_needed "volatile" in pngread.c and pngwrite.c Declared png_cleanup_needed "volatile" in pngread.c and pngwrite.c
@@ -65,6 +65,8 @@ version 1.5.0alpha01 [January 1, 2010]
in pngset.c to be consistent with other changes in version 1.2.38. in pngset.c to be consistent with other changes in version 1.2.38.
Changed "libpng-pc.in" to "libpng.pc.in" in configure.ac, configure, and Changed "libpng-pc.in" to "libpng.pc.in" in configure.ac, configure, and
Makefile.in to be consistent with changes in libpng-1.4.0rc03 Makefile.in to be consistent with changes in libpng-1.4.0rc03
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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@@ -2437,7 +2437,7 @@ version 1.4.1alpha02 [December 11, 2009]
change in version 1.2.41beta08 caused transparency to be handled wrong change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai). in some 16-bit datastreams (Yusaku Sugai).
version 1.5.0alpha01 [January 1, 2010] version 1.5.0alpha01 [January 2, 2010]
Bump version to 1.5.0alpha01 Bump version to 1.5.0alpha01
Add "depth" parameter to private png_build_gamma_table() Add "depth" parameter to private png_build_gamma_table()
Declared png_cleanup_needed "volatile" in pngread.c and pngwrite.c Declared png_cleanup_needed "volatile" in pngread.c and pngwrite.c
@@ -2448,6 +2448,8 @@ version 1.5.0alpha01 [January 1, 2010]
Changed "libpng-pc.in" to "libpng.pc.in" in configure.ac, configure, and Changed "libpng-pc.in" to "libpng.pc.in" in configure.ac, configure, and
Makefile.in to be consistent with changes in libpng-1.4.0rc03 Makefile.in to be consistent with changes in libpng-1.4.0rc03
Updated copyright year to 2010. Updated copyright year to 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* 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 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -267,12 +267,17 @@ static int wrote_question = 0;
static void static void
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) 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 /* 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. * 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) if (check != length)
{ {
@@ -412,9 +417,12 @@ static void
pngtest_warning(png_structp png_ptr, png_const_charp message) pngtest_warning(png_structp png_ptr, png_const_charp message)
{ {
PNG_CONST char *name = "UNKNOWN (ERROR!)"; PNG_CONST char *name = "UNKNOWN (ERROR!)";
if (png_ptr != NULL && png_ptr->error_ptr != NULL) char *test;
name = png_ptr->error_ptr; test = png_get_error_ptr(png_ptr);
fprintf(STDERR, "%s: libpng warning: %s\n", name, message); 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 /* This is the default error handling function. Note that replacements for