diff tools/gfxconv.c @ 871:fc272f5f2d15

Make value type of dmGetIntVal() unsigned.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Feb 2015 20:27:12 +0200
parents 56e12109b936
children 9541ea963e75
line wrap: on
line diff
--- a/tools/gfxconv.c	Tue Feb 03 20:07:38 2015 +0200
+++ b/tools/gfxconv.c	Tue Feb 03 20:27:12 2015 +0200
@@ -111,7 +111,7 @@
 {
     BOOL triplet, alpha;
     DMColor color;
-    int from, to;
+    unsigned int from, to;
 } DMMapValue;
 
 
@@ -125,8 +125,8 @@
         optOutSubFormat = IMGFMT_PNG,
         optItemCount = -1,
         optPlanedWidth = 1,
-        optForcedFormat = -1,
-        optInSkip = 0;
+        optForcedFormat = -1;
+unsigned int optInSkip = 0;
 
 int     optCropMode = CROP_NONE,
         optCropX0, optCropY0,
@@ -310,7 +310,7 @@
 }
 
 
-static BOOL dmParseMapOptionMapItem(const char *popt, DMMapValue *value, const int nmax, const char *msg)
+static BOOL dmParseMapOptionMapItem(const char *popt, DMMapValue *value, const unsigned int nmax, const char *msg)
 {
     char *end, *split, *opt = dm_strdup(popt);
 
@@ -373,13 +373,13 @@
         goto error;
     }
 
-    if (!value->triplet && (value->from < 0 || value->from > 255))
+    if (!value->triplet && value->from > 255)
     {
         dmError("Invalid %s map source color index value %d, must be [0..255].\n", msg, value->from);
         goto error;
     }
 
-    if (value->to < 0 || value->to > nmax)
+    if (value->to > nmax)
     {
         dmError("Invalid %s map destination color index value %d, must be [0..%d].\n", msg, value->to, nmax);
         goto error;
@@ -414,7 +414,7 @@
     }
     else
     {
-        int *value = (int *) pvalue;
+        unsigned int *value = (unsigned int *) pvalue;
         char *split = strchr(opt, ':');
         if (split != NULL)
         {