From 88636ed9b79b78633d1a1592db879b6696eb4e44 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 8 Feb 2018 02:34:03 +0000 Subject: Fix bug: uncommented summary with -map git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3147 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- analyzer/ppmhist.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'analyzer/ppmhist.c') diff --git a/analyzer/ppmhist.c b/analyzer/ppmhist.c index 5c1a8abd..299ab6ca 100644 --- a/analyzer/ppmhist.c +++ b/analyzer/ppmhist.c @@ -352,9 +352,11 @@ colorSummary(colorhist_vector const chv, static void -printColorSummary(ColorSummary const colorSummary) { +printColorSummary(ColorSummary const colorSummary, + const char * const prefix) { - printf("Summary: %u colors: %u black, %u white, %u gray, %u color\n", + printf("%sSummary: %u colors: %u black, %u white, %u gray, %u color\n", + prefix, colorSummary.nTotal, colorSummary.nBlack, colorSummary.nWhite, @@ -496,10 +498,13 @@ printHistogram(colorhist_vector const chv, printf("P3\n# color map\n%d 1\n%d\n", colorCt, maxval); if (wantHeader) { - const char commentDelim = colorFmt == FMT_PPMPLAIN ? '#' : ' '; - printf("%c r g b \t lum \t count %s\n", + const char * commentDelim = colorFmt == FMT_PPMPLAIN ? "#" : " "; + + printColorSummary(colorSummary(chv, colorCt, maxval), commentDelim); + + printf("%s r g b \t lum \t count %s\n", commentDelim, wantColorName ? "name" : ""); - printf("%c----- ----- ----- \t-----\t------- %s\n", + printf("%s----- ----- ----- \t-----\t------- %s\n", commentDelim, wantColorName ? "----" : ""); } if (wantColorName) { @@ -637,9 +642,6 @@ main(int argc, const char *argv[]) { validColorCt = colorCt; } - if (!cmdline.noheader) - printColorSummary(colorSummary(chv, validColorCt, maxval)); - printHistogram(chv, validColorCt, maxval, cmdline.colorFmt, !cmdline.noheader, cmdline.colorname); -- cgit 1.4.1