about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-11-30 18:54:54 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-11-30 18:54:54 +0000
commit888f84e1ee7cc65d822fa8e84e02743d529a9c12 (patch)
treed72c58fe5930c58d54318f139eada14e3a47b4e5
parent4c272da2874fc3fb6ea98faf7d2fcf5ded572e8f (diff)
downloadnetpbm-mirror-888f84e1ee7cc65d822fa8e84e02743d529a9c12.tar.gz
netpbm-mirror-888f84e1ee7cc65d822fa8e84e02743d529a9c12.tar.xz
netpbm-mirror-888f84e1ee7cc65d822fa8e84e02743d529a9c12.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4795 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/giftopnm.c9
-rw-r--r--converter/other/jpegtopnm.c3
-rw-r--r--converter/other/tifftopnm.c19
3 files changed, 5 insertions, 26 deletions
diff --git a/converter/other/giftopnm.c b/converter/other/giftopnm.c
index bc1d545a..c1c79e26 100644
--- a/converter/other/giftopnm.c
+++ b/converter/other/giftopnm.c
@@ -1449,20 +1449,14 @@ pnmFormat(bool const hasGray,
   by 'hasGray' and 'hasColor'.
 -----------------------------------------------------------------------------*/
     int format;
-    const char * formatName;
 
     if (hasColor) {
         format = PPM_FORMAT;
-        formatName = "PPM";
     } else if (hasGray) {
         format = PGM_FORMAT;
-        formatName = "PGM";
     } else {
         format = PBM_FORMAT;
-        formatName = "PBM";
     }
-    if (verbose)
-        pm_message("writing a %s file", formatName);
 
     return format;
 }
@@ -1555,6 +1549,9 @@ convertRaster(Decompressor * const decompP,
 
     MALLOCARRAY2(cmapIndexArray, interlace ? rows : 1 , cols);
 
+    if (verbose)
+        pm_message("writing a %s file", pnm_formattypenm(format));
+
     if (imageOutFileP)
         pnm_writepnminit(imageOutFileP, cols, rows, GIFMAXVAL, format, false);
     if (alphaFileP)
diff --git a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c
index 33baf6f0..33f69be9 100644
--- a/converter/other/jpegtopnm.c
+++ b/converter/other/jpegtopnm.c
@@ -555,8 +555,7 @@ setColorSpaces(J_COLOR_SPACE   const jpegColorSpace,
         pm_error("INTERNAL ERROR: unknown color space code %d passed "
                  "to setColorSpaces().", jpegColorSpace);
     }
-    pm_message("WRITING %s FILE",
-               *outputTypeP == PPM_TYPE ? "PPM" : "PGM");
+    pm_message("WRITING %s FILE", pnm_formattypenm(*outputTypeP));
 }
 
 
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
index e8f076a4..44b3461b 100644
--- a/converter/other/tifftopnm.c
+++ b/converter/other/tifftopnm.c
@@ -714,23 +714,6 @@ analyzeImageType(TIFF *             const tiffP,
 
 
 
-static void
-reportOutputFormat(int const format) {
-
-    const char * formatDesc;
-
-    switch (format) {
-    case PBM_TYPE: formatDesc = "PBM"; break;
-    case PGM_TYPE: formatDesc = "PGM"; break;
-    case PPM_TYPE: formatDesc = "PPM"; break;
-    default: assert(false);
-    }
-
-    pm_message("writing %s file", formatDesc);
-}
-
-
-
 typedef struct {
     FILE *       imageoutFileP;
         /* The stream to which we write the PNM image.  Null for none. */
@@ -1687,7 +1670,7 @@ convertImage(TIFF *             const tifP,
     analyzeImageType(tifP, tiffDir.bps, tiffDir.spp, tiffDir.photomet,
                      &maxval, &format, colormap, cmdline.headerdump, cmdline);
 
-    reportOutputFormat(format);
+    pm_message("writing %s file", pnm_formattypenm(format));
 
     pnmOut_init(imageoutFileP, alphaFileP, tiffDir.width, tiffDir.height,
                 tiffDir.orientation, maxval, format, maxval,