Skip to content

Commit

Permalink
Fix non-quick copies of collection values.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed May 3, 2024
1 parent ce40a05 commit aba9170
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Changes in CUPS v2.5b1 (TBA)
- Fixed CGI program initialization and validation of form checkbox and text
fields.
- Fixed finishing support in ippeveps.
- Fixed non-quick copy of collection values.
- Removed hash support for SHA2-512-224 and SHA2-512-256.
- Removed `mantohtml` script for generating html pages (use
`https://www.msweet.org/mantohtml/`)
Expand Down
36 changes: 29 additions & 7 deletions cups/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1434,15 +1434,37 @@ ippCopyAttribute(
break;

case IPP_TAG_BEGIN_COLLECTION :
for (i = srcattr->num_values, srcval = srcattr->values, dstattr = NULL; i > 0; i --, srcval ++)
if (quickcopy)
{
for (i = srcattr->num_values, srcval = srcattr->values, dstattr = NULL; i > 0; i --, srcval ++)
{
if (srcval->collection)
{
if (dstattr)
ippSetCollection(dst, &dstattr, ippGetCount(dstattr), srcval->collection);
else
dstattr = ippAddCollection(dst, srcattr->group_tag, srcattr->name, srcval->collection);
}
}
}
else
{
if (srcval->collection)
for (i = srcattr->num_values, srcval = srcattr->values, dstattr = NULL; i > 0; i --, srcval ++)
{
if (dstattr)
ippSetCollection(dst, &dstattr, ippGetCount(dstattr), srcval->collection);
else
dstattr = ippAddCollection(dst, srcattr->group_tag, srcattr->name, srcval->collection);
}
if (srcval->collection)
{
ipp_t *col = ippNew(); // Copy of collection

ippCopyAttributes(col, srcval->collection, false, /*cb*/NULL, /*cb_data*/NULL);

if (dstattr)
ippSetCollection(dst, &dstattr, ippGetCount(dstattr), col);
else
dstattr = ippAddCollection(dst, srcattr->group_tag, srcattr->name, col);

col->use --;
}
}
}
break;

Expand Down

0 comments on commit aba9170

Please sign in to comment.