]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix build errors on Fedora.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 14 Feb 2014 20:09:01 +0000 (20:09 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 14 Feb 2014 20:09:01 +0000 (20:09 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11594 a1ca3aef-8c08-0410-bb20-df032aa958be

48 files changed:
backend/dnssd.c
backend/ieee1284.c
backend/snmp.c
backend/testbackend.c
backend/usb-libusb.c
cgi-bin/admin.c
cgi-bin/help-index.c
cgi-bin/ipp-var.c
cgi-bin/var.c
cups/adminutil.c
cups/auth.c
cups/dest.c
cups/emit.c
cups/file.c
cups/http-addr.c
cups/http-support.c
cups/http.c
cups/ipp-support.c
cups/ipp.c
cups/localize.c
cups/md5.c
cups/ppd-cache.c
cups/sidechannel.c
cups/snmp.c
cups/string.c
cups/tempfile.c
cups/testppd.c
cups/tls-gnutls.c
cups/transcode.c
cups/util.c
filter/raster.c
filter/rastertoepson.c
notifier/dbus.c
scheduler/cert.c
scheduler/client.c
scheduler/cups-exec.c
scheduler/cups-lpd.c
scheduler/cupsd.h
scheduler/file.c
scheduler/ipp.c
scheduler/log.c
scheduler/printers.c
scheduler/process.c
scheduler/select.c
scheduler/statbuf.c
scheduler/type.c
test/ippfind.c
test/ipptool.c

index fad831f7fdeb4376289459ba5ece98bb1ff35845..44084e3ed8b56b02b8d30a9f206f1ac1bfe1ffbf 100644 (file)
@@ -1107,7 +1107,7 @@ query_callback(
       data ++;
 
       if (data < datanext)
       data ++;
 
       if (data < datanext)
-       memcpy(value, data, datanext - data);
+       memcpy(value, data, (size_t)(datanext - data));
       value[datanext - data] = '\0';
 
       fprintf(stderr, "DEBUG2: query_callback: \"%s=%s\".\n",
       value[datanext - data] = '\0';
 
       fprintf(stderr, "DEBUG2: query_callback: \"%s=%s\".\n",
@@ -1198,7 +1198,7 @@ query_callback(
       * Assume the first word is the make...
       */
 
       * Assume the first word is the make...
       */
 
-      memcpy(make_and_model, model, ptr - model);
+      memcpy(make_and_model, model, (size_t)(ptr - model));
       make_and_model[ptr - model] = '\0';
 
       snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
       make_and_model[ptr - model] = '\0';
 
       snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
index 48be693f7cae31f2683ac3a6654956358b3a6ef8..b4ded43ee394389fd9bdde70de05477ec2e9ce4d 100644 (file)
@@ -141,8 +141,7 @@ backendGetDeviceID(
                * Read the 1284 device ID...
                */
 
                * Read the 1284 device ID...
                */
 
-               if ((length = read(devparportfd, device_id,
-                                  device_id_size - 1)) >= 2)
+               if ((length = read(devparportfd, device_id, (size_t)device_id_size - 1)) >= 2)
                {
                  device_id[length] = '\0';
                  got_id = 1;
                {
                  device_id[length] = '\0';
                  got_id = 1;
@@ -171,8 +170,7 @@ backendGetDeviceID(
       * bytes.  The 1284 spec says the length is stored MSB first...
       */
 
       * bytes.  The 1284 spec says the length is stored MSB first...
       */
 
-      length = (((unsigned)device_id[0] & 255) << 8) +
-              ((unsigned)device_id[1] & 255);
+      length = (int)((((unsigned)device_id[0] & 255) << 8) + ((unsigned)device_id[1] & 255));
 
      /*
       * Check to see if the length is larger than our buffer; first
 
      /*
       * Check to see if the length is larger than our buffer; first
@@ -181,8 +179,7 @@ backendGetDeviceID(
       */
 
       if (length > device_id_size || length < 14)
       */
 
       if (length > device_id_size || length < 14)
-       length = (((unsigned)device_id[1] & 255) << 8) +
-                ((unsigned)device_id[0] & 255);
+       length = (int)((((unsigned)device_id[1] & 255) << 8) + ((unsigned)device_id[0] & 255));
 
       if (length > device_id_size)
        length = device_id_size;
 
       if (length > device_id_size)
        length = device_id_size;
@@ -214,7 +211,7 @@ backendGetDeviceID(
 
        length -= 2;
 
 
        length -= 2;
 
-       memmove(device_id, device_id + 2, length);
+       memmove(device_id, device_id + 2, (size_t)length);
        device_id[length] = '\0';
       }
     }
        device_id[length] = '\0';
       }
     }
@@ -280,7 +277,7 @@ backendGetDeviceID(
   */
 
   if (make_model)
   */
 
   if (make_model)
-    backendGetMakeModel(device_id, make_model, make_model_size);
+    backendGetMakeModel(device_id, make_model, (size_t)make_model_size);
 
  /*
   * Then generate a device URI...
 
  /*
   * Then generate a device URI...
index 688997b78e6c20e41090e3ee3fa5f82decb960aa..876ca652050b0056b9d51e5d5a15ffcdabbb04fc 100644 (file)
@@ -506,17 +506,16 @@ fix_make_model(
     make_model[0] = 'H';
     make_model[1] = 'P';
     make_model[2] = ' ';
     make_model[0] = 'H';
     make_model[1] = 'P';
     make_model[2] = ' ';
-    strlcpy(make_model + 3, mmptr, make_model_size - 3);
+    strlcpy(make_model + 3, mmptr, (size_t)make_model_size - 3);
   }
   else if (!_cups_strncasecmp(old_make_model, "deskjet", 7))
   }
   else if (!_cups_strncasecmp(old_make_model, "deskjet", 7))
-    snprintf(make_model, make_model_size, "HP DeskJet%s", old_make_model + 7);
+    snprintf(make_model, (size_t)make_model_size, "HP DeskJet%s", old_make_model + 7);
   else if (!_cups_strncasecmp(old_make_model, "officejet", 9))
   else if (!_cups_strncasecmp(old_make_model, "officejet", 9))
-    snprintf(make_model, make_model_size, "HP OfficeJet%s", old_make_model + 9);
+    snprintf(make_model, (size_t)make_model_size, "HP OfficeJet%s", old_make_model + 9);
   else if (!_cups_strncasecmp(old_make_model, "stylus_pro_", 11))
   else if (!_cups_strncasecmp(old_make_model, "stylus_pro_", 11))
-    snprintf(make_model, make_model_size, "EPSON Stylus Pro %s",
-             old_make_model + 11);
+    snprintf(make_model, (size_t)make_model_size, "EPSON Stylus Pro %s", old_make_model + 11);
   else
   else
-    strlcpy(make_model, old_make_model, make_model_size);
+    strlcpy(make_model, old_make_model, (size_t)make_model_size);
 
   if ((mmptr = strstr(make_model, ", Inc.,")) != NULL)
   {
 
   if ((mmptr = strstr(make_model, ", Inc.,")) != NULL)
   {
index 190e65673f7d374d759c1d35506876ef218ca498..046fc3e30c1a2e08d395184607c18f934479abd1 100644 (file)
@@ -671,7 +671,7 @@ walk_cb(const char *oid,            /* I - OID */
   }
   else
   {
   }
   else
   {
-    memcpy(temp, data, datalen);
+    memcpy(temp, data, (size_t)datalen);
     temp[datalen] = '\0';
   }
 
     temp[datalen] = '\0';
   }
 
index 0a9162645bbb8715ac80dbc63367eea9f02c786a..2a0884ce22412f75889c1cbe8dbe7e31d4e5305a 100644 (file)
@@ -1,35 +1,15 @@
 /*
  * "$Id$"
  *
 /*
  * "$Id$"
  *
- *   LIBUSB interface code for CUPS.
+ * LIBUSB interface code for CUPS.
  *
  *
- *   Copyright 2007-2013 by Apple Inc.
+ * Copyright 2007-2014 by Apple Inc.
  *
  *
- *   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/".
- *
- * Contents:
- *
- *   list_devices()      - List the available printers.
- *   print_device()      - Print a file to a USB device.
- *   close_device()      - Close the connection to the USB printer.
- *   compare_quirks()    - Compare two quirks entries.
- *   find_device()       - Find or enumerate USB printers.
- *   find_quirks()       - Find the quirks for the given printer, if any.
- *   get_device_id()     - Get the IEEE-1284 device ID for the printer.
- *   list_cb()           - List USB printers for discovery.
- *   load_quirks()       - Load all quirks files in the /usr/share/cups/usb
- *                         directory.
- *   make_device_uri()   - Create a device URI for a USB printer.
- *   open_device()       - Open a connection to the USB printer.
- *   print_cb()          - Find a USB printer for printing.
- *   read_thread()       - Thread to read the backchannel data on.
- *   sidechannel_thread() - Handle side-channel requests.
- *   soft_reset()        - Send a soft reset to the device.
- *   soft_reset_printer() - Do the soft reset request specific to printers
+ * 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/".
  */
 
 /*
  */
 
 /*
@@ -920,8 +900,8 @@ find_device(usb_cb_t   cb,          /* I - Callback function */
              fprintf(stderr, "DEBUG: Printer does not report class 7 and/or "
                      "subclass 1 but works as a printer anyway\n");
 
              fprintf(stderr, "DEBUG: Printer does not report class 7 and/or "
                      "subclass 1 but works as a printer anyway\n");
 
-           read_endp  = -1;
-           write_endp = -1;
+           read_endp  = 0xff;
+           write_endp = 0xff;
 
            for (endp = 0, endpptr = altptr->endpoint;
                 endp < altptr->bNumEndpoints;
 
            for (endp = 0, endpptr = altptr->endpoint;
                 endp < altptr->bNumEndpoints;
@@ -1085,8 +1065,7 @@ get_device_id(usb_printer_t *printer,     /* I - Printer */
   * bytes.  The 1284 spec says the length is stored MSB first...
   */
 
   * bytes.  The 1284 spec says the length is stored MSB first...
   */
 
-  length = (((unsigned)buffer[0] & 255) << 8) |
-          ((unsigned)buffer[1] & 255);
+  length = (int)((((unsigned)buffer[0] & 255) << 8) | ((unsigned)buffer[1] & 255));
 
  /*
   * Check to see if the length is larger than our buffer or less than 14 bytes
 
  /*
   * Check to see if the length is larger than our buffer or less than 14 bytes
@@ -1097,8 +1076,7 @@ get_device_id(usb_printer_t *printer,     /* I - Printer */
   */
 
   if (length > bufsize || length < 14)
   */
 
   if (length > bufsize || length < 14)
-    length = (((unsigned)buffer[1] & 255) << 8) |
-            ((unsigned)buffer[0] & 255);
+    length = (int)((((unsigned)buffer[1] & 255) << 8) | ((unsigned)buffer[0] & 255));
 
   if (length > bufsize)
     length = bufsize;
 
   if (length > bufsize)
     length = bufsize;
@@ -1120,7 +1098,7 @@ get_device_id(usb_printer_t *printer,     /* I - Printer */
   * nul-terminate.
   */
 
   * nul-terminate.
   */
 
-  memmove(buffer, buffer + 2, length);
+  memmove(buffer, buffer + 2, (size_t)length);
   buffer[length] = '\0';
 
   return (0);
   buffer[length] = '\0';
 
   return (0);
@@ -1734,7 +1712,7 @@ static void *read_thread(void *reference)
     {
       fprintf(stderr, "DEBUG: Read %d bytes of back-channel data...\n",
               (int)rbytes);
     {
       fprintf(stderr, "DEBUG: Read %d bytes of back-channel data...\n",
               (int)rbytes);
-      cupsBackChannelWrite((const char *)readbuffer, rbytes, 1.0);
+      cupsBackChannelWrite((const char *)readbuffer, (size_t)rbytes, 1.0);
     }
     else if (readstatus == LIBUSB_ERROR_TIMEOUT)
       fputs("DEBUG: Got USB transaction timeout during read.\n", stderr);
     }
     else if (readstatus == LIBUSB_ERROR_TIMEOUT)
       fputs("DEBUG: Got USB transaction timeout during read.\n", stderr);
index b10180e86d4948f956dce3b9819cb938e97e469c..6c794d5de21db6cb46de5aaf290f04b8ed583400 100644 (file)
@@ -4076,7 +4076,7 @@ get_option_value(
       if ((val = cgiGetVariable(keyword)) == NULL)
        return (NULL);
 
       if ((val = cgiGetVariable(keyword)) == NULL)
        return (NULL);
 
-      snprintf(bufptr, bufend - bufptr, "%s%s=", prefix, cparam->name);
+      snprintf(bufptr, (size_t)(bufend - bufptr), "%s%s=", prefix, cparam->name);
       bufptr += strlen(bufptr);
       prefix = " ";
 
       bufptr += strlen(bufptr);
       prefix = " ";
 
@@ -4090,7 +4090,7 @@ get_option_value(
                number > cparam->maximum.custom_real)
              return (NULL);
 
                number > cparam->maximum.custom_real)
              return (NULL);
 
-           snprintf(bufptr, bufend - bufptr, "%g", number);
+           snprintf(bufptr, (size_t)(bufend - bufptr), "%g", number);
            break;
 
        case PPD_CUSTOM_INT :
            break;
 
        case PPD_CUSTOM_INT :
@@ -4100,7 +4100,7 @@ get_option_value(
                integer > cparam->maximum.custom_int)
              return (NULL);
 
                integer > cparam->maximum.custom_int)
              return (NULL);
 
-           snprintf(bufptr, bufend - bufptr, "%ld", integer);
+           snprintf(bufptr, (size_t)(bufend - bufptr), "%ld", integer);
            break;
 
        case PPD_CUSTOM_POINTS :
            break;
 
        case PPD_CUSTOM_POINTS :
@@ -4118,7 +4118,7 @@ get_option_value(
                number_points > cparam->maximum.custom_points)
              return (NULL);
 
                number_points > cparam->maximum.custom_points)
              return (NULL);
 
-           snprintf(bufptr, bufend - bufptr, "%g%s", number, uval);
+           snprintf(bufptr, (size_t)(bufend - bufptr), "%g%s", number, uval);
            break;
 
        case PPD_CUSTOM_PASSCODE :
            break;
 
        case PPD_CUSTOM_PASSCODE :
index c63e21ccac97bf130afc2cb11660e080610d5b3a..8444824514afbfdce7b892cc3fd6bfd4c288df4f 100644 (file)
@@ -1163,7 +1163,7 @@ help_load_file(
 
        wordlen = (int)(ptr - text);
 
 
        wordlen = (int)(ptr - text);
 
-        memcpy(temp, text, wordlen);
+        memcpy(temp, text, (size_t)wordlen);
        temp[wordlen] = '\0';
 
         ptr --;
        temp[wordlen] = '\0';
 
         ptr --;
index 46fdfab02f073058a90356dd692ca0da61d0161b..764cf8a4da17d27e6d4bdda5d10bf28950a35165 100644 (file)
@@ -902,7 +902,7 @@ cgiRewriteURL(const char *uri,              /* I - Current URI */
       * Make URI relative to the current server...
       */
 
       * Make URI relative to the current server...
       */
 
-      strlcpy(url, resource, urlsize);
+      strlcpy(url, resource, (size_t)urlsize);
     }
     else
     {
     }
     else
     {
@@ -911,17 +911,13 @@ cgiRewriteURL(const char *uri,            /* I - Current URI */
       */
 
       if (userpass[0])
       */
 
       if (userpass[0])
-       snprintf(url, urlsize, "%s://%s@%s:%d%s",
-                ishttps ? "https" : "http",
-                userpass, hostname, port, resource);
+       snprintf(url, (size_t)urlsize, "%s://%s@%s:%d%s", ishttps ? "https" : "http", userpass, hostname, port, resource);
       else
       else
-       snprintf(url, urlsize, "%s://%s:%d%s",
-                ishttps ? "https" : "http",
-                hostname, port, resource);
+       snprintf(url, (size_t)urlsize, "%s://%s:%d%s", ishttps ? "https" : "http", hostname, port, resource);
     }
   }
   else
     }
   }
   else
-    strlcpy(url, uri, urlsize);
+    strlcpy(url, uri, (size_t)urlsize);
 
   return (url);
 }
 
   return (url);
 }
index 90ab8bb526125d379a6c677d4140c52d0dc1305c..6972eef02ebfbca5fe5fd0a210d1ad8de9df74cd 100644 (file)
@@ -821,7 +821,7 @@ cgi_initialize_multipart(
            */
 
            write(fd, line, 8192);
            */
 
            write(fd, line, 8192);
-           memmove(line, line + 8192, ptr - line - 8192);
+           memmove(line, line + 8192, (size_t)(ptr - line - 8192));
            ptr -= 8192;
          }
        }
            ptr -= 8192;
          }
        }
index 6a50fbea9180d5d9bbdf90e3e4131c80ddecd25a..81234f083a5cccb0c9357de49ad43e728749e939 100644 (file)
@@ -41,7 +41,7 @@ static int            do_samba_command(const char *command,
                                         FILE *logfile);
 static http_status_t   get_cupsd_conf(http_t *http, _cups_globals_t *cg,
                                       time_t last_update, char *name,
                                         FILE *logfile);
 static http_status_t   get_cupsd_conf(http_t *http, _cups_globals_t *cg,
                                       time_t last_update, char *name,
-                                      int namelen, int *remote);
+                                      size_t namelen, int *remote);
 static void            invalidate_cupsd_cache(_cups_globals_t *cg);
 static void            write_option(cups_file_t *dstfp, int order,
                                     const char *name, const char *text,
 static void            invalidate_cupsd_cache(_cups_globals_t *cg);
 static void            write_option(cups_file_t *dstfp, int order,
                                     const char *name, const char *text,
@@ -2109,7 +2109,7 @@ get_cupsd_conf(
     _cups_globals_t *cg,               /* I - Global data */
     time_t          last_update,       /* I - Last update time for file */
     char            *name,             /* I - Filename buffer */
     _cups_globals_t *cg,               /* I - Global data */
     time_t          last_update,       /* I - Last update time for file */
     char            *name,             /* I - Filename buffer */
-    int             namesize,          /* I - Size of filename buffer */
+    size_t          namesize,          /* I - Size of filename buffer */
     int             *remote)           /* O - Remote file? */
 {
   int          fd;                     /* Temporary file descriptor */
     int             *remote)           /* O - Remote file? */
 {
   int          fd;                     /* Temporary file descriptor */
index f002ea00140c5857c7a3a6d62b1b0510edf2f37f..bc4fad6c85d41b55d4dbcf02cef9c86d5983f534 100644 (file)
@@ -454,7 +454,7 @@ _cupsSetNegotiateAuthString(
       authsize         = sizeof(http->_authstring);
     }
 
       authsize         = sizeof(http->_authstring);
     }
 
-    strlcpy(http->authstring, "Negotiate ", authsize);
+    strlcpy(http->authstring, "Negotiate ", (size_t)authsize);
     httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
                   (int)output_token.length);
 
     httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
                   (int)output_token.length);
 
index 92ce8acd2cf3c200949b95a7376d1bfcf9144417..f9853c8cd45c94a809332315655a265afb3e8457 100644 (file)
@@ -3094,7 +3094,7 @@ cups_dnssd_query_cb(
        txt ++;
 
        if (txt < txtnext)
        txt ++;
 
        if (txt < txtnext)
-         memcpy(value, txt, txtnext - txt);
+         memcpy(value, txt, (size_t)(txtnext - txt));
        value[txtnext - txt] = '\0';
 
        DEBUG_printf(("6cups_dnssd_query_cb: %s=%s", key, value));
        value[txtnext - txt] = '\0';
 
        DEBUG_printf(("6cups_dnssd_query_cb: %s=%s", key, value));
@@ -3773,22 +3773,21 @@ cups_make_string(
     {
       case IPP_TAG_INTEGER :
       case IPP_TAG_ENUM :
     {
       case IPP_TAG_INTEGER :
       case IPP_TAG_ENUM :
-         snprintf(ptr, end - ptr + 1, "%d", attr->values[i].integer);
+         snprintf(ptr, (size_t)(end - ptr + 1), "%d", attr->values[i].integer);
          break;
 
       case IPP_TAG_BOOLEAN :
          if (attr->values[i].boolean)
          break;
 
       case IPP_TAG_BOOLEAN :
          if (attr->values[i].boolean)
-           strlcpy(ptr, "true", end - ptr + 1);
+           strlcpy(ptr, "true", (size_t)(end - ptr + 1));
          else
          else
-           strlcpy(ptr, "false", end - ptr + 1);
+           strlcpy(ptr, "false", (size_t)(end - ptr + 1));
          break;
 
       case IPP_TAG_RANGE :
          if (attr->values[i].range.lower == attr->values[i].range.upper)
          break;
 
       case IPP_TAG_RANGE :
          if (attr->values[i].range.lower == attr->values[i].range.upper)
-           snprintf(ptr, end - ptr + 1, "%d", attr->values[i].range.lower);
+           snprintf(ptr, (size_t)(end - ptr + 1), "%d", attr->values[i].range.lower);
          else
          else
-           snprintf(ptr, end - ptr + 1, "%d-%d", attr->values[i].range.lower,
-                    attr->values[i].range.upper);
+           snprintf(ptr, (size_t)(end - ptr + 1), "%d-%d", attr->values[i].range.lower, attr->values[i].range.upper);
          break;
 
       default :
          break;
 
       default :
index 759e634c04fe7e59626ab4d489561e0bfc1f2a38..5efbb176ffad70d47ec6d4c44328aa841f197c1a 100644 (file)
@@ -814,8 +814,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
                      break;
 
                  case PPD_CUSTOM_INT :
                      break;
 
                  case PPD_CUSTOM_INT :
-                     snprintf(bufptr, bufend - bufptr, "%d",
-                              cparam->current.custom_int);
+                     snprintf(bufptr, (size_t)(bufend - bufptr), "%d", cparam->current.custom_int);
                      bufptr += strlen(bufptr);
                      break;
 
                      bufptr += strlen(bufptr);
                      break;
 
@@ -824,8 +823,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
                  case PPD_CUSTOM_STRING :
                      if (cparam->current.custom_string)
                      {
                  case PPD_CUSTOM_STRING :
                      if (cparam->current.custom_string)
                      {
-                       strlcpy(bufptr, cparam->current.custom_string,
-                               bufend - bufptr);
+                       strlcpy(bufptr, cparam->current.custom_string, (size_t)(bufend - bufptr));
                        bufptr += strlen(bufptr);
                      }
                      break;
                        bufptr += strlen(bufptr);
                      }
                      break;
@@ -845,7 +843,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
         * Otherwise just copy the option code directly...
        */
 
         * Otherwise just copy the option code directly...
        */
 
-        strlcpy(bufptr, choices[i]->code, bufend - bufptr + 1);
+        strlcpy(bufptr, choices[i]->code, (size_t)(bufend - bufptr + 1));
         bufptr += strlen(bufptr);
       }
     }
         bufptr += strlen(bufptr);
       }
     }
@@ -856,7 +854,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
       * options...
       */
 
       * options...
       */
 
-      strlcpy(bufptr, "[{\n", bufend - bufptr + 1);
+      strlcpy(bufptr, "[{\n", (size_t)(bufend - bufptr + 1));
       bufptr += 3;
 
      /*
       bufptr += 3;
 
      /*
@@ -881,8 +879,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
        float           values[5];      /* Values for custom command */
 
 
        float           values[5];      /* Values for custom command */
 
 
-        strlcpy(bufptr, "%%BeginFeature: *CustomPageSize True\n",
-               bufend - bufptr + 1);
+        strlcpy(bufptr, "%%BeginFeature: *CustomPageSize True\n", (size_t)(bufend - bufptr + 1));
         bufptr += 37;
 
         size = ppdPageSize(ppd, "Custom");
         bufptr += 37;
 
         size = ppdPageSize(ppd, "Custom");
@@ -977,7 +974,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
          * Level 2 command sequence...
          */
 
          * Level 2 command sequence...
          */
 
-         strlcpy(bufptr, ppd_custom_code, bufend - bufptr + 1);
+         strlcpy(bufptr, ppd_custom_code, (size_t)(bufend - bufptr + 1));
           bufptr += strlen(bufptr);
        }
       }
           bufptr += strlen(bufptr);
        }
       }
