diff options
-rw-r--r-- | converter/other/pamtopng.c | 2 | ||||
-rw-r--r-- | converter/other/pngtopam.c | 10 | ||||
-rw-r--r-- | converter/other/pngx.c | 16 | ||||
-rw-r--r-- | converter/other/pnmtopng.c | 19 | ||||
-rw-r--r-- | doc/HISTORY | 4 |
5 files changed, 15 insertions, 36 deletions
diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c index c9f7aca9..831c3242 100644 --- a/converter/other/pamtopng.c +++ b/converter/other/pamtopng.c @@ -30,8 +30,6 @@ #include <stdlib.h> #include <time.h> #include <png.h> -/* setjmp.h needs to be included after png.h */ -#include <setjmp.h> #include "pm_c_util.h" #include "mallocvar.h" diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c index 3c0f81a5..a700364f 100644 --- a/converter/other/pngtopam.c +++ b/converter/other/pngtopam.c @@ -22,10 +22,6 @@ #include <math.h> #include <float.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 <zlib.h> @@ -1465,15 +1461,11 @@ convertpng(FILE * const ifP, pngcolor bgColor; GammaCorrection gamma; struct pam pam; - jmp_buf jmpbuf; struct pngx * pngxP; *errorLevelP = 0; - if (setjmp(jmpbuf)) - pm_error ("setjmp returns error condition"); - - pngx_create(&pngxP, PNGX_READ, &jmpbuf); + pngx_create(&pngxP, PNGX_READ, NULL); pngx_readStart(pngxP, ifP); diff --git a/converter/other/pngx.c b/converter/other/pngx.c index 7840b2da..c8703443 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" @@ -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); } diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index 2230d226..3c84e1d3 100644 --- a/converter/other/pnmtopng.c +++ b/converter/other/pnmtopng.c @@ -60,10 +60,6 @@ #include <string.h> /* strcat() */ #include <limits.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 <zlib.h> #include "pm_c_util.h" @@ -137,10 +133,6 @@ struct cmdlineInfo { -typedef struct _jmpbuf_wrapper { - jmp_buf jmpbuf; -} jmpbuf_wrapper; - #ifndef NONE # define NONE 0 #endif @@ -155,7 +147,6 @@ typedef struct _jmpbuf_wrapper { static bool verbose; -static jmpbuf_wrapper pnmtopng_jmpbuf_struct; static int errorlevel; @@ -2732,7 +2723,6 @@ convertpnm(struct cmdlineInfo const cmdline, /* The background color, with maxval equal to that of the input image. */ - jmp_buf jmpbuf; struct pngx * pngxP; bool colorMapped; @@ -2787,10 +2777,7 @@ convertpnm(struct cmdlineInfo const cmdline, errorlevel = 0; - if (setjmp(jmpbuf)) - pm_error ("setjmp returns error condition"); - - pngx_create(&pngxP, PNGX_WRITE, &jmpbuf); + pngx_create(&pngxP, PNGX_WRITE, NULL); pnm_readpnminit(ifP, &cols, &rows, &maxval, &format); pm_tell2(ifP, &rasterPos, sizeof(rasterPos)); @@ -2866,10 +2853,6 @@ convertpnm(struct cmdlineInfo const cmdline, pngMaxval = pm_bitstomaxval(depth); - if (setjmp (pnmtopng_jmpbuf_struct.jmpbuf)) { - pm_error ("setjmp returns error condition (2)"); - } - doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha, cmdline.interlace); diff --git a/doc/HISTORY b/doc/HISTORY index 6694e3ca..f13e044f 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -11,6 +11,10 @@ not yet BJH Release 11.03.00 pamtopng: fix typo in error message about -chroma option. + pamtopng, pnmtopng, pngtopam: fix error message when something + fails in libpng. Always broken (the programs were new in Netpbm + 8.1 (March 2000)). + 23.03.25 BJH Release 11.02.00 jpegtopnm: Add -traceexif |