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

Function parse_value

cups/ipp-file.c:548–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546 */
547
548static int /* O - 1 on success or 0 on error */
549parse_value(_ipp_file_t *f, /* I - IPP data file */
550 _ipp_vars_t *v, /* I - IPP variables */
551 void *user_data,/* I - User data pointer */
552 ipp_t *ipp, /* I - IPP message */
553 ipp_attribute_t **attr, /* IO - IPP attribute */
554 int element) /* I - Element number */
555{
556 char value[2049], /* Value string */
557 *valueptr, /* Pointer into value string */
558 temp[2049], /* Temporary string */
559 *tempptr; /* Pointer into temporary string */
560 size_t valuelen; /* Length of value */
561
562
563 if (!_ippFileReadToken(f, temp, sizeof(temp)))
564 {
565 report_error(f, v, user_data, "Missing value on line %d of \"%s\".", f->linenum, f->filename);
566 return (0);
567 }
568
569 _ippVarsExpand(v, value, temp, sizeof(value));
570
571 switch (ippGetValueTag(*attr))
572 {
573 case IPP_TAG_BOOLEAN :
574 return (ippSetBoolean(ipp, attr, element, !_cups_strcasecmp(value, "true")));
575
576 case IPP_TAG_ENUM :
577 case IPP_TAG_INTEGER :
578 return (ippSetInteger(ipp, attr, element, (int)strtol(value, NULL, 0)));
579
580 case IPP_TAG_DATE :
581 {
582 int year, /* Year */
583 month, /* Month */
584 day, /* Day of month */
585 hour, /* Hour */
586 minute, /* Minute */
587 second, /* Second */
588 utc_offset = 0; /* Timezone offset from UTC */
589 ipp_uchar_t date[11]; /* dateTime value */
590
591 if (*value == 'P')
592 {
593 /*
594 * Time period...
595 */
596
597 time_t curtime; /* Current time in seconds */
598 int period = 0, /* Current period value */
599 saw_T = 0; /* Saw time separator */
600
601 curtime = time(NULL);
602
603 for (valueptr = value + 1; *valueptr; valueptr ++)
604 {
605 if (isdigit(*valueptr & 255))

Callers 2

_ippFileParseFunction · 0.85
parse_collectionFunction · 0.85

Calls 15

_ippFileReadTokenFunction · 0.85
report_errorFunction · 0.85
_ippVarsExpandFunction · 0.85
ippGetValueTagFunction · 0.85
ippSetBooleanFunction · 0.85
_cups_strcasecmpFunction · 0.85
ippSetIntegerFunction · 0.85
ippSetDateFunction · 0.85
ippTimeToDateFunction · 0.85
ippSetResolutionFunction · 0.85
ippSetRangeFunction · 0.85
ippSetOctetStringFunction · 0.85

Tested by

no test coverage detected