]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
_cupsEncodeOption should return the attribute that has been encoded.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 22 Feb 2018 19:07:21 +0000 (14:07 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 22 Feb 2018 19:07:21 +0000 (14:07 -0500)
cups/cups-private.h
cups/encode.c

index 412308c1c757ee9fb3c6937f3a462ce93ca6e474..27246dc9033a856ab3c21513fbc952437f4dc049 100644 (file)
@@ -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);
index d18389e650fc6dbdf7e3dfac730698476025ad32..927b4a2ed575c95a748cc99cd0ce55ae5d1e4990 100644 (file)
@@ -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...