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

Function ippContainsInteger

cups/ipp.c:1329–1367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1327 */
1328
1329int /* O - 1 on a match, 0 on no match */
1330ippContainsInteger(
1331 ipp_attribute_t *attr, /* I - Attribute */
1332 int value) /* I - Integer/enum value */
1333{
1334 int i; /* Looping var */
1335 _ipp_value_t *avalue; /* Current attribute value */
1336
1337
1338 /*
1339 * Range check input...
1340 */
1341
1342 if (!attr)
1343 return (0);
1344
1345 if (attr->value_tag != IPP_TAG_INTEGER && attr->value_tag != IPP_TAG_ENUM &&
1346 attr->value_tag != IPP_TAG_RANGE)
1347 return (0);
1348
1349 /*
1350 * Compare...
1351 */
1352
1353 if (attr->value_tag == IPP_TAG_RANGE)
1354 {
1355 for (i = attr->num_values, avalue = attr->values; i > 0; i --, avalue ++)
1356 if (value >= avalue->range.lower && value <= avalue->range.upper)
1357 return (1);
1358 }
1359 else
1360 {
1361 for (i = attr->num_values, avalue = attr->values; i > 0; i --, avalue ++)
1362 if (value == avalue->integer)
1363 return (1);
1364 }
1365
1366 return (0);
1367}
1368
1369
1370/*

Callers 3

with_value_fromFunction · 0.85
_ppdCreateFromIPP2Function · 0.85
cups_collection_containsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected