From 91427fdfdbc9c237c90b5a224f47508e6c9a3859 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 12 Jun 2011 18:04:09 +0000 Subject: Redirect libpng errors to the standard NetSurf logfile svn path=/trunk/netsurf/; revision=12471 --- image/png.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'image') diff --git a/image/png.c b/image/png.c index 3093c89e8..95f68ed94 100644 --- a/image/png.c +++ b/image/png.c @@ -74,6 +74,23 @@ static unsigned int interlace_step[8] = {28, 28, 12, 12, 4, 4, 0}; static unsigned int interlace_row_start[8] = {0, 0, 4, 0, 2, 0, 1}; static unsigned int interlace_row_step[8] = {8, 8, 8, 4, 4, 2, 2}; +/** + * nspng_warning -- callback for libpng warnings + */ +void nspng_warning(png_structp png_ptr, png_const_charp warning_message) +{ + LOG(("%s", warning_message)); +} + +/** + * nspng_error -- callback for libpng errors + */ +void nspng_error(png_structp png_ptr, png_const_charp error_message) +{ + LOG(("%s", error_message)); + longjmp(png_ptr->jmpbuf, 1); +} + /** * info_callback -- PNG header has been completely received, prepare to process * image data @@ -209,6 +226,8 @@ static nserror nspng_create_png_data(nspng_content *png_c) return NSERROR_NOMEM; } + png_set_error_fn(png_c->png, NULL, nspng_error, nspng_warning); + png_c->info = png_create_info_struct(png_c->png); if (png_c->info == NULL) { png_destroy_read_struct(&png_c->png, &png_c->info, 0); -- cgit v1.2.3