about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-04-28 15:52:15 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-04-28 15:52:15 +0000
commit6e67d467de10def44ce5764820fd0b1159bece73 (patch)
treefee70a370ae2d884e5708de355cee0363b064860 /lib
parentc3706293c92b65926b5183bf10a5c602a6318e89 (diff)
downloadnetpbm-mirror-6e67d467de10def44ce5764820fd0b1159bece73.tar.gz
netpbm-mirror-6e67d467de10def44ce5764820fd0b1159bece73.tar.xz
netpbm-mirror-6e67d467de10def44ce5764820fd0b1159bece73.zip
quiet compiler warning
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3221 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/libppmcolor.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libppmcolor.c b/lib/libppmcolor.c
index 5870d2c5..f37ec564 100644
--- a/lib/libppmcolor.c
+++ b/lib/libppmcolor.c
@@ -421,15 +421,18 @@ ppm_colorname(const pixel * const colorP,
 
     f = pm_openColornameFile(NULL, !hexok);
     if (f != NULL) {
-        int bestDiff, thisDiff;
+        int bestDiff;
         bool eof;
 
-        bestDiff = 32767;
-        eof = FALSE;
-        while (!eof && bestDiff > 0 ) {
+        for (bestDiff = 32767, eof = FALSE;
+             !eof && bestDiff > 0; ) {
             struct colorfile_entry const ce = pm_colorget(f);
             if (ce.colorname)  {
-                thisDiff = abs(r - ce.r) + abs(g - ce.g) + abs(b - ce.b);
+                int const thisDiff =
+                    abs(r - (int)ce.r) +
+                    abs(g - (int)ce.g) +
+                    abs(b - (int)ce.b);
+
                 if (thisDiff < bestDiff) {
                     bestDiff = thisDiff;
                     strcpy(colorname, ce.colorname);