ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddBoolean(%p, %02x, \'%s\', %d)\n", ipp, group, name, value));
+ DEBUG_printf(("ippAddBoolean(ipp=%p, group=%02x(%s), name=\"%s\", value=%d)\n",
+ ipp, group, ippTagString(group), name, value));
- if (ipp == NULL || name == NULL)
+ if (!ipp || !name)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_value_t *value; /* Current value */
- DEBUG_printf(("ippAddBooleans(%p, %02x, \'%s\', %d, %p)\n", ipp,
- group, name, num_values, values));
+ DEBUG_printf(("ippAddBooleans(ipp=%p, group=%02x(%s), name=\"%s\", "
+ "num_values=%d, values=%p)\n", ipp, group, ippTagString(group),
+ name, num_values, values));
- if (ipp == NULL || name == NULL || num_values < 1)
+ if (!ipp || !name || num_values < 1)
return (NULL);
if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddCollection(%p, %02x, \'%s\', %p)\n", ipp, group, name,
- value));
+ DEBUG_printf(("ippAddCollection(ipp=%p, group=%02x(%s), name=\"%s\", "
+ "value=%p)\n", ipp, group, ippTagString(group), name, value));
- if (ipp == NULL || name == NULL)
+ if (!ipp || !name)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_value_t *value; /* Current value */
- DEBUG_printf(("ippAddCollections(%p, %02x, \'%s\', %d, %p)\n", ipp,
- group, name, num_values, values));
+ DEBUG_printf(("ippAddCollections(ipp=%p, group=%02x(%s), name=\"%s\", "
+ "num_values=%d, values=%p)\n", ipp, group, ippTagString(group),
+ name, num_values, values));
- if (ipp == NULL || name == NULL || num_values < 1)
+ if (!ipp || !name || num_values < 1)
return (NULL);
if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddDate(%p, %02x, \'%s\', %p)\n", ipp, group, name,
- value));
+ DEBUG_printf(("ippAddDate(ipp=%p, group=%02x(%s), name=\"%s\", value=%p)\n",
+ ipp, group, ippTagString(group), name, value));
- if (ipp == NULL || name == NULL || value == NULL)
+ if (!ipp || !name || !value)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddInteger(%p, %d, \'%s\', %d)\n", ipp, group, name,
- value));
+ DEBUG_printf(("ippAddInteger(ipp=%p, group=%02x(%s), type=%02x(%s), "
+ "name=\"%s\", value=%d)\n", ipp, group, ippTagString(group),
+ type, ippTagString(type), name, value));
- if (ipp == NULL || name == NULL)
+ if (!ipp || !name)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_value_t *value; /* Current value */
- if (ipp == NULL || name == NULL || num_values < 1)
+ DEBUG_printf(("ippAddIntegers(ipp=%p, group=%02x(%s), type=%02x(%s), "
+ "name=\"%s\", num_values=%d, values=%p)\n", ipp,
+ group, ippTagString(group), type, ippTagString(type), name,
+ num_values, values));
+
+ if (!ipp || !name || num_values < 1)
return (NULL);
if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
*bufptr; /* Pointer into buffer */
- if (ipp == NULL || name == NULL)
+ DEBUG_printf(("ippAddString(ipp=%p, group=%02x(%s), type=%02x(%s), "
+ "name=\"%s\", charset=\"%s\", value=\"%s\")\n", ipp,
+ group, ippTagString(group), type, ippTagString(type), name,
+ charset, value));
+
+ if (!ipp || !name)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_value_t *value; /* Current value */
- if (ipp == NULL || name == NULL || num_values < 1)
+ DEBUG_printf(("ippAddStrings(ipp=%p, group=%02x(%s), type=%02x(%s), "
+ "name=\"%s\", num_values=%d, charset=\"%s\", values=%p)\n", ipp,
+ group, ippTagString(group), type, ippTagString(type), name,
+ num_values, charset, values));
+
+ if (!ipp || !name || num_values < 1)
return (NULL);
if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
ipp_attribute_t *attr; /* New attribute */
- if (ipp == NULL || name == NULL)
+ DEBUG_printf(("ippAddRange(ipp=%p, group=%02x(%s), name=\"%s\", lower=%d, "
+ "upper=%d)\n", ipp, group, ippTagString(group), name, lower,
+ upper));
+
+ if (!ipp || !name)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_value_t *value; /* Current value */
- if (ipp == NULL || name == NULL || num_values < 1)
+ DEBUG_printf(("ippAddRanges(ipp=%p, group=%02x(%s), name=\"%s\", "
+ "num_values=%d, lower=%p, upper=%p)\n", ipp, group,
+ ippTagString(group), name, num_values, lower, upper));
+
+ if (!ipp || !name || num_values < 1)
return (NULL);
if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
ipp_attribute_t *attr; /* New attribute */
- if (ipp == NULL || name == NULL)
+ DEBUG_printf(("ippAddResolution(ipp=%p, group=%02x(%s), name=\"%s\", "
+ "units=%d, xres=%d, yres=%d)\n", ipp, group,
+ ippTagString(group), name, units, xres, yres));
+
+ if (!ipp || !name)
return (NULL);
if ((attr = _ippAddAttr(ipp, 1)) == NULL)
ipp_value_t *value; /* Current value */
- if (ipp == NULL || name == NULL || num_values < 1)
+ DEBUG_printf(("ippAddResolutions(ipp=%p, group=%02x(%s), name=\"%s\", "
+ "num_value=%d, units=%d, xres=%p, yres=%p)\n", ipp, group,
+ ippTagString(group), name, num_values, units, xres, yres));
+
+ if (!ipp || !name || num_values < 1)
return (NULL);
if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddSeparator(%p)\n", ipp));
+ DEBUG_printf(("ippAddSeparator(ipp=%p)\n", ipp));
- if (ipp == NULL)
+ if (!ipp)
return (NULL);
if ((attr = _ippAddAttr(ipp, 0)) == NULL)
time_t t; /* Computed time */
+ if (!date)
+ return (0);
+
memset(&unixdate, 0, sizeof(unixdate));
/*
*next; /* Next attribute */
- DEBUG_printf(("ippDelete(): %p\n", ipp));
+ DEBUG_printf(("ippDelete(ipp=%p)\n", ipp));
- if (ipp == NULL)
+ if (!ipp)
return;
for (attr = ipp->attrs; attr != NULL; attr = next)
*prev; /* Previous attribute */
+ DEBUG_printf(("ippDeleteAttribute(ipp=%p, attr=%p)\n", ipp, attr));
+
/*
* Find the attribute in the list...
*/
const char *name, /* I - Name of attribute */
ipp_tag_t type) /* I - Type of attribute */
{
- DEBUG_printf(("ippFindAttribute(%p, \'%s\')\n", ipp, name));
+ DEBUG_printf(("ippFindAttribute(ipp=%p, name=\"%s\", type=%02x(%s))\n", ipp,
+ name, type, ippTagString(type)));
- if (ipp == NULL || name == NULL)
+ if (!ipp || !name)
return (NULL);
/*
ipp_tag_t value_tag; /* Value tag */
- DEBUG_printf(("ippFindNextAttribute(%p, \'%s\')\n", ipp, name));
+ DEBUG_printf(("ippFindNextAttribute(ipp=%p, name=\"%s\", type=%02x(%s))\n",
+ ipp, name, type, ippTagString(type)));
- if (ipp == NULL || name == NULL)
+ if (!ipp || !name)
return (NULL);
if (ipp->current)
for (; attr != NULL; ipp->prev = attr, attr = attr->next)
{
- DEBUG_printf(("ippFindAttribute: attr = %p, name = \'%s\'\n", attr,
+ DEBUG_printf(("ippFindAttribute: attr=%p, name=\"%s\"\n", attr,
attr->name));
value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK);
cups_lang_t *language; /* Current language localization */
+ DEBUG_printf(("ippNewRequest(op=%02x(%s))\n", op, ippOpString(op)));
+
/*
* Create a new IPP message...
*/
DEBUG_printf(("ippRead(http=%p, ipp=%p), data_remaining=" CUPS_LLFMT "\n",
http, ipp, CUPS_LLCAST (http ? http->data_remaining : -1)));
- if (http == NULL)
+ if (!http)
return (IPP_ERROR);
DEBUG_printf(("ippRead: http->state=%d, http->used=%d\n", http->state,
ippReadFile(int fd, /* I - HTTP data */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippReadFile(%d, %p)\n", fd, ipp));
+ DEBUG_printf(("ippReadFile(fd=%d, ipp=%p)\n", fd, ipp));
return (ippReadIO(&fd, (ipp_iocb_t)ipp_read_file, 1, NULL, ipp));
}
src, cb, blocking, parent, ipp));
DEBUG_printf(("ippReadIO: ipp->state=%d\n", ipp->state));
- if (src == NULL || ipp == NULL)
+ if (!src || !ipp)
return (IPP_ERROR);
switch (ipp->state)
if (buffer[0] != 1)
{
- DEBUG_printf(("ippReadIO: version number (%d.%d) is bad.\n", buffer[0],
- buffer[1]));
+ DEBUG_printf(("ippReadIO: version number (%d.%d) is bad.\n",
+ buffer[0], buffer[1]));
return (IPP_ERROR);
}
ipp->curtag = tag;
ipp->current = NULL;
- DEBUG_printf(("ippReadIO: group tag = %x, ipp->prev=%p\n", tag,
- ipp->prev));
+ DEBUG_printf(("ippReadIO: group tag=%x(%s), ipp->prev=%p\n", tag,
+ ippTagString(tag), ipp->prev));
continue;
}
- DEBUG_printf(("ippReadIO: value tag = %x\n", tag));
+ DEBUG_printf(("ippReadIO: value tag=%x(%s)\n", tag,
+ ippTagString(tag)));
/*
* Get the name...
return (IPP_ERROR);
}
- DEBUG_printf(("ippReadIO: name length = %d\n", n));
+ DEBUG_printf(("ippReadIO: name length=%d\n", n));
if (n == 0 && tag != IPP_TAG_MEMBERNAME &&
tag != IPP_TAG_END_COLLECTION)
attr->value_tag = tag;
}
- else if (value_tag >= IPP_TAG_TEXTLANG &&
- value_tag <= IPP_TAG_MIMETYPE)
+ else if ((value_tag >= IPP_TAG_TEXTLANG &&
+ value_tag <= IPP_TAG_MIMETYPE))
{
/*
* String values can sometimes come across in different
* forms; accept sets of differing values...
*/
- if (tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE)
+ if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
+ tag != IPP_TAG_NOVALUE)
+ {
+ DEBUG_printf(("ippReadIO: 1setOf value tag %x(%s) != %x(%s)\n",
+ value_tag, ippTagString(value_tag), tag,
+ ippTagString(tag)));
return (IPP_ERROR);
+ }
}
else if (value_tag != tag)
+ {
+ DEBUG_printf(("ippReadIO: value tag %x(%s) != %x(%s)\n",
+ value_tag, ippTagString(value_tag), tag,
+ ippTagString(tag)));
return (IPP_ERROR);
+ }
/*
* Finally, reallocate the attribute array as needed...
attr = ipp->current = _ippAddAttr(ipp, 1);
- DEBUG_printf(("ippReadIO: membername, ipp->current=%p, ipp->prev=%p\n",
- ipp->current, ipp->prev));
+ DEBUG_printf(("ippReadIO: membername, ipp->current=%p, "
+ "ipp->prev=%p\n", ipp->current, ipp->prev));
attr->group_tag = ipp->curtag;
attr->value_tag = IPP_TAG_ZERO;
return (IPP_ERROR);
}
- DEBUG_printf(("ippReadIO: name=\'%s\', ipp->current=%p, ipp->prev=%p\n",
- buffer, ipp->current, ipp->prev));
+ DEBUG_printf(("ippReadIO: name=\"%s\", ipp->current=%p, "
+ "ipp->prev=%p\n", buffer, ipp->current, ipp->prev));
attr->group_tag = ipp->curtag;
attr->value_tag = tag;
}
n = (buffer[0] << 8) | buffer[1];
- DEBUG_printf(("ippReadIO: value length = %d\n", n));
+ DEBUG_printf(("ippReadIO: value length=%d\n", n));
switch (tag)
{
value->boolean = buffer[0];
break;
+ case IPP_TAG_NOVALUE :
+ if (attr->value_tag == IPP_TAG_NOVALUE)
+ {
+ if (n == 0)
+ break;
+
+ attr->value_tag = IPP_TAG_TEXT;
+ }
+
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
case IPP_TAG_KEYWORD :
buffer[n] = '\0';
value->string.text = _cupsStrAlloc((char *)buffer);
- DEBUG_printf(("ippReadIO: value = \'%s\'\n",
+ DEBUG_printf(("ippReadIO: value=\"%s\"\n",
value->string.text));
break;
if (n > 0)
{
- DEBUG_puts("ippReadIO: begCollection tag with value length > 0!");
+ DEBUG_puts("ippReadIO: begCollection tag with value length "
+ "> 0!");
return (IPP_ERROR);
}
case IPP_TAG_END_COLLECTION :
if (n > 0)
{
- DEBUG_puts("ippReadIO: endCollection tag with value length > 0!");
+ DEBUG_puts("ippReadIO: endCollection tag with value length "
+ "> 0!");
return (IPP_ERROR);
}
attr->num_values --;
- DEBUG_printf(("ippReadIO: member name = \"%s\"\n", attr->name));
+ DEBUG_printf(("ippReadIO: member name=\"%s\"\n", attr->name));
break;
default : /* Other unsupported values */
ippWrite(http_t *http, /* I - HTTP connection */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippWrite(%p, %p)\n", http, ipp));
+ DEBUG_printf(("ippWrite(http=%p, ipp=%p)\n", http, ipp));
- if (http == NULL)
+ if (!http)
return (IPP_ERROR);
return (ippWriteIO(http, (ipp_iocb_t)httpWrite2,
ippWriteFile(int fd, /* I - HTTP data */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippWriteFile(%d, %p)\n", fd, ipp));
+ DEBUG_printf(("ippWriteFile(fd=%d, ipp=%p)\n", fd, ipp));
ipp->state = IPP_IDLE;
ipp_value_t *value; /* Current value */
- DEBUG_printf(("ippWriteIO(%p, %p, %d, %p, %p)\n", dst, cb, blocking,
- parent, ipp));
+ DEBUG_printf(("ippWriteIO(dst=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)\n",
+ dst, cb, blocking, parent, ipp));
- if (dst == NULL || ipp == NULL)
+ if (!dst || !ipp)
return (IPP_ERROR);
switch (ipp->state)
ipp->curtag = IPP_TAG_ZERO;
DEBUG_printf(("ippWriteIO: version=%d.%d\n", buffer[0], buffer[1]));
- DEBUG_printf(("ippWriteIO: op_status=%04x\n", ipp->request.any.op_status));
- DEBUG_printf(("ippWriteIO: request_id=%d\n", ipp->request.any.request_id));
+ DEBUG_printf(("ippWriteIO: op_status=%04x\n",
+ ipp->request.any.op_status));
+ DEBUG_printf(("ippWriteIO: request_id=%d\n",
+ ipp->request.any.request_id));
/*
* If blocking is disabled, stop here...
if (attr->group_tag == IPP_TAG_ZERO)
continue;
- DEBUG_printf(("ippWriteIO: wrote group tag = %x\n", attr->group_tag));
+ DEBUG_printf(("ippWriteIO: wrote group tag=%x(%s)\n",
+ attr->group_tag, ippTagString(attr->group_tag)));
*bufptr++ = attr->group_tag;
}
else if (attr->group_tag == IPP_TAG_ZERO)
* Write the value tag, name length, and name string...
*/
- DEBUG_printf(("ippWriteIO: writing value tag = %x\n", attr->value_tag));
- DEBUG_printf(("ippWriteIO: writing name = %d, \'%s\'\n", n, attr->name));
+ DEBUG_printf(("ippWriteIO: writing value tag=%x(%s)\n",
+ attr->value_tag, ippTagString(attr->value_tag)));
+ DEBUG_printf(("ippWriteIO: writing name=%d,\"%s\"\n", n,
+ attr->name));
*bufptr++ = attr->value_tag;
*bufptr++ = n >> 8;
* and empty name for the collection member attribute...
*/
- DEBUG_printf(("ippWriteIO: writing value tag = %x\n",
+ DEBUG_printf(("ippWriteIO: writing value tag=%x(memberName)\n",
IPP_TAG_MEMBERNAME));
- DEBUG_printf(("ippWriteIO: writing name = %d, \'%s\'\n", n, attr->name));
- DEBUG_printf(("ippWriteIO: writing value tag = %x\n", attr->value_tag));
- DEBUG_puts("ippWriteIO: writing name = 0, \'\'\n");
+ DEBUG_printf(("ippWriteIO: writing name=%d,\"%s\"\n", n,
+ attr->name));
+ DEBUG_printf(("ippWriteIO: writing value tag=%x(%s)\n",
+ attr->value_tag, ippTagString(attr->value_tag)));
+ DEBUG_puts("ippWriteIO: writing name=0,\"\"\n");
*bufptr++ = IPP_TAG_MEMBERNAME;
*bufptr++ = 0;
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
* values with a zero-length name...
*/
- DEBUG_printf(("ippWriteIO: writing value tag = %x\n",
- attr->value_tag));
- DEBUG_printf(("ippWriteIO: writing name = 0, \'\'\n"));
+ DEBUG_printf(("ippWriteIO: writing value tag=%x(%s)\n",
+ attr->value_tag,
+ ippTagString(attr->value_tag)));
+ DEBUG_printf(("ippWriteIO: writing name=0,\"\"\n"));
if ((sizeof(buffer) - (bufptr - buffer)) < 3)
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
if (n > (sizeof(buffer) - 2))
return (IPP_ERROR);
- DEBUG_printf(("ippWriteIO: writing string = %d, \'%s\'\n", n,
+ DEBUG_printf(("ippWriteIO: writing string=%d,\"%s\"\n", n,
value->string.text));
if ((int)(sizeof(buffer) - (bufptr - buffer)) < (n + 2))
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("ippWriteIO: Could not write IPP "
+ "attribute...");
return (IPP_ERROR);
}
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("_ippAddAttr(%p, %d)\n", ipp, num_values));
+ DEBUG_printf(("_ippAddAttr(ipp=%p, num_values=%d)\n", ipp, num_values));
- if (ipp == NULL || num_values < 0)
+ if (!ipp || num_values < 0)
return (NULL);
attr = calloc(sizeof(ipp_attribute_t) +
ipp_value_t *value; /* Current value */
- DEBUG_printf(("_ippFreeAttr(): %p\n", attr));
+ DEBUG_printf(("_ippFreeAttr(attr=%p)\n", attr));
switch (attr->value_tag)
{