about summary refs log tree commit diff
path: root/analyzer
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-02-08 02:34:03 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-02-08 02:34:03 +0000
commit88636ed9b79b78633d1a1592db879b6696eb4e44 (patch)
tree94a97ee8da6e3cebd5a975604a76ad3e5f044f44 /analyzer
parent2baaf25ea90740d955cbcb954a979e0c570270c6 (diff)
downloadnetpbm-mirror-88636ed9b79b78633d1a1592db879b6696eb4e44.tar.gz
netpbm-mirror-88636ed9b79b78633d1a1592db879b6696eb4e44.tar.xz
netpbm-mirror-88636ed9b79b78633d1a1592db879b6696eb4e44.zip
Fix bug: uncommented summary with -map
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3147 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'analyzer')
-rw-r--r--analyzer/ppmhist.c18
1 files changed, 10 insertions, 8 deletions
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);