| 721 | */ |
| 722 | |
| 723 | ipp_attribute_t * /* O - New attribute */ |
| 724 | ippAddResolution(ipp_t *ipp, /* I - IPP message */ |
| 725 | ipp_tag_t group, /* I - IPP group */ |
| 726 | const char *name, /* I - Name of attribute */ |
| 727 | ipp_res_t units, /* I - Units for resolution */ |
| 728 | int xres, /* I - X resolution */ |
| 729 | int yres) /* I - Y resolution */ |
| 730 | { |
| 731 | ipp_attribute_t *attr; /* New attribute */ |
| 732 | |
| 733 | |
| 734 | DEBUG_printf(("ippAddResolution(ipp=%p, group=%02x(%s), name=\"%s\", units=%d, xres=%d, yres=%d)", (void *)ipp, group, |
| 735 | ippTagString(group), name, units, xres, yres)); |
| 736 | |
| 737 | /* |
| 738 | * Range check input... |
| 739 | */ |
| 740 | |
| 741 | if (!ipp || !name || group < IPP_TAG_ZERO || |
| 742 | group == IPP_TAG_END || group >= IPP_TAG_UNSUPPORTED_VALUE || |
| 743 | units < IPP_RES_PER_INCH || units > IPP_RES_PER_CM || |
| 744 | xres < 0 || yres < 0) |
| 745 | return (NULL); |
| 746 | |
| 747 | /* |
| 748 | * Create the attribute... |
| 749 | */ |
| 750 | |
| 751 | if ((attr = ipp_add_attr(ipp, name, group, IPP_TAG_RESOLUTION, 1)) == NULL) |
| 752 | return (NULL); |
| 753 | |
| 754 | attr->values[0].resolution.xres = xres; |
| 755 | attr->values[0].resolution.yres = yres; |
| 756 | attr->values[0].resolution.units = units; |
| 757 | |
| 758 | return (attr); |
| 759 | } |
| 760 | |
| 761 | |
| 762 | /* |
no test coverage detected