diff options
Diffstat (limited to 'converter/other/pngx.c')
-rw-r--r-- | converter/other/pngx.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/converter/other/pngx.c b/converter/other/pngx.c index 8295b979..d360e554 100644 --- a/converter/other/pngx.c +++ b/converter/other/pngx.c @@ -1,6 +1,10 @@ #include <stdbool.h> #include <assert.h> #include <png.h> +/* Because of a design error in png.h, you must not #include <setjmp.h> before + <png.h>. If you do, png.h won't compile. +*/ +#include <setjmp.h> #include "pm_c_util.h" #include "mallocvar.h" #include "nstring.h" @@ -24,7 +28,7 @@ errorHandler(png_structp const png_ptr, jmp_buf * jmpbufP; - /* this function, aside from the extra step of retrieving the "error + /* This function, aside from the extra step of retrieving the "error pointer" (below) and the fact that it exists within the application rather than within libpng, is essentially identical to libpng's default error handler. The second point is critical: since both @@ -34,16 +38,14 @@ errorHandler(png_structp const png_ptr, been defined. */ - pm_message("fatal libpng error: %s", msg); + pm_errormsg("fatal libpng error: %s", msg); jmpbufP = png_get_error_ptr(png_ptr); - if (!jmpbufP) { - /* we are completely hosed now */ - pm_error("EXTREMELY fatal error: jmpbuf unrecoverable; terminating."); - } - - longjmp(*jmpbufP, 1); + if (!jmpbufP) + pm_longjmp(); + else + longjmp(*jmpbufP, 1); } @@ -651,6 +653,7 @@ pngx_setTextLangKey(png_text * const textP, } + void pngx_termText(png_text * const textP) { |