Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 2485:fce2ed3f681f
Change dmParseIntValWithSep() separator spec from char to char *, to specify
varying number of separators.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 28 Apr 2020 14:16:50 +0300 |
parents | 79e3f824a2d0 |
children | 14a4f8d78fe6 |
comparison
equal
deleted
inserted
replaced
2484:79e3f824a2d0 | 2485:fce2ed3f681f |
---|---|
647 | 647 |
648 return TRUE; | 648 return TRUE; |
649 } | 649 } |
650 | 650 |
651 | 651 |
652 BOOL dmParseIntValWithSep(char **arg, unsigned int *value, char *last, const char sep) | 652 BOOL dmParseIntValWithSep(char **arg, unsigned int *value, char *last, const char *sep) |
653 { | 653 { |
654 char *ptr = *arg, *end, *start; | 654 char *ptr = *arg, *end, *start; |
655 | 655 |
656 // Skip any whitespace at start | 656 // Skip any whitespace at start |
657 while (*ptr != 0 && isspace(*ptr)) | 657 while (*ptr != 0 && isspace(*ptr)) |
660 start = ptr; | 660 start = ptr; |
661 | 661 |
662 // Find next not-xdigit/separator | 662 // Find next not-xdigit/separator |
663 while (*ptr != 0 && | 663 while (*ptr != 0 && |
664 (isxdigit(*ptr) || *ptr == 'x' || *ptr == '$') && | 664 (isxdigit(*ptr) || *ptr == 'x' || *ptr == '$') && |
665 *ptr != sep) | 665 strchr(sep, *ptr) == NULL) |
666 ptr++; | 666 ptr++; |
667 | 667 |
668 end = ptr; | 668 end = ptr; |
669 | 669 |
670 // Skip whitespace again | 670 // Skip whitespace again |
818 } | 818 } |
819 else | 819 else |
820 optScaleMode = SCALE_SET; | 820 optScaleMode = SCALE_SET; |
821 | 821 |
822 // Parse the values | 822 // Parse the values |
823 if (dmParseIntValWithSep(&tmpOpt, &tmpUInt, &sep, ':')) | 823 if (dmParseIntValWithSep(&tmpOpt, &tmpUInt, &sep, ":")) |
824 { | 824 { |
825 if (sep == ':' && | 825 if (sep == ':' && |
826 dmParseIntValWithSep(&tmpOpt, &tmpUInt2, &sep, '*')) | 826 dmParseIntValWithSep(&tmpOpt, &tmpUInt2, &sep, "*")) |
827 { | 827 { |
828 optSpec.scaleX = tmpUInt; | 828 optSpec.scaleX = tmpUInt; |
829 optSpec.scaleY = tmpUInt2; | 829 optSpec.scaleY = tmpUInt2; |
830 | 830 |
831 if (sep == '*' && | 831 if (sep == '*' && |