about summary refs log tree commit diff
path: root/converter/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:32:17 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:32:17 +0000
commit341f87d067f5cb46683ae31944e9c31f1cc51e1d (patch)
tree1cce4237c5968d9378a316ab0ce85b4c97172282 /converter/other
parent59588cf8aa12fd79214e937e6a9597630443c4a8 (diff)
downloadnetpbm-mirror-341f87d067f5cb46683ae31944e9c31f1cc51e1d.tar.gz
netpbm-mirror-341f87d067f5cb46683ae31944e9c31f1cc51e1d.tar.xz
netpbm-mirror-341f87d067f5cb46683ae31944e9c31f1cc51e1d.zip
promote Development to Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4560 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r--converter/other/pamtopng.c4
-rw-r--r--converter/other/pngtopam.c10
-rw-r--r--converter/other/pngx.c16
-rw-r--r--converter/other/pnmtopng.c19
4 files changed, 12 insertions, 37 deletions
diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c
index 088db3c8..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"
@@ -85,7 +83,7 @@ parseChromaOpt(const char *         const chromaOpt,
                    &chromaP->bx, &chromaP->by);
 
     if (count != 8)
-        pm_error("Invalid syntax for the -rgb option value '%s'.  "
+        pm_error("Invalid syntax for the -chroma option value '%s'.  "
                  "Should be 8 floating point numbers: "
                  "x and y for each of white, red, green, and blue",
                  chromaOpt);
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);