@@ -1000,8 +997,7 @@ ppdEmitString(ppd_file_t    *ppd,  /* I - PPD file record */
             cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
           cupsArrayAdd(params, cparam);
 
             cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
           cupsArrayAdd(params, cparam);
 
-        snprintf(bufptr, bufend - bufptr + 1,
-                "%%%%BeginFeature: *Custom%s True\n", coption->keyword);
+        snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%%%%BeginFeature: *Custom%s True\n", coption->keyword);
         bufptr += strlen(bufptr);
 
         for (cparam = (ppd_cparam_t *)cupsArrayFirst(params);
         bufptr += strlen(bufptr);
 
         for (cparam = (ppd_cparam_t *)cupsArrayFirst(params);
@@ -1020,8 +1016,7 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
                break;
 
            case PPD_CUSTOM_INT :
                break;
 
            case PPD_CUSTOM_INT :
-               snprintf(bufptr, bufend - bufptr + 1, "%d\n",
-                        cparam->current.custom_int);
+               snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d\n", cparam->current.custom_int);
                bufptr += strlen(bufptr);
                break;
 
                bufptr += strlen(bufptr);
                break;
 
@@ -1036,7 +1031,7 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
                  {
                    if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
                    {
                  {
                    if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
                    {
-                     snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
+                     snprintf(bufptr, (size_t)(bufend - bufptr + 1), "\\%03o", *s & 255);
                      bufptr += strlen(bufptr);
                    }
                    else
                      bufptr += strlen(bufptr);
                    }
                    else
@@ -1054,15 +1049,14 @@ ppdEmitString(ppd_file_t    *ppd,       /* I - PPD file record */
       }
       else
       {
       }
       else
       {
-        snprintf(bufptr, bufend - bufptr + 1, "%%%%BeginFeature: *%s %s\n",
-                 choices[i]->option->keyword, choices[i]->choice);
+        snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%%%%BeginFeature: *%s %s\n", choices[i]->option->keyword, choices[i]->choice);
        bufptr += strlen(bufptr);
       }
 
       if (choices[i]->code && choices[i]->code[0])
       {
         j = (int)strlen(choices[i]->code);
        bufptr += strlen(bufptr);
       }
 
       if (choices[i]->code && choices[i]->code[0])
       {
         j = (int)strlen(choices[i]->code);
-       memcpy(bufptr, choices[i]->code, j);
+       memcpy(bufptr, choices[i]->code, (size_t)j);
        bufptr += j;
 
        if (choices[i]->code[j - 1] != '\n')
        bufptr += j;
 
        if (choices[i]->code[j - 1] != '\n')
@@ -1070,7 +1064,7 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
       }
 
       strlcpy(bufptr, "%%EndFeature\n"
       }
 
       strlcpy(bufptr, "%%EndFeature\n"
-                     "} stopped cleartomark\n", bufend - bufptr + 1);
+                     "} stopped cleartomark\n", (size_t)(bufend - bufptr + 1));
       bufptr += strlen(bufptr);
 
       DEBUG_printf(("2ppdEmitString: Offset in string is %d...",
       bufptr += strlen(bufptr);
 
       DEBUG_printf(("2ppdEmitString: Offset in string is %d...",
@@ -1078,7 +1072,7 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
     }
     else
     {
     }
     else
     {
-      strlcpy(bufptr, choices[i]->code, bufend - bufptr + 1);
+      strlcpy(bufptr, choices[i]->code, (size_t)(bufend - bufptr + 1));
       bufptr += strlen(bufptr);
     }
 
       bufptr += strlen(bufptr);
     }
 
index 5bec683f3dc1800a28f96a2b2536e1c71bd1a809..3376419524c9b289e94a86bb3299f7e61d62d47f 100644 (file)
@@ -508,7 +508,7 @@ cupsFileFind(const char *filename,  /* I - File to find */
 
     if (!access(filename, 0))
     {
 
     if (!access(filename, 0))
     {
-      strlcpy(buffer, filename, bufsize);
+      strlcpy(buffer, filename, (size_t)bufsize);
       return (buffer);
     }
     else
       return (buffer);
     }
     else
@@ -533,7 +533,7 @@ cupsFileFind(const char *filename,  /* I - File to find */
       if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
         *bufptr++ = '/';
 
       if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
         *bufptr++ = '/';
 
-      strlcpy(bufptr, filename, bufend - bufptr);
+      strlcpy(bufptr, filename, (size_t)(bufend - bufptr));
 
 #ifdef WIN32
       if (!access(buffer, 0))
 
 #ifdef WIN32
       if (!access(buffer, 0))
@@ -560,7 +560,7 @@ cupsFileFind(const char *filename,  /* I - File to find */
   if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
     *bufptr++ = '/';
 
   if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
     *bufptr++ = '/';
 
-  strlcpy(bufptr, filename, bufend - bufptr);
+  strlcpy(bufptr, filename, (size_t)(bufend - bufptr));
 
   if (!access(buffer, 0))
   {
 
   if (!access(buffer, 0))
   {
@@ -1382,7 +1382,7 @@ cupsFilePrintf(cups_file_t *fp,           /* I - CUPS file */
   }
   else
   {
   }
   else
   {
-    memcpy(fp->ptr, fp->printf_buffer, bytes);
+    memcpy(fp->ptr, fp->printf_buffer, (size_t)bytes);
     fp->ptr += bytes;
     return ((int)bytes);
   }
     fp->ptr += bytes;
     return ((int)bytes);
   }
@@ -1561,7 +1561,7 @@ cupsFilePuts(cups_file_t *fp,             /* I - CUPS file */
   }
   else
   {
   }
   else
   {
-    memcpy(fp->ptr, s, bytes);
+    memcpy(fp->ptr, s, (size_t)bytes);
     fp->ptr += bytes;
     return ((int)bytes);
   }
     fp->ptr += bytes;
     return ((int)bytes);
   }
@@ -1619,7 +1619,7 @@ cupsFileRead(cups_file_t *fp,             /* I - CUPS file */
     if (count > (ssize_t)bytes)
       count = (ssize_t)bytes;
 
     if (count > (ssize_t)bytes)
       count = (ssize_t)bytes;
 
-    memcpy(buf, fp->ptr, count);
+    memcpy(buf, fp->ptr,(size_t) count);
     fp->ptr += count;
     fp->pos += count;
 
     fp->ptr += count;
     fp->pos += count;
 
@@ -2312,7 +2312,7 @@ cups_fill(cups_file_t *fp)                /* I - CUPS file */
       */
 
       if ((bytes = end - ptr) > 0)
       */
 
       if ((bytes = end - ptr) > 0)
-        memcpy(fp->cbuf, ptr, bytes);
+        memcpy(fp->cbuf, ptr, (size_t)bytes);
 
      /*
       * Setup the decompressor data...
 
      /*
       * Setup the decompressor data...
index a3a628c54a012db52042d1024ca391e0ea8719c7..0a49ee3e807a42f5c0e00358f0ae17a07636d46b 100644 (file)
@@ -341,7 +341,7 @@ httpAddrLookup(
 #ifdef AF_LOCAL
   if (addr->addr.sa_family == AF_LOCAL)
   {
 #ifdef AF_LOCAL
   if (addr->addr.sa_family == AF_LOCAL)
   {
-    strlcpy(name, addr->un.sun_path, namelen);
+    strlcpy(name, addr->un.sun_path, (size_t)namelen);
     return (name);
   }
 #endif /* AF_LOCAL */
     return (name);
   }
 #endif /* AF_LOCAL */
@@ -352,7 +352,7 @@ httpAddrLookup(
 
   if (httpAddrLocalhost(addr))
   {
 
   if (httpAddrLocalhost(addr))
   {
-    strlcpy(name, "localhost", namelen);
+    strlcpy(name, "localhost", (size_t)namelen);
     return (name);
   }
 
     return (name);
   }
 
@@ -423,7 +423,7 @@ httpAddrLookup(
       return (httpAddrString(addr, name, namelen));
     }
 
       return (httpAddrString(addr, name, namelen));
     }
 
-    strlcpy(name, host->h_name, namelen);
+    strlcpy(name, host->h_name, (size_t)namelen);
   }
 #endif /* HAVE_GETNAMEINFO */
 
   }
 #endif /* HAVE_GETNAMEINFO */
 
@@ -519,9 +519,9 @@ httpAddrString(const http_addr_t *addr,     /* I - Address to convert */
   if (addr->addr.sa_family == AF_LOCAL)
   {
     if (addr->un.sun_path[0] == '/')
   if (addr->addr.sa_family == AF_LOCAL)
   {
     if (addr->un.sun_path[0] == '/')
-      strlcpy(s, addr->un.sun_path, slen);
+      strlcpy(s, addr->un.sun_path, (size_t)slen);
     else
     else
-      strlcpy(s, "localhost", slen);
+      strlcpy(s, "localhost", (size_t)slen);
   }
   else
 #endif /* AF_LOCAL */
   }
   else
 #endif /* AF_LOCAL */
@@ -529,10 +529,9 @@ httpAddrString(const http_addr_t *addr,    /* I - Address to convert */
   {
     unsigned temp;                     /* Temporary address */
 
   {
     unsigned temp;                     /* Temporary address */
 
-
     temp = ntohl(addr->ipv4.sin_addr.s_addr);
 
     temp = ntohl(addr->ipv4.sin_addr.s_addr);
 
-    snprintf(s, slen, "%d.%d.%d.%d", (temp >> 24) & 255,
+    snprintf(s, (size_t)slen, "%d.%d.%d.%d", (temp >> 24) & 255,
              (temp >> 16) & 255, (temp >> 8) & 255, temp & 255);
   }
 #ifdef AF_INET6
              (temp >> 16) & 255, (temp >> 8) & 255, temp & 255);
   }
 #ifdef AF_INET6
@@ -573,8 +572,7 @@ httpAddrString(const http_addr_t *addr,     /* I - Address to convert */
     {
       temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
 
     {
       temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
 
-      snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
-               (temp >> 16) & 0xffff);
+      snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, (temp >> 16) & 0xffff);
       prefix = ":";
       sptr += strlen(sptr);
 
       prefix = ":";
       sptr += strlen(sptr);
 
@@ -582,7 +580,7 @@ httpAddrString(const http_addr_t *addr,     /* I - Address to convert */
 
       if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1])
       {
 
       if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1])
       {
-        snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix, temp);
+        snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, temp);
        sptr += strlen(sptr);
       }
     }
        sptr += strlen(sptr);
       }
     }
@@ -594,7 +592,7 @@ httpAddrString(const http_addr_t *addr,     /* I - Address to convert */
 
       if (i < 4)
       {
 
       if (i < 4)
       {
-        snprintf(sptr, sizeof(temps) - (sptr - temps), "%s:", prefix);
+        snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s:", prefix);
        prefix = ":";
        sptr += strlen(sptr);
 
        prefix = ":";
        sptr += strlen(sptr);
 
@@ -605,13 +603,11 @@ httpAddrString(const http_addr_t *addr,   /* I - Address to convert */
           if ((temp & 0xffff0000) ||
              (i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1]))
          {
           if ((temp & 0xffff0000) ||
              (i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1]))
          {
-            snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
-                    (temp >> 16) & 0xffff);
+            snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, (temp >> 16) & 0xffff);
            sptr += strlen(sptr);
           }
 
            sptr += strlen(sptr);
           }
 
-          snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
-                  temp & 0xffff);
+          snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, temp & 0xffff);
          sptr += strlen(sptr);
        }
       }
          sptr += strlen(sptr);
        }
       }
