Mercurial > hg > dmlib
diff tools/gfxconv.c @ 2004:161e731eb152
Improve dmGetIntVal() to accept an optional negative value boolean flag
pointer. Also improve error handling in it.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 07 Jul 2018 01:11:22 +0300 |
parents | 8896d5676f1b |
children | 2ff214f811b4 |
line wrap: on
line diff
--- a/tools/gfxconv.c Tue Jul 03 09:54:14 2018 +0300 +++ b/tools/gfxconv.c Sat Jul 07 01:11:22 2018 +0300 @@ -381,7 +381,7 @@ } else { - if (!dmGetIntVal(opt, &value->from)) + if (!dmGetIntVal(opt, &value->from, NULL)) { dmErrorMsg("Invalid %s value '%s', could not parse source value '%s'.\n", msg, popt, opt); goto error; @@ -394,7 +394,7 @@ while (*split && isspace(*split)) split++; // Parse destination value - if (!dmGetIntVal(split, &value->to)) + if (!dmGetIntVal(split, &value->to, NULL)) { dmErrorMsg("Invalid %s value '%s', could not parse destination value '%s'.\n", msg, popt, split); goto error; @@ -449,7 +449,7 @@ return FALSE; } - if (!dmGetIntVal(opt, &value[index])) + if (!dmGetIntVal(opt, &value[index], NULL)) { dmErrorMsg("Invalid %s value '%s', could not parse.\n", msg, opt); return FALSE; @@ -606,7 +606,7 @@ *arg = ptr; - return dmGetIntVal(start, value); + return dmGetIntVal(start, value, NULL); } @@ -653,7 +653,7 @@ break; case 4: - if (!dmGetIntVal(optArg, &optInSkip)) + if (!dmGetIntVal(optArg, &optInSkip, NULL)) { dmErrorMsg("Invalid skip value argument '%s'.\n", optArg); return FALSE; @@ -696,7 +696,7 @@ break; case 7: - if (!dmGetIntVal(optArg, &tmpUInt) || + if (!dmGetIntVal(optArg, &tmpUInt, NULL) || tmpUInt < 1) { dmErrorMsg("Invalid count value argument '%s' [1 .. MAXINT]\n", @@ -768,7 +768,7 @@ break; case 11: - if (!dmGetIntVal(optArg, &tmpUInt) || + if (!dmGetIntVal(optArg, &tmpUInt, NULL) || tmpUInt < 1 || tmpUInt > 512) { dmErrorMsg("Invalid planed width value '%s' [1 .. 512]\n", @@ -783,7 +783,7 @@ break; case 13: - if (!dmGetIntVal(optArg, &tmpUInt) || + if (!dmGetIntVal(optArg, &tmpUInt, NULL) || tmpUInt < 1 || tmpUInt > 8) { dmErrorMsg("Invalid number of bitplanes value '%s' [1 .. 8]\n", @@ -794,7 +794,7 @@ break; case 18: - if (!dmGetIntVal(optArg, &tmpUInt) || + if (!dmGetIntVal(optArg, &tmpUInt, NULL) || tmpUInt < 1 || tmpUInt > 32) { dmErrorMsg("Invalid number of bits per pixel value '%s' [1 .. 32]\n",