From: msweet Date: Wed, 28 Oct 2015 17:21:45 +0000 (+0000) Subject: Fix symbolic name to enum mapping (first value wasn't mapped) X-Git-Tag: v2.2b1~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db3b30894c54178ab60544622e259c49193d897b;p=thirdparty%2Fcups.git Fix symbolic name to enum mapping (first value wasn't mapped) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12951 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/test/ipptool.c b/test/ipptool.c index 9f4551566a..566430825c 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -1729,7 +1729,25 @@ do_tests(FILE *outfile, /* I - Output file */ int values[100], /* Values */ num_values = 1; /* Number of values */ - values[0] = (int)strtol(token, &tokenptr, 10); + if (!isdigit(token[0] & 255) && token[0] != '-' && value == IPP_TAG_ENUM) + { + char *ptr; /* Pointer to next terminator */ + + if ((ptr = strchr(token, ',')) != NULL) + *ptr++ = '\0'; + else + ptr = token + strlen(token); + + if ((i = ippEnumValue(attr, token)) < 0) + tokenptr = NULL; + else + tokenptr = ptr; + } + else + i = (int)strtol(tokenptr, &tokenptr, 0); + + values[0] = i; + while (tokenptr && *tokenptr && num_values < (int)(sizeof(values) / sizeof(values[0]))) { @@ -1738,24 +1756,20 @@ do_tests(FILE *outfile, /* I - Output file */ if (!isdigit(*tokenptr & 255) && *tokenptr != '-') { - char *ptr, ch; /* Pointer to next terminator */ + char *ptr; /* Pointer to next terminator */ if (value != IPP_TAG_ENUM) break; if ((ptr = strchr(tokenptr, ',')) != NULL) - { - ch = *ptr; - *ptr = '\0'; - } + *ptr++ = '\0'; else - { - ch = '\0'; ptr = tokenptr + strlen(tokenptr); - } if ((i = ippEnumValue(attr, tokenptr)) < 0) break; + + tokenptr = ptr; } else i = (int)strtol(tokenptr, &tokenptr, 0);