]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix some clang-reported issues.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 7 Mar 2013 22:03:22 +0000 (22:03 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 7 Mar 2013 22:03:22 +0000 (22:03 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10884 7a7537e8-13f0-0310-91df-b6672ffda945

backend/usb-darwin.c
scheduler/ipp.c
scheduler/job.c
scheduler/testlpd.c

index fe8daeb2e7ad311bbc3065abc0d5a1379d2b38ec..9a93f123cb8dea3b256017e4028b63829d46deaa 100644 (file)
@@ -1,7 +1,7 @@
 /*
 * "$Id$"
 *
-* Copyright 2005-2012 Apple Inc. All rights reserved.
+* Copyright 2005-2013 Apple Inc. All rights reserved.
 *
 * IMPORTANT:  This Apple software is supplied to you by Apple Computer,
 * Inc. ("Apple") in consideration of your agreement to the following
@@ -1132,7 +1132,7 @@ static void iterate_printers(iterator_callback_t callBack,
     CFRelease(usb_klass);
     CFRelease(usb_subklass);
 
-    kr = IOServiceAddMatchingNotification(addNotification, kIOMatchedNotification, usbPrinterMatchDictionary, &device_added, &reference, &addIterator);
+    IOServiceAddMatchingNotification(addNotification, kIOMatchedNotification, usbPrinterMatchDictionary, &device_added, &reference, &addIterator);
     if (addIterator != 0x0)
     {
       device_added (&reference, addIterator);
@@ -1171,7 +1171,7 @@ static void device_added(void *userdata,
 
   /* One last call to the call back now that we are not longer have printers left to iterate...
    */
-  if (reference->keepRunning)
+  if (reference->keepRunning && reference->callback)
     reference->keepRunning = reference->callback(reference->userdata, 0x0);
 
   if (!reference->keepRunning)
@@ -1719,7 +1719,7 @@ static void copy_devicestring(io_service_t usbInterface,
        kr = load_classdriver(NULL, interface, &klassDriver);
 
       if (kr == kIOReturnSuccess && klassDriver != NULL)
-         kr = copy_deviceid(klassDriver, deviceID);
+         copy_deviceid(klassDriver, deviceID);
 
       unload_classdriver(&klassDriver);
 
index de76ab3d52aab77601f902ea6d3d7125b0330cef..09295e4bc4c5ccc6ad0c1aa08057c605744845ae 100644 (file)
@@ -1235,6 +1235,12 @@ add_file(cupsd_client_t *con,            /* I - Connection to client */
                                           sizeof(mime_type_t *));
   }
 
+  if (compressions)
+    job->compressions = compressions;
+
+  if (filetypes)
+    job->filetypes = filetypes;
+
   if (!compressions || !filetypes)
   {
     cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_PURGE,
@@ -1247,9 +1253,7 @@ add_file(cupsd_client_t *con,             /* I - Connection to client */
     return (-1);
   }
 
-  job->compressions                 = compressions;
   job->compressions[job->num_files] = compression;
-  job->filetypes                    = filetypes;
   job->filetypes[job->num_files]    = filetype;
 
   job->num_files ++;
index 1d43f1c22d4520a7adbb1fc01880077f9512ea54..ffe72a56ef3b3cafa2e9b79e5c58b00d9b7a3176 100644 (file)
@@ -1869,6 +1869,12 @@ cupsdLoadJob(cupsd_job_t *job)           /* I - Job */
                                                 fileid);
         }
 
+       if (compressions)
+         job->compressions = compressions;
+
+       if (filetypes)
+         job->filetypes = filetypes;
+
         if (!compressions || !filetypes)
        {
           cupsdLogMessage(CUPSD_LOG_ERROR,
@@ -1878,12 +1884,6 @@ cupsdLoadJob(cupsd_job_t *job)           /* I - Job */
          ippDelete(job->attrs);
          job->attrs = NULL;
 
-         if (compressions)
-           free(compressions);
-
-         if (filetypes)
-           free(filetypes);
-
          if (job->compressions)
          {
            free(job->compressions);
@@ -1900,9 +1900,7 @@ cupsdLoadJob(cupsd_job_t *job)            /* I - Job */
          return (0);
        }
 
-        job->compressions = compressions;
-        job->filetypes    = filetypes;
-       job->num_files    = fileid;
+       job->num_files = fileid;
       }
 
       job->filetypes[fileid - 1] = mimeFileType(MimeDatabase, jobfile, NULL,
@@ -4160,6 +4158,13 @@ load_job_cache(const char *filename)     /* I - job.cache filename */
                       line, linenum);
   }
 
+  if (job)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                   "Missing </Job> directive on line %d.", linenum);
+    cupsdDeleteJob(job, CUPSD_JOB_PURGE);
+  }
+
   cupsFileClose(fp);
 }
 
index bc90757a98ae70ecf986412cdb0a56c1ea209841..60076939e553ae2567d05379d4b29f55ba22fbe9 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   cups-lpd test program for CUPS.
  *
- *   Copyright 2007-2010 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
  */
 
 static int     do_command(int outfd, int infd, const char *command);
-static int     print_job(int outfd, int infd, char *dest, char **args);
+static int     print_job(int outfd, int infd, char *dest, char **args) __attribute__((nonnull(4)));
 static int     print_waiting(int outfd, int infd, char *dest);
-static int     remove_job(int outfd, int infd, char *dest, char **args);
-static int     status_long(int outfd, int infd, char *dest, char **args);
-static int     status_short(int outfd, int infd, char *dest, char **args);
+static int     remove_job(int outfd, int infd, char *dest, char **args) __attribute__((nonnull(4)));
+static int     status_long(int outfd, int infd, char *dest, char **args) __attribute__((nonnull(4)));
+static int     status_short(int outfd, int infd, char *dest, char **args) __attribute__((nonnull(4)));
 static void    usage(void) __attribute__((noreturn));
 
 
@@ -76,7 +76,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
   */
 
   op              = NULL;
-  opargs          = NULL;
+  opargs          = argv + argc;
   dest            = NULL;
   cupslpd_argc    = 1;
   cupslpd_argv[0] = (char *)"cups-lpd";