]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix symbolic name to enum mapping (first value wasn't mapped)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 28 Oct 2015 17:21:45 +0000 (17:21 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 28 Oct 2015 17:21:45 +0000 (17:21 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12951 a1ca3aef-8c08-0410-bb20-df032aa958be

test/ipptool.c

index 9f4551566a12e9f91f2b4d8a77b7fe726900d0f9..566430825ca658bc6f2966a0ded9a06a1a8a0efb 100644 (file)
@@ -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);