Mercurial > hg > dmlib
comparison 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 |
comparison
equal
deleted
inserted
replaced
870:2711f99b40e5 | 871:fc272f5f2d15 |
---|---|
109 | 109 |
110 typedef struct | 110 typedef struct |
111 { | 111 { |
112 BOOL triplet, alpha; | 112 BOOL triplet, alpha; |
113 DMColor color; | 113 DMColor color; |
114 int from, to; | 114 unsigned int from, to; |
115 } DMMapValue; | 115 } DMMapValue; |
116 | 116 |
117 | 117 |
118 | 118 |
119 char *optInFilename = NULL, | 119 char *optInFilename = NULL, |
123 optOutFormat = FFMT_ASCII, | 123 optOutFormat = FFMT_ASCII, |
124 optInSubFormat = IMGFMT_PNG, | 124 optInSubFormat = IMGFMT_PNG, |
125 optOutSubFormat = IMGFMT_PNG, | 125 optOutSubFormat = IMGFMT_PNG, |
126 optItemCount = -1, | 126 optItemCount = -1, |
127 optPlanedWidth = 1, | 127 optPlanedWidth = 1, |
128 optForcedFormat = -1, | 128 optForcedFormat = -1; |
129 optInSkip = 0; | 129 unsigned int optInSkip = 0; |
130 | 130 |
131 int optCropMode = CROP_NONE, | 131 int optCropMode = CROP_NONE, |
132 optCropX0, optCropY0, | 132 optCropX0, optCropY0, |
133 optCropW, optCropH; | 133 optCropW, optCropH; |
134 | 134 |
308 | 308 |
309 return FALSE; | 309 return FALSE; |
310 } | 310 } |
311 | 311 |
312 | 312 |
313 static BOOL dmParseMapOptionMapItem(const char *popt, DMMapValue *value, const int nmax, const char *msg) | 313 static BOOL dmParseMapOptionMapItem(const char *popt, DMMapValue *value, const unsigned int nmax, const char *msg) |
314 { | 314 { |
315 char *end, *split, *opt = dm_strdup(popt); | 315 char *end, *split, *opt = dm_strdup(popt); |
316 | 316 |
317 if (opt == NULL) | 317 if (opt == NULL) |
318 goto error; | 318 goto error; |
371 { | 371 { |
372 dmError("Invalid %s value '%s', could not parse destination value '%s'.\n", msg, popt, split); | 372 dmError("Invalid %s value '%s', could not parse destination value '%s'.\n", msg, popt, split); |
373 goto error; | 373 goto error; |
374 } | 374 } |
375 | 375 |
376 if (!value->triplet && (value->from < 0 || value->from > 255)) | 376 if (!value->triplet && value->from > 255) |
377 { | 377 { |
378 dmError("Invalid %s map source color index value %d, must be [0..255].\n", msg, value->from); | 378 dmError("Invalid %s map source color index value %d, must be [0..255].\n", msg, value->from); |
379 goto error; | 379 goto error; |
380 } | 380 } |
381 | 381 |
382 if (value->to < 0 || value->to > nmax) | 382 if (value->to > nmax) |
383 { | 383 { |
384 dmError("Invalid %s map destination color index value %d, must be [0..%d].\n", msg, value->to, nmax); | 384 dmError("Invalid %s map destination color index value %d, must be [0..%d].\n", msg, value->to, nmax); |
385 goto error; | 385 goto error; |
386 } | 386 } |
387 | 387 |
412 if (!dmParseMapOptionMapItem(opt, &value[index], nmax, msg)) | 412 if (!dmParseMapOptionMapItem(opt, &value[index], nmax, msg)) |
413 return FALSE; | 413 return FALSE; |
414 } | 414 } |
415 else | 415 else |
416 { | 416 { |
417 int *value = (int *) pvalue; | 417 unsigned int *value = (unsigned int *) pvalue; |
418 char *split = strchr(opt, ':'); | 418 char *split = strchr(opt, ':'); |
419 if (split != NULL) | 419 if (split != NULL) |
420 { | 420 { |
421 dmError("Unexpected ':' in indexed %s '%s'.\n", msg, opt); | 421 dmError("Unexpected ':' in indexed %s '%s'.\n", msg, opt); |
422 return FALSE; | 422 return FALSE; |