]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Return 0 from all ippGet* functions on error, to match how all other CUPS APIs
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 29 Apr 2014 15:57:26 +0000 (15:57 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 29 Apr 2014 15:57:26 +0000 (15:57 +0000)
work.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11840 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-1.7.txt
cups/ipp.c

index 272a8087b2599ccaa056f9b7951f7de34c31d606..71d4c4dbbebc56a79951617d72780b39b60ac875 100644 (file)
@@ -5,6 +5,8 @@ CHANGES IN CUPS V1.7.3
 
        - Fixed mapping of OutputBin values such as "Tray1"
          (<rdar://problem/16685606>)
+       - Several ippGet* functions incorrectly returned -1 instead of 0 on
+         error.
 
 
 CHANGES IN CUPS V1.7.2
index debc0e0445a1347c98f170b30f36105febcef615..024cef863594b9daf314603b21c73e2e1962f417 100644 (file)
@@ -2178,7 +2178,7 @@ ippFirstAttribute(ipp_t *ipp)             /* I - IPP message */
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Boolean value or -1 on error */
+int                                    /* O - Boolean value or 0 on error */
 ippGetBoolean(ipp_attribute_t *attr,   /* I - IPP attribute */
               int             element) /* I - Value number (0-based) */
 {
@@ -2188,7 +2188,7 @@ ippGetBoolean(ipp_attribute_t *attr,      /* I - IPP attribute */
 
   if (!attr || attr->value_tag != IPP_TAG_BOOLEAN ||
       element < 0 || element >= attr->num_values)
-    return (-1);
+    return (0);
 
  /*
   * Return the value...
@@ -2234,7 +2234,7 @@ ippGetCollection(
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Number of values or -1 on error */
+int                                    /* O - Number of values or 0 on error */
 ippGetCount(ipp_attribute_t *attr)     /* I - IPP attribute */
 {
  /*
@@ -2242,7 +2242,7 @@ ippGetCount(ipp_attribute_t *attr)        /* I - IPP attribute */
   */
 
   if (!attr)
-    return (-1);
+    return (0);
 
  /*
   * Return the number of values...
@@ -2314,7 +2314,7 @@ ippGetGroupTag(ipp_attribute_t *attr)     /* I - IPP attribute */
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Value or -1 on error */
+int                                    /* O - Value or 0 on error */
 ippGetInteger(ipp_attribute_t *attr,   /* I - IPP attribute */
               int             element) /* I - Value number (0-based) */
 {
@@ -2324,7 +2324,7 @@ ippGetInteger(ipp_attribute_t *attr,      /* I - IPP attribute */
 
   if (!attr || (attr->value_tag != IPP_TAG_INTEGER && attr->value_tag != IPP_TAG_ENUM) ||
       element < 0 || element >= attr->num_values)
-    return (-1);
+    return (0);
 
  /*
   * Return the value...
@@ -2403,7 +2403,7 @@ ippGetOctetString(
  * @since CUPS 1.6/OS X 10.8@
  */
 
-ipp_op_t                               /* O - Operation ID or -1 on error */
+ipp_op_t                               /* O - Operation ID or 0 on error */
 ippGetOperation(ipp_t *ipp)            /* I - IPP request message */
 {
  /*
@@ -2411,7 +2411,7 @@ ippGetOperation(ipp_t *ipp)               /* I - IPP request message */
   */
 
   if (!ipp)
-    return ((ipp_op_t)-1);
+    return ((ipp_op_t)0);
 
  /*
   * Return the value...
@@ -2430,7 +2430,7 @@ ippGetOperation(ipp_t *ipp)               /* I - IPP request message */
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Lower value of range or -1 */
+int                                    /* O - Lower value of range or 0 */
 ippGetRange(ipp_attribute_t *attr,     /* I - IPP attribute */
            int             element,    /* I - Value number (0-based) */
            int             *uppervalue)/* O - Upper value of range */
@@ -2443,9 +2443,9 @@ ippGetRange(ipp_attribute_t *attr,        /* I - IPP attribute */
       element < 0 || element >= attr->num_values)
   {
     if (uppervalue)
-      *uppervalue = -1;
+      *uppervalue = 0;
 
-    return (-1);
+    return (0);
   }
 
  /*
@@ -2465,7 +2465,7 @@ ippGetRange(ipp_attribute_t *attr,        /* I - IPP attribute */
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Request ID or -1 on error */
+int                                    /* O - Request ID or 0 on error */
 ippGetRequestId(ipp_t *ipp)            /* I - IPP message */
 {
  /*
@@ -2473,7 +2473,7 @@ ippGetRequestId(ipp_t *ipp)               /* I - IPP message */
   */
 
   if (!ipp)
-    return (-1);
+    return (0);
 
  /*
   * Return the request ID...
@@ -2492,7 +2492,7 @@ ippGetRequestId(ipp_t *ipp)               /* I - IPP message */
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Horizontal/cross feed resolution or -1 */
+int                                    /* O - Horizontal/cross feed resolution or 0 */
 ippGetResolution(
     ipp_attribute_t *attr,             /* I - IPP attribute */
     int             element,           /* I - Value number (0-based) */
@@ -2505,7 +2505,15 @@ ippGetResolution(
 
   if (!attr || attr->value_tag != IPP_TAG_RESOLUTION ||
       element < 0 || element >= attr->num_values)
-    return (-1);
+  {
+    if (yres)
+      *yres = 0;
+
+    if (units)
+      *units = (ipp_res_t)0;
+
+    return (0);
+  }
 
  /*
   * Return the value...
@@ -2633,7 +2641,7 @@ ippGetValueTag(ipp_attribute_t *attr)     /* I - IPP attribute */
  * @since CUPS 1.6/OS X 10.8@
  */
 
-int                                    /* O - Major version number or -1 on error */
+int                                    /* O - Major version number or 0 on error */
 ippGetVersion(ipp_t *ipp,              /* I - IPP message */
               int   *minor)            /* O - Minor version number or @code NULL@ */
 {
@@ -2644,9 +2652,9 @@ ippGetVersion(ipp_t *ipp,         /* I - IPP message */
   if (!ipp)
   {
     if (minor)
-      *minor = -1;
+      *minor = 0;
 
-    return (-1);
+    return (0);
   }
 
  /*