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

Function ippSetResolution

cups/ipp.c:3383–3415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3381 */
3382
3383int /* O - 1 on success, 0 on failure */
3384ippSetResolution(
3385 ipp_t *ipp, /* I - IPP message */
3386 ipp_attribute_t **attr, /* IO - IPP attribute */
3387 int element, /* I - Value number (0-based) */
3388 ipp_res_t unitsvalue, /* I - Resolution units */
3389 int xresvalue, /* I - Horizontal/cross feed resolution */
3390 int yresvalue) /* I - Vertical/feed resolution */
3391{
3392 _ipp_value_t *value; /* Current value */
3393
3394
3395 /*
3396 * Range check input...
3397 */
3398
3399 if (!ipp || !attr || !*attr || ((*attr)->value_tag != IPP_TAG_RESOLUTION && (*attr)->value_tag != IPP_TAG_NOVALUE && (*attr)->value_tag != IPP_TAG_UNKNOWN) || element < 0 || element > (*attr)->num_values || xresvalue <= 0 || yresvalue <= 0 || unitsvalue < IPP_RES_PER_INCH || unitsvalue > IPP_RES_PER_CM)
3400 return (0);
3401
3402 /*
3403 * Set the value and return...
3404 */
3405
3406 if ((value = ipp_set_value(ipp, attr, element)) != NULL)
3407 {
3408 (*attr)->value_tag = IPP_TAG_RESOLUTION;
3409 value->resolution.units = unitsvalue;
3410 value->resolution.xres = xresvalue;
3411 value->resolution.yres = yresvalue;
3412 }
3413
3414 return (value != NULL);
3415}
3416
3417
3418/*

Callers 2

_cupsEncodeOptionFunction · 0.85
parse_valueFunction · 0.85

Calls 1

ipp_set_valueFunction · 0.85

Tested by

no test coverage detected