]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/encode.c
Full sweep of all Clang warnings, plus some bug fixes for incorrect memcpy usage.
[thirdparty/cups.git] / cups / encode.c
index 88c7f9bb2bc6959f84e993316ff0f5e747716b94..81b48fb500422802dca3a76a844236b17c2f73ee 100644 (file)
@@ -1,26 +1,18 @@
 /*
- * "$Id: encode.c 7696 2008-06-26 00:54:42Z mike $"
+ * "$Id$"
  *
- *   Option encoding routines for CUPS.
+ * Option encoding routines for CUPS.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products.
  *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- *   which should have been included with this file.  If this file is
- *   file is missing or damaged, see the license at "http://www.cups.org/".
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file.  If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
  *
- *   This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- *   cupsEncodeOptions()   - Encode printer options into IPP attributes.
- *   cupsEncodeOptions2()  - Encode printer options into IPP attributes for
- *                           a group.
- *   _ippFindOption()      - Find the attribute information for an option.
- *   compare_ipp_options() - Compare two IPP options.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
@@ -176,6 +168,8 @@ static const _ipp_option_t ipp_options[] =
   { 0, "job-accounting-user-id", IPP_TAG_NAME,          IPP_TAG_JOB },
   { 0, "job-accounting-user-id-default", IPP_TAG_NAME,  IPP_TAG_PRINTER },
   { 0, "job-authorization-uri",        IPP_TAG_URI,            IPP_TAG_OPERATION },
+  { 0, "job-cancel-after",     IPP_TAG_INTEGER,        IPP_TAG_JOB },
+  { 0, "job-cancel-after-default", IPP_TAG_INTEGER,    IPP_TAG_PRINTER },
   { 0, "job-hold-until",       IPP_TAG_KEYWORD,        IPP_TAG_JOB },
   { 0, "job-id",               IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
   { 0, "job-impressions",      IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
@@ -534,7 +528,7 @@ cupsEncodeOptions2(
       else
         ops ++;
 
-    if (*ops == IPP_OP_CUPS_NONE)
+    if (*ops == IPP_OP_CUPS_NONE && op != IPP_OP_CUPS_NONE)
     {
       DEBUG_printf(("2cupsEncodeOptions2: Skipping \"%s\".", option->name));
       continue;
@@ -672,7 +666,7 @@ cupsEncodeOptions2(
            * Integer/enumeration value...
            */
 
-            attr->values[j].integer = strtol(val, &s, 10);
+            attr->values[j].integer = (int)strtol(val, &s, 10);
 
             DEBUG_printf(("2cupsEncodeOptions2: Added integer option value "
                          "%d...", attr->values[j].integer));
@@ -714,12 +708,12 @@ cupsEncodeOptions2(
              s = val;
            }
            else
-             attr->values[j].range.lower = strtol(val, &s, 10);
+             attr->values[j].range.lower = (int)strtol(val, &s, 10);
 
            if (*s == '-')
            {
              if (s[1])
-               attr->values[j].range.upper = strtol(s + 1, NULL, 10);
+               attr->values[j].range.upper = (int)strtol(s + 1, NULL, 10);
              else
                attr->values[j].range.upper = 2147483647;
             }
@@ -736,10 +730,10 @@ cupsEncodeOptions2(
            * Resolution...
            */
 
-           attr->values[j].resolution.xres = strtol(val, &s, 10);
+           attr->values[j].resolution.xres = (int)strtol(val, &s, 10);
 
            if (*s == 'x')
-             attr->values[j].resolution.yres = strtol(s + 1, &s, 10);
+             attr->values[j].resolution.yres = (int)strtol(s + 1, &s, 10);
            else
              attr->values[j].resolution.yres = attr->values[j].resolution.xres;
 
@@ -872,5 +866,5 @@ compare_ipp_options(_ipp_option_t *a,       /* I - First option */
 
 
 /*
- * End of "$Id: encode.c 7696 2008-06-26 00:54:42Z mike $".
+ * End of "$Id$".
  */