about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-12-13 23:02:51 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-12-13 23:02:51 +0000
commitb66a087d1ddfa84a284dab9d8f1b498bcc961b1c (patch)
treee1a8ac75d49e8ce977c2e3f1d43799de2f89ee2f
parent67ed1e8e515949052c7714d0822a4d5aaeb5a8cc (diff)
downloadnetpbm-mirror-b66a087d1ddfa84a284dab9d8f1b498bcc961b1c.tar.gz
netpbm-mirror-b66a087d1ddfa84a284dab9d8f1b498bcc961b1c.tar.xz
netpbm-mirror-b66a087d1ddfa84a284dab9d8f1b498bcc961b1c.zip
Fix bug with -remainder and not -closeness or vice versa
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@167 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--editor/ppmchange.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/editor/ppmchange.c b/editor/ppmchange.c
index 92d55527..1b1aa3ca 100644
--- a/editor/ppmchange.c
+++ b/editor/ppmchange.c
@@ -72,7 +72,7 @@ parseCommandLine(int argc, char ** argv,
     optParseOptions3(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
-    if (!closenessSpec)
+    if (!remainderSpec)
         cmdlineP->remainder_colorname = NULL;
 
     if (!closenessSpec)
@@ -144,22 +144,22 @@ changeRow(const pixel * const inrow,
    The input row is 'inrow'.  The output is returned as 'outrow', in
    storage which must be already allocated.  Both are 'cols' columns wide.
 -----------------------------------------------------------------------------*/
-    int col;
+    unsigned int col;
 
     for (col = 0; col < cols; ++col) {
-        int i;
-        int have_match; /* logical: It's a color user said to change */
+        unsigned int i;
+        bool haveMatch; /* logical: It's a color user said to change */
         pixel newcolor;  
         /* Color to which we must change current pixel.  Undefined unless
-           'have_match' is true.
+           'haveMatch' is true.
         */
 
-        have_match = FALSE;  /* haven't found a match yet */
-        for (i = 0; i < ncolors && !have_match; ++i) {
-            have_match = colormatch(inrow[col], colorfrom[i], closeness);
+        haveMatch = FALSE;  /* haven't found a match yet */
+        for (i = 0; i < ncolors && !haveMatch; ++i) {
+            haveMatch = colormatch(inrow[col], colorfrom[i], closeness);
             newcolor = colorto[i];
         }
-        if (have_match)
+        if (haveMatch)
             outrow[col] = newcolor;
         else if (remainder_specified)
             outrow[col] = remainder_color;