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

Function ippAttributeString

cups/ipp-support.c:657–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655 */
656
657size_t /* O - Number of bytes less nul */
658ippAttributeString(
659 ipp_attribute_t *attr, /* I - Attribute */
660 char *buffer, /* I - String buffer or NULL */
661 size_t bufsize) /* I - Size of string buffer */
662{
663 int i; /* Looping var */
664 char *bufptr, /* Pointer into buffer */
665 *bufend, /* End of buffer */
666 temp[256]; /* Temporary string */
667 const char *ptr, /* Pointer into string */
668 *end; /* Pointer to end of string */
669 _ipp_value_t *val; /* Current value */
670
671
672 if (!attr || !attr->name)
673 {
674 if (buffer)
675 *buffer = '\0';
676
677 return (0);
678 }
679
680 bufptr = buffer;
681 if (buffer)
682 bufend = buffer + bufsize - 1;
683 else
684 bufend = NULL;
685
686 for (i = attr->num_values, val = attr->values; i > 0; i --, val ++)
687 {
688 if (val > attr->values)
689 {
690 if (buffer && bufptr < bufend)
691 *bufptr++ = ',';
692 else
693 bufptr ++;
694 }
695
696 switch (attr->value_tag & ~IPP_TAG_CUPS_CONST)
697 {
698 case IPP_TAG_ENUM :
699 ptr = ippEnumString(attr->name, val->integer);
700
701 if (buffer && bufptr < bufend)
702 strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
703
704 bufptr += strlen(ptr);
705 break;
706
707 case IPP_TAG_INTEGER :
708 if (buffer && bufptr < bufend)
709 bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d", val->integer);
710 else
711 bufptr += snprintf(temp, sizeof(temp), "%d", val->integer);
712 break;
713
714 case IPP_TAG_BOOLEAN :

Callers 15

do_monitor_printer_stateFunction · 0.85
do_testFunction · 0.85
print_attrFunction · 0.85
print_csvFunction · 0.85
print_lineFunction · 0.85
with_distinct_valuesFunction · 0.85
debug_attributesFunction · 0.85
process_jobFunction · 0.85
cupsdProcessIPPRequestFunction · 0.85
debug_attributesFunction · 0.85
print_attributesFunction · 0.85
print_attributesFunction · 0.85

Calls 4

ippEnumStringFunction · 0.85
ipp_col_stringFunction · 0.85
_cups_isspaceFunction · 0.85
ippTagStringFunction · 0.85

Tested by 6

print_attributesFunction · 0.68
print_attributesFunction · 0.68
show_defaultFunction · 0.68
monitor_printerFunction · 0.68
show_attributesFunction · 0.68
show_capabilitiesFunction · 0.68