MCPcopy Create free account
hub / github.com/OpenPrinting/cups / ppd_decode

Function ppd_decode

cups/ppd.c:2535–2585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2533 */
2534
2535static int /* O - Length of decoded string */
2536ppd_decode(char *string) /* I - String to decode */
2537{
2538 char *inptr, /* Input pointer */
2539 *outptr; /* Output pointer */
2540
2541
2542 inptr = string;
2543 outptr = string;
2544
2545 while (*inptr != '\0')
2546 if (*inptr == '<' && isxdigit(inptr[1] & 255))
2547 {
2548 /*
2549 * Convert hex to 8-bit values...
2550 */
2551
2552 inptr ++;
2553 while (isxdigit(*inptr & 255))
2554 {
2555 if (_cups_isalpha(*inptr))
2556 *outptr = (char)((tolower(*inptr) - 'a' + 10) << 4);
2557 else
2558 *outptr = (char)((*inptr - '0') << 4);
2559
2560 inptr ++;
2561
2562 if (!isxdigit(*inptr & 255))
2563 break;
2564
2565 if (_cups_isalpha(*inptr))
2566 *outptr |= (char)(tolower(*inptr) - 'a' + 10);
2567 else
2568 *outptr |= (char)(*inptr - '0');
2569
2570 inptr ++;
2571 outptr ++;
2572 }
2573
2574 while (*inptr != '>' && *inptr != '\0')
2575 inptr ++;
2576 while (*inptr == '>')
2577 inptr ++;
2578 }
2579 else
2580 *outptr++ = *inptr++;
2581
2582 *outptr = '\0';
2583
2584 return ((int)(outptr - string));
2585}
2586
2587
2588/*

Callers 2

_ppdOpenFunction · 0.85
ppd_readFunction · 0.85

Calls 1

_cups_isalphaFunction · 0.85

Tested by

no test coverage detected