[master] 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:28:50 -06:00
parent b9d671326b
commit a87c870f99
3 changed files with 40 additions and 24 deletions

View File

@ -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 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.
@ -9,36 +9,36 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.2.42rc04.tar.xz (LZMA-compressed, recommended) libpng-1.2.42rc05.tar.xz (LZMA-compressed, recommended)
libpng-1.2.42rc04.tar.gz libpng-1.2.42rc05.tar.gz
libpng-1.2.42rc04.tar.bz2 libpng-1.2.42rc05.tar.bz2
Source files with LF line endings (for Unix/Linux) without the Source files with LF line endings (for Unix/Linux) without the
"configure" script "configure" script
libpng-1.2.42rc04-no-config.tar.xz (LZMA-compressed, recommended) libpng-1.2.42rc05-no-config.tar.xz (LZMA-compressed, recommended)
libpng-1.2.42rc04-no-config.tar.gz libpng-1.2.42rc05-no-config.tar.gz
libpng-1.2.42rc04-no-config.tar.bz2 libpng-1.2.42rc05-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lp1242r04.zip lp1242r05.zip
lp1242r04.7z lp1242r05.7z
lp1242r04.tar.bz2 lp1242r05.tar.bz2
Project files Project files
libpng-1.2.42rc04-project-netware.zip libpng-1.2.42rc05-project-netware.zip
libpng-1.2.42rc04-project-wince.zip libpng-1.2.42rc05-project-wince.zip
Other information: Other information:
libpng-1.2.42rc04-README.txt libpng-1.2.42rc05-README.txt
libpng-1.2.42rc04-KNOWNBUGS.txt libpng-1.2.42rc05-KNOWNBUGS.txt
libpng-1.2.42rc04-LICENSE.txt libpng-1.2.42rc05-LICENSE.txt
libpng-1.2.42rc04-Y2K-compliance.txt libpng-1.2.42rc05-Y2K-compliance.txt
libpng-1.2.42rc04-[previous version]-diff.txt libpng-1.2.42rc05-[previous version]-diff.txt
Changes since the last public release (1.2.41): 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. Marked png_memcpy_check() and png_memset_check() PNG_DEPRECATED.
Updated copyright year. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@ -2636,6 +2636,10 @@ version 1.2.42rc04 [January 1, 2010]
Marked png_memcpy_check() and png_memset_check() PNG_DEPRECATED. Marked png_memcpy_check() and png_memset_check() PNG_DEPRECATED.
Updated copyright year. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@ -312,12 +312,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.
*/ */
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) if (check != length)
{ {
@ -457,9 +462,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
@ -1690,4 +1698,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* 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;