[libpng17] Use a user warning handler in contrib/gregbook/readpng2.c instead

of default, so warnings will be put on stderr even if libpng has CONSOLE_IO
disabled.
This commit is contained in:
Glenn Randers-Pehrson
2014-02-23 10:08:50 -06:00
parent 0c5acfa19e
commit 4526f546ba
3 changed files with 14 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.7.0beta32 - February 20, 2014 Libpng 1.7.0beta32 - February 23, 2014
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.
@@ -533,7 +533,7 @@ Version 1.7.0beta31 [February 6, 2014]
and it adds corresponding code to pngimage.c to handle such options and it adds corresponding code to pngimage.c to handle such options
by not attempting to test them. by not attempting to test them.
Version 1.7.0beta32 [February 20, 2014] Version 1.7.0beta32 [February 23, 2014]
Moved redefines of png_error(), png_warning(), png_chunk_error(), Moved redefines of png_error(), png_warning(), png_chunk_error(),
and png_chunk_warning() from pngpriv.h to png.h to make them visible and png_chunk_warning() from pngpriv.h to png.h to make them visible
to libpng-calling applications. to libpng-calling applications.
@@ -550,6 +550,8 @@ Version 1.7.0beta32 [February 20, 2014]
it more robust against future programming errors. it more robust against future programming errors.
Check for __has_extension before using it in pngconf.h, to Check for __has_extension before using it in pngconf.h, to
support older Clang versions (Jeremy Sequoia). support older Clang versions (Jeremy Sequoia).
Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
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

@@ -4822,7 +4822,7 @@ Version 1.7.0beta31 [February 6, 2014]
and it adds corresponding code to pngimage.c to handle such options and it adds corresponding code to pngimage.c to handle such options
by not attempting to test them. by not attempting to test them.
Version 1.7.0beta32 [February 20, 2014] Version 1.7.0beta32 [February 23, 2014]
Moved redefines of png_error(), png_warning(), png_chunk_error(), Moved redefines of png_error(), png_warning(), png_chunk_error(),
and png_chunk_warning() from pngpriv.h to png.h to make them visible and png_chunk_warning() from pngpriv.h to png.h to make them visible
to libpng-calling applications. to libpng-calling applications.
@@ -4839,6 +4839,8 @@ Version 1.7.0beta32 [February 20, 2014]
it more robust against future programming errors. it more robust against future programming errors.
Check for __has_extension before using it in pngconf.h, to Check for __has_extension before using it in pngconf.h, to
support older Clang versions (Jeremy Sequoia). support older Clang versions (Jeremy Sequoia).
Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
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

@@ -69,6 +69,7 @@ static void readpng2_row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass); png_uint_32 row_num, int pass);
static void readpng2_end_callback(png_structp png_ptr, png_infop info_ptr); static void readpng2_end_callback(png_structp png_ptr, png_infop info_ptr);
static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg); static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
static void readpng2_warning_handler(png_structp png_ptr, png_const_charp msg);
@@ -104,7 +105,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
/* could also replace libpng warning-handler (final NULL), but no need: */ /* could also replace libpng warning-handler (final NULL), but no need: */
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr, png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,
readpng2_error_handler, NULL); readpng2_error_handler, readpng2_warning_handler);
if (!png_ptr) if (!png_ptr)
return 4; /* out of memory */ return 4; /* out of memory */
@@ -467,7 +468,11 @@ void readpng2_cleanup(mainprog_info *mainprog_ptr)
} }
static void readpng2_warning_handler(png_structp png_ptr, png_const_charp msg)
{
fprintf(stderr, "readpng2 libpng warning: %s\n", msg);
fflush(stderr);
}
static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg) static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)