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

Function ipp_col_string

cups/ipp-support.c:2521–2577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2519 */
2520
2521static size_t /* O - Number of bytes */
2522ipp_col_string(ipp_t *col, /* I - Collection attribute */
2523 char *buffer, /* I - Buffer or NULL */
2524 size_t bufsize) /* I - Size of buffer */
2525{
2526 char *bufptr, /* Position in buffer */
2527 *bufend, /* End of buffer */
2528 prefix = '{', /* Prefix character */
2529 temp[256]; /* Temporary string */
2530 ipp_attribute_t *attr; /* Current member attribute */
2531
2532
2533 if (!col)
2534 {
2535 if (buffer)
2536 *buffer = '\0';
2537
2538 return (0);
2539 }
2540
2541 bufptr = buffer;
2542 bufend = buffer + bufsize - 1;
2543
2544 for (attr = col->attrs; attr; attr = attr->next)
2545 {
2546 if (!attr->name)
2547 continue;
2548
2549 if (buffer && bufptr < bufend)
2550 *bufptr = prefix;
2551 bufptr ++;
2552 prefix = ' ';
2553
2554 if (buffer && bufptr < bufend)
2555 bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%s=", attr->name);
2556 else
2557 bufptr += strlen(attr->name) + 1;
2558
2559 if (buffer && bufptr < bufend)
2560 bufptr += ippAttributeString(attr, bufptr, (size_t)(bufend - bufptr + 1));
2561 else
2562 bufptr += ippAttributeString(attr, temp, sizeof(temp));
2563 }
2564
2565 if (prefix == '{')
2566 {
2567 if (buffer && bufptr < bufend)
2568 *bufptr = prefix;
2569 bufptr ++;
2570 }
2571
2572 if (buffer && bufptr < bufend)
2573 *bufptr = '}';
2574 bufptr ++;
2575
2576 return ((size_t)(bufptr - buffer));
2577}

Callers 1

ippAttributeStringFunction · 0.85

Calls 1

ippAttributeStringFunction · 0.85

Tested by

no test coverage detected