From bb54b17e78aa4af15c8b2898e152e7be76818146 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 22 Feb 2018 14:07:21 -0500 Subject: [PATCH] _cupsEncodeOption should return the attribute that has been encoded. --- cups/cups-private.h | 2 +- cups/encode.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cups/cups-private.h b/cups/cups-private.h index 412308c1c..27246dc90 100644 --- a/cups/cups-private.h +++ b/cups/cups-private.h @@ -232,7 +232,7 @@ extern void _cupsBufferRelease(char *b); extern http_t *_cupsConnect(void); extern char *_cupsCreateDest(const char *name, const char *info, const char *device_id, const char *device_uri, char *uri, size_t urisize); -extern void _cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, _ipp_option_t *map, const char *name, const char *value); +extern ipp_attribute_t *_cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, _ipp_option_t *map, const char *name, const char *value); extern int _cupsGet1284Values(const char *device_id, cups_option_t **values); extern const char *_cupsGetDestResource(cups_dest_t *dest, unsigned flags, char *resource, size_t resourcesize); extern int _cupsGetDests(http_t *http, ipp_op_t op, const char *name, cups_dest_t **dests, cups_ptype_t type, cups_ptype_t mask); diff --git a/cups/encode.c b/cups/encode.c index d18389e65..927b4a2ed 100644 --- a/cups/encode.c +++ b/cups/encode.c @@ -337,7 +337,7 @@ static int compare_ipp_options(_ipp_option_t *a, _ipp_option_t *b); * '_cupsEncodeOption()' - Encode a single option as an IPP attribute. */ -void +ipp_attribute_t * /* O - New attribute or @code NULL@ on error */ _cupsEncodeOption( ipp_t *ipp, /* I - IPP request/response/collection */ ipp_tag_t group_tag, /* I - Group tag */ @@ -417,7 +417,7 @@ _cupsEncodeOption( */ DEBUG_puts("1_cupsEncodeOption: Ran out of memory for attributes."); - return; + return (NULL); } if (count > 1) @@ -434,7 +434,7 @@ _cupsEncodeOption( DEBUG_puts("1_cupsEncodeOption: Ran out of memory for value copy."); ippDeleteAttribute(ipp, attr); - return; + return (NULL); } val = copy; @@ -605,7 +605,7 @@ _cupsEncodeOption( free(copy); ippDeleteAttribute(ipp, attr); - return; + return (NULL); } ippSetCollection(ipp, &attr, i, collection); @@ -621,6 +621,8 @@ _cupsEncodeOption( if (copy) free(copy); + + return (attr); } @@ -688,7 +690,7 @@ cupsEncodeOptions2( op = ippGetOperation(ipp); - if (group_tag == IPP_TAG_OPERATION && (op == IPP_OP_PRINT_JOB || op == IPP_OP_PRINT_URI || op == IPP_OP_SEND_DOCUMENT || op == IPP_OP_SEND_URI)) + if (group_tag == IPP_TAG_OPERATION && (op == IPP_OP_PRINT_JOB || op == IPP_OP_PRINT_URI || op == IPP_OP_SEND_DOCUMENT || op == IPP_OP_SEND_URI)) { /* * Handle the document format stuff first... -- 2.39.2