From 888f84e1ee7cc65d822fa8e84e02743d529a9c12 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 30 Nov 2023 18:54:54 +0000 Subject: cleanup git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4795 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/giftopnm.c | 9 +++------ converter/other/jpegtopnm.c | 3 +-- converter/other/tifftopnm.c | 19 +------------------ 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, -- cgit 1.4.1