diff options
Diffstat (limited to 'image')
-rw-r--r-- | image/png.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/image/png.c b/image/png.c index 3093c89e8..95f68ed94 100644 --- a/image/png.c +++ b/image/png.c @@ -75,6 +75,23 @@ 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); |