@@ -629,7 +625,7 @@ httpAddrString(const http_addr_t *addr,     /* I - Address to convert */
        * Empty at end...
        */
 
        * Empty at end...
        */
 
-        strlcpy(sptr, "::", sizeof(temps) - (sptr - temps));
+        strlcpy(sptr, "::", sizeof(temps) - (size_t)(sptr - temps));
       }
     }
 #  endif /* HAVE_GETNAMEINFO */
       }
     }
 #  endif /* HAVE_GETNAMEINFO */
@@ -638,11 +634,11 @@ httpAddrString(const http_addr_t *addr,   /* I - Address to convert */
     * Add "[v1." and "]" around IPv6 address to convert to URI form.
     */
 
     * Add "[v1." and "]" around IPv6 address to convert to URI form.
     */
 
-    snprintf(s, slen, "[v1.%s]", temps);
+    snprintf(s, (size_t)slen, "[v1.%s]", temps);
   }
 #endif /* AF_INET6 */
   else
   }
 #endif /* AF_INET6 */
   else
-    strlcpy(s, "UNKNOWN", slen);
+    strlcpy(s, "UNKNOWN", (size_t)slen);
 
   DEBUG_printf(("1httpAddrString: returning \"%s\"...", s));
 
 
   DEBUG_printf(("1httpAddrString: returning \"%s\"...", s));
 
@@ -804,9 +800,9 @@ httpGetHostname(http_t *http,               /* I - HTTP connection or NULL */
        return (http->hostname);
     }
     else if (http->hostname[0] == '/')
        return (http->hostname);
     }
     else if (http->hostname[0] == '/')
-      strlcpy(s, "localhost", slen);
+      strlcpy(s, "localhost", (size_t)slen);
     else
     else
-      strlcpy(s, http->hostname, slen);
+      strlcpy(s, http->hostname, (size_t)slen);
   }
   else
   {
   }
   else
   {
@@ -818,7 +814,7 @@ httpGetHostname(http_t *http,               /* I - HTTP connection or NULL */
       return (NULL);
 
     if (gethostname(s, (size_t)slen) < 0)
       return (NULL);
 
     if (gethostname(s, (size_t)slen) < 0)
-      strlcpy(s, "localhost", slen);
+      strlcpy(s, "localhost", (size_t)slen);
 
     if (!strchr(s, '.'))
     {
 
     if (!strchr(s, '.'))
     {
@@ -842,7 +838,7 @@ httpGetHostname(http_t *http,               /* I - HTTP connection or NULL */
         * Append ".local." to the hostname we get...
        */
 
         * Append ".local." to the hostname we get...
        */
 
-        snprintf(s, slen, "%s.local.", localStr);
+        snprintf(s, (size_t)slen, "%s.local.", localStr);
       }
 
       if (local)
       }
 
       if (local)
@@ -863,7 +859,7 @@ httpGetHostname(http_t *http,               /* I - HTTP connection or NULL */
         * Use the resolved hostname...
        */
 
         * Use the resolved hostname...
        */
 
-       strlcpy(s, host->h_name, slen);
+       strlcpy(s, host->h_name, (size_t)slen);
       }
 #endif /* HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME */
     }
       }
 #endif /* HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME */
     }
