| 3748 | */ |
| 3749 | |
| 3750 | int /* O - 1 on success, 0 on failure */ |
| 3751 | ippSetValueTag( |
| 3752 | ipp_t *ipp, /* I - IPP message */ |
| 3753 | ipp_attribute_t **attr, /* IO - IPP attribute */ |
| 3754 | ipp_tag_t value_tag) /* I - Value tag */ |
| 3755 | { |
| 3756 | int i; /* Looping var */ |
| 3757 | _ipp_value_t *value; /* Current value */ |
| 3758 | int integer; /* Current integer value */ |
| 3759 | cups_lang_t *language; /* Current language */ |
| 3760 | char code[32]; /* Language code */ |
| 3761 | ipp_tag_t temp_tag; /* Temporary value tag */ |
| 3762 | |
| 3763 | |
| 3764 | /* |
| 3765 | * Range check input... |
| 3766 | */ |
| 3767 | |
| 3768 | if (!ipp || !attr || !*attr) |
| 3769 | return (0); |
| 3770 | |
| 3771 | /* |
| 3772 | * If there is no change, return immediately... |
| 3773 | */ |
| 3774 | |
| 3775 | if (value_tag == (*attr)->value_tag) |
| 3776 | return (1); |
| 3777 | |
| 3778 | /* |
| 3779 | * Otherwise implement changes as needed... |
| 3780 | */ |
| 3781 | |
| 3782 | temp_tag = (ipp_tag_t)((int)((*attr)->value_tag) & IPP_TAG_CUPS_MASK); |
| 3783 | |
| 3784 | switch (value_tag) |
| 3785 | { |
| 3786 | case IPP_TAG_UNSUPPORTED_VALUE : |
| 3787 | case IPP_TAG_DEFAULT : |
| 3788 | case IPP_TAG_UNKNOWN : |
| 3789 | case IPP_TAG_NOVALUE : |
| 3790 | case IPP_TAG_NOTSETTABLE : |
| 3791 | case IPP_TAG_DELETEATTR : |
| 3792 | case IPP_TAG_ADMINDEFINE : |
| 3793 | /* |
| 3794 | * Free any existing values... |
| 3795 | */ |
| 3796 | |
| 3797 | if ((*attr)->num_values > 0) |
| 3798 | ipp_free_values(*attr, 0, (*attr)->num_values); |
| 3799 | |
| 3800 | /* |
| 3801 | * Set out-of-band value... |
| 3802 | */ |
| 3803 | |
| 3804 | (*attr)->value_tag = value_tag; |
| 3805 | break; |
| 3806 | |
| 3807 | case IPP_TAG_RANGE : |
no test coverage detected