ippSetString(ipp_t           *ipp,	/* I  - IPP message */
             ipp_attribute_t **attr,	/* IO - IPP attribute */
             int             element,	/* I  - Value number (0-based) */
	     const char      *strvalue)	/* I  - String value */
{
  char		*temp;			/* Temporary string */
  _ipp_value_t	*value;			/* Current value */
  ipp_tag_t	value_tag;		/* Value tag */


 /*
  * Range check input...
  */

  if (attr && *attr)
    value_tag = (*attr)->value_tag & IPP_TAG_CUPS_MASK;
  else
    value_tag = IPP_TAG_ZERO;

  if (!ipp || !attr || !*attr || (value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG && value_tag != IPP_TAG_NAMELANG && value_tag != IPP_TAG_NOVALUE && value_tag != IPP_TAG_UNKNOWN) || value_tag > IPP_TAG_MIMETYPE || element < 0 || element > (*attr)->num_values || !strvalue)
    return (0);

 /*
  * Set the value and return...
  */

  if ((value = ipp_set_value(ipp, attr, element)) != NULL)
  {
    if (value_tag == IPP_TAG_NOVALUE || value_tag == IPP_TAG_UNKNOWN)
      (*attr)->value_tag = IPP_TAG_KEYWORD;

    if (element > 0)
      value->string.language = (*attr)->values[0].string.language;

    if ((int)((*attr)->value_tag) & IPP_TAG_CUPS_CONST)
      value->string.text = (char *)strvalue;
    else if ((temp = _cupsStrAlloc(strvalue)) != NULL)
    {
      if (value->string.text)
        _cupsStrFree(value->string.text);

      value->string.text = temp;
    }
    else
      return (0);
  }

  return (value != NULL);
}
ippSetString(ipp_t           *ipp,	 
             ipp_attribute_t **attr,	 
             int             element,	 
	     const char      *strvalue)	 
{
  char		*temp;			 
  _ipp_value_t	*value;			 
  ipp_tag_t	value_tag;		 


  

  if (attr && *attr)
    value_tag = (*attr)->value_tag & IPP_TAG_CUPS_MASK;
  else
    value_tag = IPP_TAG_ZERO;

  if (!ipp || !attr || !*attr || (value_tag < IPP_TAG_TEXT && value_tag != IPP_TAG_TEXTLANG && value_tag != IPP_TAG_NAMELANG && value_tag != IPP_TAG_NOVALUE && value_tag != IPP_TAG_UNKNOWN) || value_tag > IPP_TAG_MIMETYPE || element < 0 || element > (*attr)->num_values || !strvalue)
    return (0);

  

  if ((value = ipp_set_value(ipp, attr, element)) != NULL)
  {
    if (value_tag == IPP_TAG_NOVALUE || value_tag == IPP_TAG_UNKNOWN)
      (*attr)->value_tag = IPP_TAG_KEYWORD;

    if (element > 0)
      value->string.language = (*attr)->values[0].string.language;

    if ((int)((*attr)->value_tag) & IPP_TAG_CUPS_CONST)
      value->string.text = (char *)strvalue;
    else if ((temp = _cupsStrAlloc(strvalue)) != NULL)
    {
      if (value->string.text)
        _cupsStrFree(value->string.text);

      value->string.text = temp;
    }
    else
      return (0);
  }

  return (value != NULL);
}