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

Function expect_matches

tools/ipptool.c:2291–2490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2289 */
2290
2291static int /* O - 1 if matches, 0 otherwise */
2292expect_matches(
2293 ipptool_expect_t *expect, /* I - Expected attribute */
2294 ipp_attribute_t *attr) /* I - Attribute */
2295{
2296 int i, /* Looping var */
2297 count, /* Number of values */
2298 match; /* Match? */
2299 char *of_type, /* Type name to match */
2300 *paren, /* Pointer to opening parenthesis */
2301 *next, /* Next name to match */
2302 sep; /* Separator character */
2303 ipp_tag_t value_tag; /* Syntax/value tag */
2304 int lower, upper; /* Lower and upper bounds for syntax */
2305
2306
2307 /*
2308 * If we don't expect a particular type, return immediately...
2309 */
2310
2311 if (!expect->of_type)
2312 return (1);
2313
2314 /*
2315 * Parse the "of_type" value since the string can contain multiple attribute
2316 * types separated by "," or "|"...
2317 */
2318
2319 value_tag = ippGetValueTag(attr);
2320 count = ippGetCount(attr);
2321
2322 for (of_type = expect->of_type, match = 0; !match && *of_type; of_type = next)
2323 {
2324 /*
2325 * Find the next separator, and set it (temporarily) to nul if present.
2326 */
2327
2328 for (next = of_type; *next && *next != '|' && *next != ','; next ++);
2329
2330 if ((sep = *next) != '\0')
2331 *next = '\0';
2332
2333 /*
2334 * Support some meta-types to make it easier to write the test file.
2335 */
2336
2337 if ((paren = strchr(of_type, '(')) != NULL)
2338 {
2339 char *ptr; // Pointer into syntax string
2340
2341 *paren = '\0';
2342
2343 if (!strncmp(paren + 1, "MIN:", 4))
2344 {
2345 lower = INT_MIN;
2346 ptr = paren + 5;
2347 }
2348 else if ((ptr = strchr(paren + 1, ':')) != NULL)

Callers 2

do_monitor_printer_stateFunction · 0.85
do_testFunction · 0.85

Calls 7

ippGetValueTagFunction · 0.85
ippGetCountFunction · 0.85
ippGetStringFunction · 0.85
ippTagValueFunction · 0.85
ippGetOctetStringFunction · 0.85
ippGetIntegerFunction · 0.85
ippGetRangeFunction · 0.85

Tested by

no test coverage detected