index c1353514fc8dd7bf862c4a99b8d71e2398e2b9a8..501b2a2aca483fa70bc2b61604aba850e720602f 100644 (file)
@@ -358,7 +358,7 @@ httpAssembleURI(
 
     if (port > 0)
     {
 
     if (port > 0)
     {
-      snprintf(ptr, end - ptr + 1, ":%d", port);
+      snprintf(ptr, (size_t)(end - ptr + 1), ":%d", port);
       ptr += strlen(ptr);
 
       if (ptr >= end)
       ptr += strlen(ptr);
 
       if (ptr >= end)
@@ -809,10 +809,7 @@ httpGetDateString2(time_t t,               /* I - UNIX time */
 
   tdate = gmtime(&t);
   if (tdate)
 
   tdate = gmtime(&t);
   if (tdate)
-    snprintf(s, slen, "%s, %02d %s %d %02d:%02d:%02d GMT",
-            http_days[tdate->tm_wday], tdate->tm_mday,
-            http_months[tdate->tm_mon], tdate->tm_year + 1900,
-            tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
+    snprintf(s, (size_t)slen, "%s, %02d %s %d %02d:%02d:%02d GMT", http_days[tdate->tm_wday], tdate->tm_mday, http_months[tdate->tm_mon], tdate->tm_year + 1900, tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
   else
     s[0] = '\0';
 
   else
     s[0] = '\0';
 
@@ -1007,7 +1004,7 @@ httpSeparateURI(
     * Workaround for HP IPP client bug...
     */
 
     * Workaround for HP IPP client bug...
     */
 
-    strlcpy(scheme, "ipp", schemelen);
+    strlcpy(scheme, "ipp", (size_t)schemelen);
     status = HTTP_URI_STATUS_MISSING_SCHEME;
   }
   else if (*uri == '/')
     status = HTTP_URI_STATUS_MISSING_SCHEME;
   }
   else if (*uri == '/')
@@ -1016,7 +1013,7 @@ httpSeparateURI(
     * Filename...
     */
 
     * Filename...
     */
 
-    strlcpy(scheme, "file", schemelen);
+    strlcpy(scheme, "file", (size_t)schemelen);
     status = HTTP_URI_STATUS_MISSING_SCHEME;
   }
   else
     status = HTTP_URI_STATUS_MISSING_SCHEME;
   }
   else
@@ -2473,9 +2470,7 @@ http_resolve_cb(
     {
       for (addr = addrlist; addr; addr = addr->next)
       {
     {
       for (addr = addrlist; addr; addr = addr->next)
       {
-        int error = getnameinfo(&(addr->addr.addr),
-                               httpAddrLength(&(addr->addr)),
-                               fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+        int error = getnameinfo(&(addr->addr.addr), (socklen_t)httpAddrLength(&(addr->addr)), fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
 
         if (!error)
        {
 
         if (!error)
        {
index 8a4236e0d8e730dae4d69c6c738e11d0129da7ed..18ca6fbc5d02aaef015a500343d259f254d9492a 100644 (file)
@@ -1315,7 +1315,7 @@ httpGets(char   *line,                    /* I - Line to read into */
 
     http->used -= (int)(bufptr - http->buffer);
     if (http->used > 0)
 
     http->used -= (int)(bufptr - http->buffer);
     if (http->used > 0)
-      memmove(http->buffer, bufptr, http->used);
+      memmove(http->buffer, bufptr, (size_t)http->used);
 
     if (eol)
     {
 
     if (eol)
     {
@@ -1809,7 +1809,7 @@ httpPeek(http_t *http,                    /* I - HTTP connection */
       http->data_remaining  -= buflen;
 
       if (http->used > 0)
       http->data_remaining  -= buflen;
 
       if (http->used > 0)
-        memmove(http->buffer, http->buffer + buflen, http->used);
+        memmove(http->buffer, http->buffer + buflen, (size_t)http->used);
     }
 
     DEBUG_printf(("2httpPeek: length=%d, avail_in=%d", (int)length,
     }
 
     DEBUG_printf(("2httpPeek: length=%d, avail_in=%d", (int)length,
@@ -4141,11 +4141,11 @@ http_read_buffered(http_t *http,        /* I - HTTP connection */
     DEBUG_printf(("2http_read: Grabbing %d bytes from input buffer.",
                   (int)bytes));
 
     DEBUG_printf(("2http_read: Grabbing %d bytes from input buffer.",
                   (int)bytes));
 
-    memcpy(buffer, http->buffer, bytes);
+    memcpy(buffer, http->buffer, (size_t)bytes);
     http->used -= (int)bytes;
 
     if (http->used > 0)
     http->used -= (int)bytes;
 
     if (http->used > 0)
-      memmove(http->buffer, http->buffer + bytes, http->used);
+      memmove(http->buffer, http->buffer + bytes, (size_t)http->used);
   }
   else
     bytes = http_read(http, buffer, length);
   }
   else
     bytes = http_read(http, buffer, length);
index 29ea8b14ccdb2ab8c3f7e242c08c7ac003ca97ea..a5c233e205aeed57df3a92edcd1a9387d8042a99 100644 (file)
@@ -638,46 +638,37 @@ ippAttributeString(
           ptr = ippEnumString(attr->name, val->integer);
 
           if (buffer && bufptr < bufend)
           ptr = ippEnumString(attr->name, val->integer);
 
           if (buffer && bufptr < bufend)
-            strlcpy(bufptr, ptr, bufend - bufptr + 1);
+            strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
 
           bufptr += strlen(ptr);
           break;
 
       case IPP_TAG_INTEGER :
           if (buffer && bufptr < bufend)
 
           bufptr += strlen(ptr);
           break;
 
       case IPP_TAG_INTEGER :
           if (buffer && bufptr < bufend)
-            bufptr += snprintf(bufptr, bufend - bufptr + 1, "%d", val->integer);
+            bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d", val->integer);
           else
             bufptr += snprintf(temp, sizeof(temp), "%d", val->integer);
           break;
 
       case IPP_TAG_BOOLEAN :
           if (buffer && bufptr < bufend)
           else
             bufptr += snprintf(temp, sizeof(temp), "%d", val->integer);
           break;
 
       case IPP_TAG_BOOLEAN :
           if (buffer && bufptr < bufend)
-            strlcpy(bufptr, val->boolean ? "true" : "false",
-                    bufend - bufptr + 1);
+            strlcpy(bufptr, val->boolean ? "true" : "false", (size_t)(bufend - bufptr + 1));
 
           bufptr += val->boolean ? 4 : 5;
           break;
 
       case IPP_TAG_RANGE :
           if (buffer && bufptr < bufend)
 
           bufptr += val->boolean ? 4 : 5;
           break;
 
       case IPP_TAG_RANGE :
           if (buffer && bufptr < bufend)
-            bufptr += snprintf(bufptr, bufend - bufptr + 1, "%d-%d",
-                               val->range.lower, val->range.upper);
+            bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d-%d", val->range.lower, val->range.upper);
           else
           else
-            bufptr += snprintf(temp, sizeof(temp), "%d-%d", val->range.lower,
-                               val->range.upper);
+            bufptr += snprintf(temp, sizeof(temp), "%d-%d", val->range.lower, val->range.upper);
           break;
 
       case IPP_TAG_RESOLUTION :
           if (buffer && bufptr < bufend)
           break;
 
       case IPP_TAG_RESOLUTION :
           if (buffer && bufptr < bufend)
-            bufptr += snprintf(bufptr, bufend - bufptr + 1, "%dx%d%s",
-                               val->resolution.xres, val->resolution.yres,
-                               val->resolution.units == IPP_RES_PER_INCH ?
-                                   "dpi" : "dpcm");
+            bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%dx%d%s", val->resolution.xres, val->resolution.yres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
           else
           else
-            bufptr += snprintf(temp, sizeof(temp), "%dx%d%s",
-                               val->resolution.xres, val->resolution.yres,
-                               val->resolution.units == IPP_RES_PER_INCH ?
-                                   "dpi" : "dpcm");
+            bufptr += snprintf(temp, sizeof(temp), "%dx%d%s", val->resolution.xres, val->resolution.yres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
           break;
 
       case IPP_TAG_DATE :
           break;
 
       case IPP_TAG_DATE :
@@ -698,7 +689,7 @@ ippAttributeString(
                       val->date[10]);
 
             if (buffer && bufptr < bufend)
                       val->date[10]);
 
             if (buffer && bufptr < bufend)
-              strlcpy(bufptr, temp, bufend - bufptr + 1);
+              strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1));
 
             bufptr += strlen(temp);
           }
 
             bufptr += strlen(temp);
           }
@@ -742,7 +733,7 @@ ippAttributeString(
             bufptr ++;
 
             if (buffer && bufptr < bufend)
             bufptr ++;
 
             if (buffer && bufptr < bufend)
-              strlcpy(bufptr, val->string.language, bufend - bufptr);
+              strlcpy(bufptr, val->string.language, (size_t)(bufend - bufptr));
             bufptr += strlen(val->string.language);
 
             if (buffer && bufptr < bufend)
             bufptr += strlen(val->string.language);
 
             if (buffer && bufptr < bufend)
@@ -775,11 +766,9 @@ ippAttributeString(
             else if (!isprint(*ptr & 255))
             {
               if (buffer && bufptr < bufend)
             else if (!isprint(*ptr & 255))
             {
               if (buffer && bufptr < bufend)
-                bufptr += snprintf(bufptr, bufend - bufptr + 1, "\\%03o",
-                                   *ptr & 255);
+                bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "\\%03o", *ptr & 255);
               else
               else
-                bufptr += snprintf(temp, sizeof(temp), "\\%03o",
-                                   *ptr & 255);
+                bufptr += snprintf(temp, sizeof(temp), "\\%03o", *ptr & 255);
             }
             else
             {
             }
             else
             {
@@ -793,7 +782,7 @@ ippAttributeString(
       default :
           ptr = ippTagString(attr->value_tag);
           if (buffer && bufptr < bufend)
       default :
           ptr = ippTagString(attr->value_tag);
           if (buffer && bufptr < bufend)
-            strlcpy(bufptr, ptr, bufend - bufptr + 1);
+            strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
           bufptr += strlen(ptr);
           break;
     }
           bufptr += strlen(ptr);
           break;
     }
@@ -2231,7 +2220,7 @@ ipp_col_string(ipp_t  *col,               /* I - Collection attribute */
     prefix = ' ';
 
     if (buffer && bufptr < bufend)
     prefix = ' ';
 
     if (buffer && bufptr < bufend)
-      bufptr += snprintf(bufptr, bufend - bufptr + 1, "%s=", attr->name);
+      bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%s=", attr->name);
     else
       bufptr += strlen(attr->name) + 1;
 
     else
       bufptr += strlen(attr->name) + 1;
 
index dafbf9e7b259a045b3d25cc6eb500536f74e1548..e83bfd4de2b76b71ffd7d1f4f24710da97346a1e 100644 (file)
@@ -556,7 +556,7 @@ ippAddOctetString(ipp_t      *ipp,  /* I - IPP message */
       return (NULL);
     }
 
       return (NULL);
     }
 
-    memcpy(attr->values[0].unknown.data, data, datalen);
+    memcpy(attr->values[0].unknown.data, data, (size_t)datalen);
   }
 
  /*
   }
 
  /*
@@ -1715,7 +1715,7 @@ ippCopyAttribute(
            if ((dstval->unknown.data = malloc((size_t)dstval->unknown.length)) == NULL)
              dstval->unknown.length = 0;
            else
            if ((dstval->unknown.data = malloc((size_t)dstval->unknown.length)) == NULL)
              dstval->unknown.length = 0;
            else
-             memcpy(dstval->unknown.data, srcval->unknown.data, dstval->unknown.length);
+             memcpy(dstval->unknown.data, srcval->unknown.data, (size_t)dstval->unknown.length);
          }
        }
         break; /* anti-compiler-warning-code */
          }
        }
         break; /* anti-compiler-warning-code */
@@ -3472,7 +3472,7 @@ ippReadIO(void       *src,                /* I - Data source */
                  return (IPP_STATE_ERROR);
                }
 
                  return (IPP_STATE_ERROR);
                }
 
-               memcpy(string, bufptr + 2, n);
+               memcpy(string, bufptr + 2, (size_t)n);
                string[n] = '\0';
 
                value->string.language = _cupsStrAlloc((char *)string);
                string[n] = '\0';
 
                value->string.language = _cupsStrAlloc((char *)string);
@@ -3967,7 +3967,7 @@ ippSetOctetString(
 
        if ((temp = malloc((size_t)datalen)) != NULL)
        {
 
        if ((temp = malloc((size_t)datalen)) != NULL)
        {
-         memcpy(temp, data, datalen);
+         memcpy(temp, data, (size_t)datalen);
 
          value->unknown.data   = temp;
          value->unknown.length = datalen;
 
          value->unknown.data   = temp;
          value->unknown.length = datalen;
@@ -5575,7 +5575,7 @@ ippWriteIO(void       *dst,               /* I - Destination */
 
            *bufptr++ = (ipp_uchar_t)(n >> 8);
            *bufptr++ = (ipp_uchar_t)n;
 
            *bufptr++ = (ipp_uchar_t)(n >> 8);
            *bufptr++ = (ipp_uchar_t)n;
-           memcpy(bufptr, attr->name, n);
+           memcpy(bufptr, attr->name, (size_t)n);
            bufptr += n;
           }
          else
            bufptr += n;
           }
          else
@@ -5610,7 +5610,7 @@ ippWriteIO(void       *dst,               /* I - Destination */
            *bufptr++ = 0;
            *bufptr++ = (ipp_uchar_t)(n >> 8);
            *bufptr++ = (ipp_uchar_t)n;
            *bufptr++ = 0;
            *bufptr++ = (ipp_uchar_t)(n >> 8);
            *bufptr++ = (ipp_uchar_t)n;
-           memcpy(bufptr, attr->name, n);
+           memcpy(bufptr, attr->name, (size_t)n);
            bufptr += n;
 
             if (attr->value_tag > 0xff)
            bufptr += n;
 
             if (attr->value_tag > 0xff)
@@ -5819,7 +5819,7 @@ ippWriteIO(void       *dst,               /* I - Destination */
 
                  if (n > 0)
                  {
 
                  if (n > 0)
                  {
-                   memcpy(bufptr, value->string.text, n);
+                   memcpy(bufptr, value->string.text, (size_t)n);
                    bufptr += n;
                  }
                }
                    bufptr += n;
                  }
                }
@@ -6060,7 +6060,7 @@ ippWriteIO(void       *dst,               /* I - Destination */
                  /* Language */
                  if (n > 0)
                  {
                  /* Language */
                  if (n > 0)
                  {
-                   memcpy(bufptr, value->string.language, n);
+                   memcpy(bufptr, value->string.language, (size_t)n);
                    bufptr += n;
                  }
 
                    bufptr += n;
                  }
 
@@ -6076,7 +6076,7 @@ ippWriteIO(void       *dst,               /* I - Destination */
                  /* Text */
                  if (n > 0)
                  {
                  /* Text */
                  if (n > 0)
                  {
-                   memcpy(bufptr, value->string.text, n);
+                   memcpy(bufptr, value->string.text, (size_t)n);
                    bufptr += n;
                  }
                }
                    bufptr += n;
                  }
                }
@@ -6219,7 +6219,7 @@ ippWriteIO(void       *dst,               /* I - Destination */
                  /* Value */
                  if (n > 0)
                  {
                  /* Value */
                  if (n > 0)
                  {
-                   memcpy(bufptr, value->unknown.data, n);
+                   memcpy(bufptr, value->unknown.data, (size_t)n);
                    bufptr += n;
                  }
                }
                    bufptr += n;
                  }
                }
index 4c702acdf143c97e7e9e879d6423f2dd2d4e105e..56a8b724fd35aaee021473c0f6c4cc71aea35035 100644 (file)
@@ -36,7 +36,7 @@
  * Local functions...
  */
 
  * Local functions...
  */
 
-static cups_lang_t     *ppd_ll_CC(char *ll_CC, int ll_CC_size);
+static cups_lang_t     *ppd_ll_CC(char *ll_CC, size_t ll_CC_size);
 
 
 /*
 
 
 /*
@@ -712,8 +712,8 @@ _ppdLocalizedAttr(ppd_file_t *ppd,  /* I - PPD file */
  */
 
 static cups_lang_t *                   /* O - Current language */
  */
 
 static cups_lang_t *                   /* O - Current language */
-ppd_ll_CC(char *ll_CC,                 /* O - Country-specific locale name */
-          int  ll_CC_size)             /* I - Size of country-specific name */
+ppd_ll_CC(char   *ll_CC,               /* O - Country-specific locale name */
+          size_t ll_CC_size)           /* I - Size of country-specific name */
 {
   cups_lang_t  *lang;                  /* Current language */
 
 {
   cups_lang_t  *lang;                  /* Current language */
 
index 0e1eaaafaee6ac6f589501ce7009deca54f6ebd4..c2d627bd9dd985a43a15cb140cc05740272e9f82 100644 (file)
@@ -300,7 +300,7 @@ _cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
     if (offset) {
        int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
 
     if (offset) {
        int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
 
-       memcpy(pms->buf + offset, p, copy);
+       memcpy(pms->buf + offset, p, (size_t)copy);
        if (offset + copy < 64)
            return;
        p += copy;
        if (offset + copy < 64)
            return;
        p += copy;
@@ -314,7 +314,7 @@ _cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
 
     /* Process a final partial block. */
     if (left)
 
     /* Process a final partial block. */
     if (left)
-       memcpy(pms->buf, p, left);
+       memcpy(pms->buf, p, (size_t)left);
 }
 
 void
 }
 
 void
index 64e9d3a6e9be3ae01c79cbb74794b260a86d6d1b..5c1a901596d7e369e808c4f0d0a6e599b0da4d8f 100644 (file)
@@ -2612,7 +2612,7 @@ _pwgPageSizeForMedia(
     * Copy the size name from class_sizename_dimensions...
     */
 
     * Copy the size name from class_sizename_dimensions...
     */
 
-    memcpy(name, sizeptr + 1, dimptr - sizeptr - 1);
+    memcpy(name, sizeptr + 1, (size_t)(dimptr - sizeptr - 1));
     name[dimptr - sizeptr - 1] = '\0';
   }
 
     name[dimptr - sizeptr - 1] = '\0';
   }
 
index d7638372d9fd19b928aed7b694d04e1c1e40e56f..0928d8b34fe6881a478dab03f6fba294e62b04e5 100644 (file)
@@ -264,7 +264,7 @@ cupsSideChannelRead(
     *status  = (cups_sc_status_t)buffer[1];
     *datalen = templen;
 
     *status  = (cups_sc_status_t)buffer[1];
     *datalen = templen;
 
-    memcpy(data, buffer + 4, templen);
+    memcpy(data, buffer + 4, (size_t)templen);
   }
 
   _cupsBufferRelease(buffer);
   }
 
   _cupsBufferRelease(buffer);
@@ -364,7 +364,7 @@ cupsSideChannelSNMPGet(
       return (CUPS_SC_STATUS_TOO_BIG);
     }
 
       return (CUPS_SC_STATUS_TOO_BIG);
     }
 
-    memcpy(data, real_data + real_oidlen, real_datalen);
+    memcpy(data, real_data + real_oidlen, (size_t)real_datalen);
     data[real_datalen] = '\0';
 
     *datalen = real_datalen;
     data[real_datalen] = '\0';
 
     *datalen = real_datalen;
@@ -607,7 +607,7 @@ cupsSideChannelWrite(
 
   if (datalen > 0)
   {
 
   if (datalen > 0)
   {
-    memcpy(buffer + 4, data, datalen);
+    memcpy(buffer + 4, data, (size_t)datalen);
     bytes += datalen;
   }
 
     bytes += datalen;
   }
 
index a291e8a829879901025d7158a3e63ee961cd6500..4c62f959fa0531f20dcd4bb7f5e705b97488b344 100644 (file)
@@ -280,7 +280,7 @@ _cupsSNMPOIDToString(const int *src,        /* I - OID */
   for (dstptr = dst, dstend = dstptr + dstsize - 1;
        *src >= 0 && dstptr < dstend;
        src ++, dstptr += strlen(dstptr))
   for (dstptr = dst, dstend = dstptr + dstsize - 1;
        *src >= 0 && dstptr < dstend;
        src ++, dstptr += strlen(dstptr))
-    snprintf(dstptr, dstend - dstptr + 1, ".%d", *src);
+    snprintf(dstptr, (size_t)(dstend - dstptr + 1), ".%d", *src);
 
   if (*src >= 0)
     return (NULL);
 
   if (*src >= 0)
     return (NULL);
index 0bc0690c5e0945b7b95aba44d00caecb35b03510..ce5d9e987c633b3f7a394e88f00e4ff3cba0d3cc 100644 (file)
@@ -243,7 +243,7 @@ _cupsStrFormatd(char         *buf,  /* I - String */
   }
   else
   {
   }
   else
   {
-    strlcpy(buf, temp, bufend - buf + 1);
+    strlcpy(buf, temp, (size_t)(bufend - buf + 1));
     bufptr = buf + strlen(buf);
   }
 
     bufptr = buf + strlen(buf);
   }
 
index 75c95d6fbf687efd341a2384cd8aa0b9df5aff4b..d5703bb2fb2add707c5587577d07edb22796af62 100644 (file)
@@ -1,24 +1,18 @@
 /*
  * "$Id$"
  *
 /*
  * "$Id$"
  *
- *   Temp file utilities for CUPS.
+ * Temp file utilities for CUPS.
  *
  *
- *   Copyright 2007-2012 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2006 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:
- *
- *   cupsTempFd()    - Creates a temporary file.
- *   cupsTempFile()  - Generates a temporary filename.
- *   cupsTempFile2() - Creates a temporary CUPS file.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
  */
 
 /*
@@ -103,8 +97,7 @@ cupsTempFd(char *filename,           /* I - Pointer to buffer */
     * Format a string using the hex time values...
     */
 
     * Format a string using the hex time values...
     */
 
-    snprintf(filename, len - 1, "%s/%05lx%08lx", tmpdir,
-             GetCurrentProcessId(), curtime);
+    snprintf(filename, (size_t)len - 1, "%s/%05lx%08lx", tmpdir, GetCurrentProcessId(), curtime);
 #else
    /*
     * Get the current time of day...
 #else
    /*
     * Get the current time of day...
@@ -116,8 +109,7 @@ cupsTempFd(char *filename,          /* I - Pointer to buffer */
     * Format a string using the hex time values...
     */
 
     * Format a string using the hex time values...
     */
 
-    snprintf(filename, len - 1, "%s/%05x%08x", tmpdir, (unsigned)getpid(),
-             (unsigned)(curtime.tv_sec + curtime.tv_usec + tries));
+    snprintf(filename, (size_t)len - 1, "%s/%05x%08x", tmpdir, (unsigned)getpid(), (unsigned)(curtime.tv_sec + curtime.tv_usec + tries));
 #endif /* WIN32 */
 
    /*
 #endif /* WIN32 */
 
    /*
index dd94b003fc6c9dcdd29fd6c40d16c1589d45629d..9c0616e69f93ac5cd11b362c9fa39a313e4461f6 100644 (file)
@@ -28,6 +28,7 @@
 #  include <unistd.h>
 #  include <fcntl.h>
 #endif /* WIN32 */
 #  include <unistd.h>
 #  include <fcntl.h>
 #endif /* WIN32 */
+#include <math.h>
 
 
 /*
 
 
 /*
index 0f5b11881654c04d2478cbb871d32b4377f824a9..f698a87e52d3b1c1483d3199ec1c45f2717f2db9 100644 (file)
  */
 
 
  */
 
 
+/*
+ * Local globals...
+ */
+
+static int             tls_auto_create = 0;
+                                       /* Auto-create self-signed certs? */
+static char            *tls_common_name = NULL;
+                                       /* Default common name */
+static char            *tls_keypath = NULL;
+                                       /* Server cert keychain path */
+static _cups_mutex_t   tls_mutex = _CUPS_MUTEX_INITIALIZER;
+                                       /* Mutex for keychain/certs */
+
+
 /*
  * Local functions...
  */
 /*
  * Local functions...
  */
@@ -25,6 +39,71 @@ static ssize_t       http_gnutls_read(gnutls_transport_ptr_t ptr, void *data, size_t l
 static ssize_t http_gnutls_write(gnutls_transport_ptr_t ptr, const void *data, size_t length);
 
 
 static ssize_t http_gnutls_write(gnutls_transport_ptr_t ptr, const void *data, size_t length);
 
 
+/*
+ * 'cupsMakeServerCredentials()' - Make a self-signed certificate and private key pair.
+ *
+ * @since CUPS 2.0@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+cupsMakeServerCredentials(
+    const char *path,                  /* I - Path to keychain/directory */
+    const char *common_name,           /* I - Common name */
+    int        num_alt_names,          /* I - Number of subject alternate names */
+    const char **alt_names,            /* I - Subject Alternate Names */
+    time_t     expiration_date)                /* I - Expiration date */
+{
+  (void)path;
+  (void)common_name;
+  (void)num_alt_names;
+  (void)alt_names;
+  (void)expiration_date;
+
+  return (0);
+}
+
+
+/*
+ * 'cupsSetServerCredentials()' - Set the default server credentials.
+ *
+ * Note: The server credentials are used by all threads in the running process.
+ * This function is threadsafe.
+ *
+ * @since CUPS 2.0@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+cupsSetServerCredentials(
+    const char *path,                  /* I - Path to keychain/directory */
+    const char *common_name,           /* I - Default common name for server */
+    int        auto_create)            /* I - 1 = automatically create self-signed certificates */
+{
+  _cupsMutexLock(&tls_mutex);
+
+ /*
+  * Free old values...
+  */
+
+  if (tls_keypath)
+    _cupsStrFree(tls_keypath);
+
+  if (tls_common_name)
+    _cupsStrFree(tls_common_name);
+
+ /*
+  * Save the new values...
+  */
+
+  tls_keypath     = _cupsStrAlloc(path);
+  tls_auto_create = auto_create;
+  tls_common_name = _cupsStrAlloc(common_name);
+
+  _cupsMutexUnlock(&tls_mutex);
+
+  return (1);
+}
+
+
 /*
  * 'httpCopyCredentials()' - Copy the credentials associated with the peer in
  *                           an encrypted connection.
 /*
  * 'httpCopyCredentials()' - Copy the credentials associated with the peer in
  *                           an encrypted connection.
@@ -177,7 +256,7 @@ http_tls_read(http_t *http,         /* I - Connection to server */
   ssize_t      result;                 /* Return value */
 
 
   ssize_t      result;                 /* Return value */
 
 
-  result = gnutls_record_recv(http->tls, buf, len);
+  result = gnutls_record_recv(http->tls, buf, (size_t)len);
 
   if (result < 0 && !errno)
   {
 
   if (result < 0 && !errno)
   {
@@ -343,7 +422,7 @@ http_tls_write(http_t     *http,    /* I - Connection to server */
 
   DEBUG_printf(("2http_write_ssl(http=%p, buf=%p, len=%d)", http, buf, len));
 
 
   DEBUG_printf(("2http_write_ssl(http=%p, buf=%p, len=%d)", http, buf, len));
 
-  result = gnutls_record_send(http->tls, buf, len);
+  result = gnutls_record_send(http->tls, buf, (size_t)len);
 
   if (result < 0 && !errno)
   {
 
   if (result < 0 && !errno)
   {
index 8245aa3ead44feee2855f06d7024a29b5e124fef..58fab4ba74e56adf748ad74bfdcc3e8040648df5 100644 (file)
@@ -109,7 +109,7 @@ cupsCharsetToUTF8(
   if (encoding == CUPS_UTF8 || encoding <= CUPS_US_ASCII ||
       encoding >= CUPS_ENCODING_VBCS_END)
   {
   if (encoding == CUPS_UTF8 || encoding <= CUPS_US_ASCII ||
       encoding >= CUPS_ENCODING_VBCS_END)
   {
-    strlcpy((char *)dest, src, maxout);
+    strlcpy((char *)dest, src, (size_t)maxout);
     return ((int)strlen((char *)dest));
   }
 
     return ((int)strlen((char *)dest));
   }
 
@@ -226,7 +226,7 @@ cupsUTF8ToCharset(
   if (encoding == CUPS_UTF8 ||
       encoding >= CUPS_ENCODING_VBCS_END)
   {
   if (encoding == CUPS_UTF8 ||
       encoding >= CUPS_ENCODING_VBCS_END)
   {
-    strlcpy(dest, (char *)src, maxout);
+    strlcpy(dest, (char *)src, (size_t)maxout);
     return ((int)strlen(dest));
   }
 
     return ((int)strlen(dest));
   }
 
index 0b6c289a4261b5e5ef00fca215d39c37006af56a..110142b65deac660fa1c1015665adc6c0abf92b3 100644 (file)
@@ -1670,7 +1670,7 @@ cups_get_printer_uri(
   * Do the request and get back a response...
   */
 
   * Do the request and get back a response...
   */
 
-  snprintf(resource, resourcesize, "/printers/%s", name);
+  snprintf(resource, (size_t)resourcesize, "/printers/%s", name);
 
   if ((response = cupsDoRequest(http, request, resource)) != NULL)
   {
 
   if ((response = cupsDoRequest(http, request, resource)) != NULL)
   {
index d9658d710641590d58a855d7a518433a2dd6317a..d1387086d79b5a5d3b6ca1920da0bb92b843b9a6 100644 (file)
@@ -474,7 +474,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
       */
 
       if (ptr != p)
       */
 
       if (ptr != p)
-        memcpy(p, ptr, bytes);
+        memcpy(p, ptr, (size_t)bytes);
     }
     else
     {
     }
     else
     {
@@ -485,7 +485,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
       if ((unsigned)(bytes = (int)(r->pend - r->pcurrent)) > remaining)
         bytes = (ssize_t)remaining;
 
       if ((unsigned)(bytes = (int)(r->pend - r->pcurrent)) > remaining)
         bytes = (ssize_t)remaining;
 
-      memcpy(p, r->pcurrent, bytes);
+      memcpy(p, r->pcurrent, (size_t)bytes);
       r->pcurrent += bytes;
 
       if (r->pcurrent >= r->pend)
       r->pcurrent += bytes;
 
       if (r->pcurrent >= r->pend)
@@ -868,7 +868,7 @@ cupsRasterWritePixels(cups_raster_t *r,     /* I - Raster stream */
       * Copy the raster data to the buffer...
       */
 
       * Copy the raster data to the buffer...
       */
 
-      memcpy(r->pcurrent, p, bytes);
+      memcpy(r->pcurrent, p, (size_t)bytes);
 
       r->pcurrent += bytes;
 
 
       r->pcurrent += bytes;
 
@@ -1125,7 +1125,7 @@ cups_raster_read(cups_raster_t *r,        /* I - Raster stream */
       * Use memcpy() for a large read...
       */
 
       * Use memcpy() for a large read...
       */
 
-      memcpy(buf, r->bufptr, count);
+      memcpy(buf, r->bufptr, (size_t)count);
       r->bufptr += count;
       remaining -= count;
     }
       r->bufptr += count;
       remaining -= count;
     }
index 3996dd808a56679ec8f5c967364646a7f314c4e4..0975d3e7b17a013f9811a15f527a187af0b00f3e 100644 (file)
@@ -520,7 +520,7 @@ CompressData(const unsigned char *line,     /* I - Data to compress */
 
            *comp_ptr++ = (unsigned char)(count - 1);
 
 
            *comp_ptr++ = (unsigned char)(count - 1);
 
-           memcpy(comp_ptr, start, count);
+           memcpy(comp_ptr, start, (size_t)count);
            comp_ptr += count;
          }
        }
            comp_ptr += count;
          }
        }
index ae9655109123d35ac052ca7c2c78671e78c818fb..03a41681e55a4cdc1a5b78c7b678aba1449caf4f 100644 (file)
@@ -417,7 +417,7 @@ main(int  argc,                             /* I - Number of command-line args */
        attr = ippFindAttribute(msg, "printer-state", IPP_TAG_ENUM);
        if (attr)
        {
        attr = ippFindAttribute(msg, "printer-state", IPP_TAG_ENUM);
        if (attr)
        {
-         dbus_uint32_t val = ippGetInteger(attr, 0);
+         dbus_uint32_t val = (dbus_uint32_t)ippGetInteger(attr, 0);
          dbus_message_iter_append_uint32(&iter, &val);
        }
        else
          dbus_message_iter_append_uint32(&iter, &val);
        }
        else
@@ -446,8 +446,7 @@ main(int  argc,                             /* I - Number of command-line args */
            if (i)
              *p++ = ',';
 
            if (i)
              *p++ = ',';
 
-           strlcpy(p, ippGetString(attr, i, NULL),
-                   reasons_length - (p - printer_reasons));
+           strlcpy(p, ippGetString(attr, i, NULL), reasons_length - (size_t)(p - printer_reasons));
            p += strlen(p);
          }
          if (!dbus_message_iter_append_string(&iter, &printer_reasons))
            p += strlen(p);
          }
          if (!dbus_message_iter_append_string(&iter, &printer_reasons))
@@ -466,7 +465,7 @@ main(int  argc,                             /* I - Number of command-line args */
                                IPP_TAG_BOOLEAN);
        if (attr)
        {
                                IPP_TAG_BOOLEAN);
        if (attr)
        {
-         dbus_bool_t val = ippGetBoolean(attr, 0);
+         dbus_bool_t val = (dbus_bool_t)ippGetBoolean(attr, 0);
          dbus_message_iter_append_boolean(&iter, &val);
        }
        else
          dbus_message_iter_append_boolean(&iter, &val);
        }
        else
@@ -486,7 +485,7 @@ main(int  argc,                             /* I - Number of command-line args */
       attr = ippFindAttribute(msg, "notify-job-id", IPP_TAG_INTEGER);
       if (attr)
       {
       attr = ippFindAttribute(msg, "notify-job-id", IPP_TAG_INTEGER);
       if (attr)
       {
-        dbus_uint32_t val = ippGetInteger(attr, 0);
+        dbus_uint32_t val = (dbus_uint32_t)ippGetInteger(attr, 0);
         dbus_message_iter_append_uint32(&iter, &val);
       }
       else
         dbus_message_iter_append_uint32(&iter, &val);
       }
       else
@@ -496,7 +495,7 @@ main(int  argc,                             /* I - Number of command-line args */
       attr = ippFindAttribute(msg, "job-state", IPP_TAG_ENUM);
       if (attr)
       {
       attr = ippFindAttribute(msg, "job-state", IPP_TAG_ENUM);
       if (attr)
       {
-        dbus_uint32_t val = ippGetInteger(attr, 0);
+        dbus_uint32_t val = (dbus_uint32_t)ippGetInteger(attr, 0);
         dbus_message_iter_append_uint32(&iter, &val);
       }
       else
         dbus_message_iter_append_uint32(&iter, &val);
       }
       else
@@ -519,8 +518,7 @@ main(int  argc,                             /* I - Number of command-line args */
          if (i)
            *p++ = ',';
 
          if (i)
            *p++ = ',';
 
-         strlcpy(p, ippGetString(attr, i, NULL),
-                 reasons_length - (p - job_reasons));
+         strlcpy(p, ippGetString(attr, i, NULL), reasons_length - (size_t)(p - job_reasons));
          p += strlen(p);
        }
        if (!dbus_message_iter_append_string(&iter, &job_reasons))
          p += strlen(p);
        }
        if (!dbus_message_iter_append_string(&iter, &job_reasons))
@@ -545,7 +543,7 @@ main(int  argc,                             /* I - Number of command-line args */
                              IPP_TAG_INTEGER);
       if (attr)
       {
                              IPP_TAG_INTEGER);
       if (attr)
       {
-        dbus_uint32_t val = ippGetInteger(attr, 0);
+        dbus_uint32_t val = (dbus_uint32_t)ippGetInteger(attr, 0);
         dbus_message_iter_append_uint32(&iter, &val);
       }
       else
         dbus_message_iter_append_uint32(&iter, &val);
       }
       else
index f86a3cf9cd096d040ea1b2a3342c5f79f37d09b1..893ea331400d78a6c047783c76d153b4625f262e 100644 (file)
@@ -408,10 +408,10 @@ cupsdInitCerts(void)
     * them as the seed...
     */
 
     * them as the seed...
     */
 
-    seed = cupsFileGetChar(fp);
-    seed = (seed << 8) | cupsFileGetChar(fp);
-    seed = (seed << 8) | cupsFileGetChar(fp);
-    CUPS_SRAND((seed << 8) | cupsFileGetChar(fp));
+    seed = (unsigned)cupsFileGetChar(fp);
+    seed = (seed << 8) | (unsigned)cupsFileGetChar(fp);
+    seed = (seed << 8) | (unsigned)cupsFileGetChar(fp);
+    CUPS_SRAND((seed << 8) | (unsigned)cupsFileGetChar(fp));
 
     cupsFileClose(fp);
   }
 
     cupsFileClose(fp);
   }
index 743df7bc5a21bd59977758ca70fe8f845c62f8b2..23fb71305a534f98317835ce4c4e70dd3a9a23d4 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Client routines for the CUPS scheduler.
  *
  *
  * Client routines for the CUPS scheduler.
  *
- * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2007-2014 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * This file contains Kerberos support code, copyright 2006 by
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * This file contains Kerberos support code, copyright 2006 by
@@ -44,7 +44,7 @@ static int            compare_clients(cupsd_client_t *a, cupsd_client_t *b,
 static int             cupsd_start_tls(cupsd_client_t *con, http_encryption_t e);
 #endif /* HAVE_SSL */
 static char            *get_file(cupsd_client_t *con, struct stat *filestats,
 static int             cupsd_start_tls(cupsd_client_t *con, http_encryption_t e);
 #endif /* HAVE_SSL */
 static char            *get_file(cupsd_client_t *con, struct stat *filestats,
-                                 char *filename, int len);
+                                 char *filename, size_t len);
 static http_status_t   install_cupsd_conf(cupsd_client_t *con);
 static int             is_cgi(cupsd_client_t *con, const char *filename,
                               struct stat *filestats, mime_type_t *type);
 static http_status_t   install_cupsd_conf(cupsd_client_t *con);
 static int             is_cgi(cupsd_client_t *con, const char *filename,
                               struct stat *filestats, mime_type_t *type);
@@ -2636,7 +2636,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
          con->header_used -= bufptr - con->header;
 
          if (con->header_used > 0)
          con->header_used -= bufptr - con->header;
 
          if (con->header_used > 0)
-           memmove(con->header, bufptr, con->header_used);
+           memmove(con->header, bufptr, (size_t)con->header_used);
 
          bufptr = con->header - 1;
 
 
          bufptr = con->header - 1;
 
@@ -2881,11 +2881,11 @@ static char *                           /* O  - Real filename */
 get_file(cupsd_client_t *con,          /* I  - Client connection */
          struct stat    *filestats,    /* O  - File information */
          char           *filename,     /* IO - Filename buffer */
 get_file(cupsd_client_t *con,          /* I  - Client connection */
          struct stat    *filestats,    /* O  - File information */
          char           *filename,     /* IO - Filename buffer */
-         int            len)           /* I  - Buffer length */
+         size_t         len)           /* I  - Buffer length */
 {
   int          status;                 /* Status of filesystem calls */
   char         *ptr;                   /* Pointer info filename */
 {
   int          status;                 /* Status of filesystem calls */
   char         *ptr;                   /* Pointer info filename */
-  int          plen;                   /* Remaining length after pointer */
+  size_t       plen;                   /* Remaining length after pointer */
   char         language[7];            /* Language subdirectory, if any */
 
 
   char         language[7];            /* Language subdirectory, if any */
 
 
@@ -3008,7 +3008,7 @@ get_file(cupsd_client_t *con,             /* I  - Client connection */
        *ptr = '\0';
 
       ptr  = filename + strlen(filename);
        *ptr = '\0';
 
       ptr  = filename + strlen(filename);
-      plen = len - (ptr - filename);
+      plen = len - (size_t)(ptr - filename);
 
       strlcpy(ptr, "index.html", plen);
       status = stat(filename, filestats);
 
       strlcpy(ptr, "index.html", plen);
       status = stat(filename, filestats);
@@ -3055,10 +3055,7 @@ get_file(cupsd_client_t *con,            /* I  - Client connection */
     while (status && language[0]);
   }
 
     while (status && language[0]);
   }
 
-  cupsdLogClient(con, CUPSD_LOG_DEBUG2,
-                 "get_file filestats=%p, filename=%p, len=%d, "
-                "returning \"%s\".", filestats, filename, len,
-                status ? "(null)" : filename);
+  cupsdLogClient(con, CUPSD_LOG_DEBUG2, "get_file filestats=%p, filename=%p, len=" CUPS_LLFMT ", returning \"%s\".", filestats, filename, CUPS_LLCAST len, status ? "(null)" : filename);
 
   if (status)
     return (NULL);
 
   if (status)
     return (NULL);
index 1111f7d07a8b5af6162eb2edddfbc8bb4b27ac3d..29ded7f72c8f96894f1a9534af7867f945612f6e 100644 (file)
@@ -24,6 +24,7 @@
 #include <cups/file.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <cups/file.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <grp.h>
 #include <sys/stat.h>
 #ifdef HAVE_SANDBOX_H
 #  include <sandbox.h>
 #include <sys/stat.h>
 #ifdef HAVE_SANDBOX_H
 #  include <sandbox.h>
index a1de09058b32986bc176123dce93b4ffae7d9613..50a5cb1f41a44bf24fe174c0894a64bc5d1b3866 100644 (file)
@@ -59,7 +59,7 @@ static int    create_job(http_t *http, const char *dest, const char *title,
                            const char *docname, const char *user,
                           int num_options, cups_option_t *options);
 static int     get_printer(http_t *http, const char *name, char *dest,
                            const char *docname, const char *user,
                           int num_options, cups_option_t *options);
 static int     get_printer(http_t *http, const char *name, char *dest,
-                           int destsize, cups_option_t **options,
+                           size_t destsize, cups_option_t **options,
                            int *accepting, int *shared, ipp_pstate_t *state);
 static int     print_file(http_t *http, int id, const char *filename,
                           const char *docname, const char *user,
                            int *accepting, int *shared, ipp_pstate_t *state);
 static int     print_file(http_t *http, int id, const char *filename,
                           const char *docname, const char *user,
@@ -398,7 +398,7 @@ static int                          /* O - Number of options or -1 on error */
 get_printer(http_t        *http,       /* I - HTTP connection */
             const char    *name,       /* I - Printer name from request */
            char          *dest,        /* I - Destination buffer */
 get_printer(http_t        *http,       /* I - HTTP connection */
             const char    *name,       /* I - Printer name from request */
            char          *dest,        /* I - Destination buffer */
-            int           destsize,    /* I - Size of destination buffer */
+            size_t        destsize,    /* I - Size of destination buffer */
            cups_option_t **options,    /* O - Printer options */
            int           *accepting,   /* O - printer-is-accepting-jobs value */
            int           *shared,      /* O - printer-is-shared value */
            cups_option_t **options,    /* O - Printer options */
            int           *accepting,   /* O - printer-is-accepting-jobs value */
            int           *shared,      /* O - printer-is-shared value */
index 12806624605968abb96037e87a744491dd80c67f..d0f8fb5c4b2acea418499d331284c43dfdc92ee9 100644 (file)
@@ -204,8 +204,7 @@ extern void         cupsdSetStringf(char **s, const char *f, ...)
 extern void            *cupsdCreateProfile(int job_id, int allow_networking);
 extern void            cupsdDestroyProfile(void *profile);
 extern int             cupsdEndProcess(int pid, int force);
 extern void            *cupsdCreateProfile(int job_id, int allow_networking);
 extern void            cupsdDestroyProfile(void *profile);
 extern int             cupsdEndProcess(int pid, int force);
-extern const char      *cupsdFinishProcess(int pid, char *name, int namelen,
-                                           int *job_id);
+extern const char      *cupsdFinishProcess(int pid, char *name, size_t namelen, int *job_id);
 extern int             cupsdStartProcess(const char *command, char *argv[],
                                          char *envp[], int infd, int outfd,
                                          int errfd, int backfd, int sidefd,
 extern int             cupsdStartProcess(const char *command, char *argv[],
                                          char *envp[], int infd, int outfd,
                                          int errfd, int backfd, int sidefd,
index 0d236c918bd4b0f951bbee1ccec220157c688781..210243641d4c24957ef84987a3c5d86ed87bb0cb 100644 (file)
@@ -1,30 +1,16 @@
 /*
  * "$Id$"
  *
 /*
  * "$Id$"
  *
- *   File functions for the CUPS scheduler.
+ * File functions for the CUPS scheduler.
  *
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *
- *   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"
- *   "LICENSE" which should have been included with this file.  If this
- *   file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- *   cupsdCleanFiles()          - Clean out old files.
- *   cupsdCloseCreatedConfFile() - Close a created configuration file and move
- *                                into place.
- *   cupsdClosePipe()           - Close a pipe as necessary.
- *   cupsdCreateConfFile()      - Create a configuration file safely.
- *   cupsdOpenConfFile()        - Open a configuration file.
- *   cupsdOpenPipe()            - Create a pipe which is closed on exec.
- *   cupsdRemoveFile()          - Remove a file securely.
- *   cupsdUnlinkOrRemoveFile()  - Unlink or securely remove a file depending
- *                                on the configuration.
- *   overwrite_data()           - Overwrite the data in a file.
+ * 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"
+ * "LICENSE" which should have been included with this file.  If this
+ * file is missing or damaged, see the license at "http://www.cups.org/".
  */
 
 /*
  */
 
 /*
@@ -445,7 +431,7 @@ overwrite_data(int        fd,               /* I - File descriptor */
     else
       bytes = filesize;
 
     else
       bytes = filesize;
 
-    if ((bytes = write(fd, buffer, bytes)) < 0)
+    if ((bytes = write(fd, buffer, (size_t)bytes)) < 0)
       return (-1);
 
     filesize -= bytes;
       return (-1);
 
     filesize -= bytes;
index c5335c6983f15a89bf81f7e991c94ec13ffec2c7..d00fddb4195f0fc14df2cebd2ea58071c7bf26af 100644 (file)
@@ -129,15 +129,12 @@ static void       set_printer_defaults(cupsd_client_t *con,
                                     cupsd_printer_t *printer);
 static void    start_printer(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    stop_printer(cupsd_client_t *con, ipp_attribute_t *uri);
                                     cupsd_printer_t *printer);
 static void    start_printer(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    stop_printer(cupsd_client_t *con, ipp_attribute_t *uri);
-static void    url_encode_attr(ipp_attribute_t *attr, char *buffer,
-                               int bufsize);
-static char    *url_encode_string(const char *s, char *buffer, int bufsize);
+static void    url_encode_attr(ipp_attribute_t *attr, char *buffer, size_t bufsize);
+static char    *url_encode_string(const char *s, char *buffer, size_t bufsize);
 static int     user_allowed(cupsd_printer_t *p, const char *username);
 static void    validate_job(cupsd_client_t *con, ipp_attribute_t *uri);
 static int     validate_name(const char *name);
 static int     user_allowed(cupsd_printer_t *p, const char *username);
 static void    validate_job(cupsd_client_t *con, ipp_attribute_t *uri);
 static int     validate_name(const char *name);
-static int     validate_user(cupsd_job_t *job, cupsd_client_t *con,
-                             const char *owner, char *username,
-                             int userlen);
+static int     validate_user(cupsd_job_t *job, cupsd_client_t *con, const char *owner, char *username, size_t userlen);
 
 
 /*
 
 
 /*
@@ -2115,7 +2112,7 @@ add_job_subscriptions(
       {
        sub->user_data_len = user_data->values[0].unknown.length;
        memcpy(sub->user_data, user_data->values[0].unknown.data,
       {
        sub->user_data_len = user_data->values[0].unknown.length;
        memcpy(sub->user_data, user_data->values[0].unknown.data,
-              sub->user_data_len);
+              (size_t)sub->user_data_len);
       }
 
       ippAddSeparator(con->response);
       }
 
       ippAddSeparator(con->response);
@@ -5555,7 +5552,7 @@ create_subscription(
     {
       sub->user_data_len = user_data->values[0].unknown.length;
       memcpy(sub->user_data, user_data->values[0].unknown.data,
     {
       sub->user_data_len = user_data->values[0].unknown.length;
       memcpy(sub->user_data, user_data->values[0].unknown.data,
-             sub->user_data_len);
+             (size_t)sub->user_data_len);
     }
 
     ippAddSeparator(con->response);
     }
 
     ippAddSeparator(con->response);
@@ -10554,7 +10551,7 @@ stop_printer(cupsd_client_t  *con,      /* I - Client connection */
 static void
 url_encode_attr(ipp_attribute_t *attr, /* I - Attribute */
                 char            *buffer,/* I - String buffer */
 static void
 url_encode_attr(ipp_attribute_t *attr, /* I - Attribute */
                 char            *buffer,/* I - String buffer */
-               int             bufsize)/* I - Size of buffer */
+               size_t          bufsize)/* I - Size of buffer */
 {
   int  i;                              /* Looping var */
   char *bufptr,                        /* Pointer into buffer */
 {
   int  i;                              /* Looping var */
   char *bufptr,                        /* Pointer into buffer */
@@ -10580,8 +10577,7 @@ url_encode_attr(ipp_attribute_t *attr,  /* I - Attribute */
 
     *bufptr++ = '\'';
 
 
     *bufptr++ = '\'';
 
-    bufptr = url_encode_string(attr->values[i].string.text,
-                               bufptr, bufend - bufptr + 1);
+    bufptr = url_encode_string(attr->values[i].string.text, bufptr, (size_t)(bufend - bufptr + 1));
 
     if (bufptr >= bufend)
       break;
 
     if (bufptr >= bufend)
       break;
@@ -10600,7 +10596,7 @@ url_encode_attr(ipp_attribute_t *attr,  /* I - Attribute */
 static char *                          /* O - End of string */
 url_encode_string(const char *s,       /* I - String */
                   char       *buffer,  /* I - String buffer */
 static char *                          /* O - End of string */
 url_encode_string(const char *s,       /* I - String */
                   char       *buffer,  /* I - String buffer */
-                 int        bufsize)   /* I - Size of buffer */
+                 size_t     bufsize)   /* I - Size of buffer */
 {
   char *bufptr,                        /* Pointer into buffer */
        *bufend;                        /* End of buffer */
 {
   char *bufptr,                        /* Pointer into buffer */
        *bufend;                        /* End of buffer */
@@ -10955,16 +10951,12 @@ validate_user(cupsd_job_t    *job,    /* I - Job */
               cupsd_client_t *con,     /* I - Client connection */
               const char     *owner,   /* I - Owner of job/resource */
               char           *username,        /* O - Authenticated username */
               cupsd_client_t *con,     /* I - Client connection */
               const char     *owner,   /* I - Owner of job/resource */
               char           *username,        /* O - Authenticated username */
-             int            userlen)   /* I - Length of username */
+             size_t         userlen)   /* I - Length of username */
 {
   cupsd_printer_t      *printer;       /* Printer for job */
 
 
 {
   cupsd_printer_t      *printer;       /* Printer for job */
 
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                  "validate_user(job=%d, con=%d, owner=\"%s\", username=%p, "
-                 "userlen=%d)",
-                 job->id, con ? con->number : 0,
-                 owner ? owner : "(null)", username, userlen);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "validate_user(job=%d, con=%d, owner=\"%s\", username=%p, userlen=" CUPS_LLFMT ")", job->id, con ? con->number : 0, owner ? owner : "(null)", username, CUPS_LLCAST userlen);
 
  /*
   * Validate input...
 
  /*
   * Validate input...
index 5d5dba61766f3905b66f3bd5817d93ee95c5e451..527f4ccb08aa952da2f06edb10278982fdbd304a 100644 (file)
@@ -722,7 +722,7 @@ cupsdLogPage(cupsd_job_t *job,              /* I - Job being printed */
              * Pull the name from inside the brackets...
              */
 
              * Pull the name from inside the brackets...
              */
 
-             memcpy(name, format + 1, nameend - format - 1);
+             memcpy(name, format + 1, (size_t)(nameend - format - 1));
              name[nameend - format - 1] = '\0';
 
              format = nameend;
              name[nameend - format - 1] = '\0';
 
              format = nameend;
index 6d7f1ce20cf1c15cc8cdfd70d702e9a0e2bacdb7..ca857c703052c61d7ca4e2832f8f81dca8b0a3dd 100644 (file)
@@ -1491,8 +1491,7 @@ cupsdSaveAllPrinters(void)
         if (i)
          *ptr++ = ',';
 
         if (i)
          *ptr++ = ',';
 
-        strlcpy(ptr, marker->values[i].string.text,
-               value + sizeof(value) - ptr);
+        strlcpy(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
         ptr += strlen(ptr);
       }
 
         ptr += strlen(ptr);
       }
 
@@ -1551,8 +1550,7 @@ cupsdSaveAllPrinters(void)
         if (i)
          *ptr++ = ',';
 
         if (i)
          *ptr++ = ',';
 
-        strlcpy(ptr, marker->values[i].string.text,
-               value + sizeof(value) - ptr);
+        strlcpy(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
         ptr += strlen(ptr);
       }
 
         ptr += strlen(ptr);
       }
 
@@ -1572,8 +1570,7 @@ cupsdSaveAllPrinters(void)
         if (i)
          *ptr++ = ',';
 
         if (i)
          *ptr++ = ',';
 
-        strlcpy(ptr, marker->values[i].string.text,
-               value + sizeof(value) - ptr);
+        strlcpy(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
         ptr += strlen(ptr);
       }
 
         ptr += strlen(ptr);
       }
 
index 6afb5926cfafb9085683f7bea7e54323fcbf272f..469e77a682821de3d6304d94e5c29658cdc1faa0 100644 (file)
@@ -369,10 +369,10 @@ cupsdEndProcess(int pid,          /* I - Process ID */
  */
 
 const char *                           /* O - Process name */
  */
 
 const char *                           /* O - Process name */
-cupsdFinishProcess(int  pid,           /* I - Process ID */
-                   char *name,         /* I - Name buffer */
-                  int  namelen,        /* I - Size of name buffer */
-                  int  *job_id)        /* O - Job ID pointer or NULL */
+cupsdFinishProcess(int    pid,         /* I - Process ID */
+                   char   *name,       /* I - Name buffer */
+                  size_t namelen,      /* I - Size of name buffer */
+                  int    *job_id)      /* O - Job ID pointer or NULL */
 {
   cupsd_proc_t key,                    /* Search key */
                *proc;                  /* Matching process */
 {
   cupsd_proc_t key,                    /* Search key */
                *proc;                  /* Matching process */
@@ -397,10 +397,7 @@ cupsdFinishProcess(int  pid,               /* I - Process ID */
     strlcpy(name, "unknown", namelen);
   }
 
     strlcpy(name, "unknown", namelen);
   }
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                 "cupsdFinishProcess(pid=%d, name=%p, namelen=%d, "
-                 "job_id=%p(%d)) = \"%s\"", pid, name, namelen, job_id,
-                 job_id ? *job_id : 0, name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFinishProcess(pid=%d, name=%p, namelen=" CUPS_LLFMT ", job_id=%p(%d)) = \"%s\"", pid, name, CUPS_LLCAST namelen, job_id, job_id ? *job_id : 0, name);
 
   return (name);
 }
 
   return (name);
 }
@@ -437,10 +434,9 @@ cupsdStartProcess(
   char         user_str[16],           /* User string */
                group_str[16],          /* Group string */
                nice_str[16];           /* FilterNice string */
   char         user_str[16],           /* User string */
                group_str[16],          /* Group string */
                nice_str[16];           /* FilterNice string */
-#endif /* HAVE_POSIX_SPAWN */
-#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+#elif defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
   struct sigaction action;             /* POSIX signal handler */
   struct sigaction action;             /* POSIX signal handler */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+#endif /* HAVE_POSIX_SPAWN */
 #if defined(__APPLE__)
   char         processPath[1024],      /* CFProcessPath environment variable */
                linkpath[1024];         /* Link path for symlinks... */
 #if defined(__APPLE__)
   char         processPath[1024],      /* CFProcessPath environment variable */
                linkpath[1024];         /* Link path for symlinks... */
index 08b91714b56452ca7f1e20d97f2770c815566270..d302db0af8e7459b4b4cfa704225ca94f4f53822 100644 (file)
@@ -518,15 +518,13 @@ cupsdDoSelect(long timeout)               /* I - Timeout in seconds */
 
 
       if (cupsd_pollfds)
 
 
       if (cupsd_pollfds)
-       pfd = realloc(cupsd_pollfds, allocfds * sizeof(struct pollfd));
+       pfd = realloc(cupsd_pollfds, (size_t)allocfds * sizeof(struct pollfd));
       else
       else
-       pfd = malloc(allocfds * sizeof(struct pollfd));
+       pfd = malloc((size_t)allocfds * sizeof(struct pollfd));
 
       if (!pfd)
       {
 
       if (!pfd)
       {
-       cupsdLogMessage(CUPSD_LOG_EMERG,
-                       "Unable to allocate %d bytes for polling!",
-                       (int)(allocfds * sizeof(struct pollfd)));
+       cupsdLogMessage(CUPSD_LOG_EMERG, "Unable to allocate %d bytes for polling.", (int)((size_t)allocfds * sizeof(struct pollfd)));
 
        return (-1);
       }
 
        return (-1);
       }
@@ -555,9 +553,9 @@ cupsdDoSelect(long timeout)         /* I - Timeout in seconds */
   }
 
   if (timeout >= 0 && timeout < 86400)
   }
 
   if (timeout >= 0 && timeout < 86400)
-    nfds = poll(cupsd_pollfds, count, timeout * 1000);
+    nfds = poll(cupsd_pollfds, (nfds_t)count, timeout * 1000);
   else
   else
-    nfds = poll(cupsd_pollfds, count, -1);
+    nfds = poll(cupsd_pollfds, (nfds_t)count, -1);
 
   if (nfds > 0)
   {
 
   if (nfds > 0)
   {
@@ -808,7 +806,7 @@ cupsdStartSelect(void)
 
 #ifdef HAVE_EPOLL
   cupsd_epoll_fd       = epoll_create(MaxFDs);
 
 #ifdef HAVE_EPOLL
   cupsd_epoll_fd       = epoll_create(MaxFDs);
-  cupsd_epoll_events   = calloc(MaxFDs, sizeof(struct epoll_event));
+  cupsd_epoll_events   = calloc((size_t)MaxFDs, sizeof(struct epoll_event));
   cupsd_update_pollfds = 0;
 
 #elif defined(HAVE_KQUEUE)
   cupsd_update_pollfds = 0;
 
 #elif defined(HAVE_KQUEUE)
index 518fc12bee08b7393321a918f74df37896d9bce1..1c2bd74e616fe53251f658e807865b36784b7375 100644 (file)
@@ -305,7 +305,7 @@ cupsdStatBufUpdate(
   * Copy the message to the line buffer...
   */
 
   * Copy the message to the line buffer...
   */
 
-  strlcpy(line, message, linelen);
+  strlcpy(line, message, (size_t)linelen);
 
  /*
   * Copy over the buffer data we've used up...
 
  /*
   * Copy over the buffer data we've used up...
index 8357197f3702cb8bb007088edab63e0e336816d0..60bc0ca5d70d3d11474ef743ae038081fe86ce4f 100644 (file)
@@ -528,7 +528,7 @@ mimeAddTypeRule(mime_type_t *mt,    /* I - Type to add to */
            if ((size_t)length[1] > sizeof(temp->value.stringv))
              return (-1);
            temp->length = length[1];
            if ((size_t)length[1] > sizeof(temp->value.stringv))
              return (-1);
            temp->length = length[1];
-           memcpy(temp->value.stringv, value[1], length[1]);
+           memcpy(temp->value.stringv, value[1], (size_t)length[1]);
            break;
        case MIME_MAGIC_CHAR :
            temp->offset = strtol(value[0], NULL, 0);
            break;
        case MIME_MAGIC_CHAR :
            temp->offset = strtol(value[0], NULL, 0);
@@ -560,7 +560,7 @@ mimeAddTypeRule(mime_type_t *mt,    /* I - Type to add to */
            if ((size_t)length[2] > sizeof(temp->value.stringv))
              return (-1);
            temp->length = length[2];
            if ((size_t)length[2] > sizeof(temp->value.stringv))
              return (-1);
            temp->length = length[2];
-           memcpy(temp->value.stringv, value[2], length[2]);
+           memcpy(temp->value.stringv, value[2], (size_t)length[2]);
            break;
       }
     }
            break;
       }
     }
@@ -886,7 +886,7 @@ mime_check_rules(
             char temp[MIME_MAX_BUFFER + 1];
                                        /* Temporary buffer */
 
             char temp[MIME_MAX_BUFFER + 1];
                                        /* Temporary buffer */
 
-            memcpy(temp, fb->buffer, fb->length);
+            memcpy(temp, fb->buffer, (size_t)fb->length);
             temp[fb->length] = '\0';
             result = !regexec(&(rules->value.rev), temp, 0, NULL, 0);
           }
             temp[fb->length] = '\0';
             result = !regexec(&(rules->value.rev), temp, 0, NULL, 0);
           }
index 59dbdbf7730c59df12e4edf659489cc33e1a6bcc..5485c9f8bafce82938b9855fdbff20e004f4829c 100644 (file)
@@ -2281,7 +2281,7 @@ list_service(ippfind_srv_t *service)      /* I - Service */
            i ++, ptr += strlen(ptr))
       {
         *ptr++ = ',';
            i ++, ptr += strlen(ptr))
       {
         *ptr++ = ',';
-        strlcpy(ptr, ippGetString(attr, i, NULL), end - ptr + 1);
+        strlcpy(ptr, ippGetString(attr, i, NULL), (size_t)(end - ptr + 1));
       }
     }
     else
       }
     }
     else
index e32ef571cdfeee32f637b9d4a567f6dc8422cf21..00124c1f0d48b953921f046e3ba62c779c5ecbdb 100644 (file)
@@ -2257,7 +2257,7 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
            last_expect->with_flags |= _CUPS_WITH_REGEX;
 
            if (last_expect->with_value)
            last_expect->with_flags |= _CUPS_WITH_REGEX;
 
            if (last_expect->with_value)
-             memcpy(last_expect->with_value, token + 1, tokenptr - token - 1);
+             memcpy(last_expect->with_value, token + 1, (size_t)(tokenptr - token - 1));
          }
          else
          {
          }
          else
          {
@@ -3348,7 +3348,7 @@ expand_variables(_cups_vars_t *vars,      /* I - Variables */
 
       if (value)
       {
 
       if (value)
       {
-        strlcpy(dstptr, value, dstend - dstptr + 1);
+        strlcpy(dstptr, value, (size_t)(dstend - dstptr + 1));
        dstptr += strlen(dstptr);
       }
     }
        dstptr += strlen(dstptr);
       }
     }