]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix some clang-reported warnings.
authorMichael R Sweet <msweet@msweet.org>
Mon, 8 Mar 2021 00:39:57 +0000 (19:39 -0500)
committerMichael R Sweet <msweet@msweet.org>
Mon, 8 Mar 2021 00:39:57 +0000 (19:39 -0500)
backend/usb-darwin.c
cups/dest.c
cups/ppd-cache.c
scheduler/ipp.c
scheduler/main.c
xcode/CUPS.xcodeproj/project.pbxproj

index bea182c6b793ba3d78e48dd6ecbabf1f902c9b53..0b69967621e38675676fc9136ee9522f845530df 100644 (file)
@@ -357,6 +357,8 @@ print_device(const char *uri,               /* I - Device URI */
 
 
   (void)uri;
+  (void)argc;
+  (void)argv;
 
  /*
   * Catch SIGQUIT to determine who is sending it...
@@ -1510,12 +1512,11 @@ static kern_return_t load_printerdriver(CFStringRef *driverBundlePath)
   SInt32               score;
   kern_return_t                kr;
   printer_interface_t  interface;
-  HRESULT              res;
 
   kr = IOCreatePlugInInterfaceForService(g.printer_obj, kIOUSBInterfaceUserClientTypeID, kIOCFPlugInInterfaceID, &iodev, &score);
   if (kr == kIOReturnSuccess)
   {
-    if ((res = (*iodev)->QueryInterface(iodev, USB_INTERFACE_KIND, (LPVOID *) &interface)) == noErr)
+    if ((*iodev)->QueryInterface(iodev, USB_INTERFACE_KIND, (LPVOID *) &interface) == noErr)
     {
       *driverBundlePath = IORegistryEntryCreateCFProperty(g.printer_obj, kUSBClassDriverProperty, NULL, kNilOptions);
 
index df38d892696c4385ccd70e328f715a7d2754398c..c1746da9c43110a643f888154ff9172d123d7e03 100644 (file)
@@ -4369,11 +4369,12 @@ cups_queue_name(
   }
 
  /*
-  * Remove an underscore if it is the last character
-  * and isn't the only character in the string
+  * Remove an underscore if it is the last character and isn't the only
+  * character in the name...
   */
-  if (nameptr[-1] == '_' && nameptr > (name + 1))
-    nameptr--;
+
+  if (nameptr > (name + 1) && nameptr[-1] == '_')
+    nameptr --;
 
   *nameptr = '\0';
 }
index 977d0c600076716eacb0a41cb3b7b12941ffb25b..5446fe189db85d54338133b0181dd8463d0d6c59 100644 (file)
@@ -3687,7 +3687,7 @@ _ppdCreateFromIPP(char   *buffer, /* I - Filename buffer */
     if (have_default)
       cupsFilePrintf(fp, "*DefaultInputSlot: %s\n", ppdname);
 
-    for (i = 0, count = ippGetCount(attr); i < count; i ++)
+    for (i = 0; i < count; i ++)
     {
       keyword = ippGetString(attr, i, NULL);
 
index 29ada3e028c531f0908af5986eea01b928490701..2104d46bbcda63e6c5d034898ba7338695637ac4 100644 (file)
@@ -881,7 +881,7 @@ add_class(cupsd_client_t  *con,             /* I - Client connection */
     * Class doesn't exist; see if we have a printer of the same name...
     */
 
-    if ((pclass = cupsdFindPrinter(resource + 9)) != NULL)
+    if (cupsdFindPrinter(resource + 9))
     {
      /*
       * Yes, return an error...
@@ -2274,7 +2274,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     * Printer doesn't exist; see if we have a class of the same name...
     */
 
-    if ((printer = cupsdFindClass(resource + 10)) != NULL)
+    if (cupsdFindClass(resource + 10))
     {
      /*
       * Yes, return an error...
index d9f5087e3a1b2be880693c5f687fff2e7f90f7e0..3c7da9f74ca931241e72b37e7046708a1bd57702 100644 (file)
@@ -582,7 +582,7 @@ main(int  argc,                             /* I - Number of command-line args */
   * Clean out old temp files and printer cache data.
   */
 
-  if (!strncmp(TempDir, RequestRoot, strlen(RequestRoot)))
+  if (!RequestRoot || !strncmp(TempDir, RequestRoot, strlen(RequestRoot)))
     cupsdCleanFiles(TempDir, NULL);
 
   cupsdCleanFiles(CacheDir, "*.ipp");
index 51bbfc5562eee98e5f9e0a1f2eb2e7736950ce6f..3d69bfc72aff623930c96bd27379f32a26a0a0f7 100644 (file)
                                        "-Wno-shorten-64-to-32",
                                );
                                USE_HEADERMAP = NO;
+                               WARNING_CFLAGS = "-Wno-deprecated-declarations";
                        };
                        name = Debug;
                };
                                        "-Wno-shorten-64-to-32",
                                );
                                USE_HEADERMAP = NO;
+                               WARNING_CFLAGS = "-Wno-deprecated-declarations";
                        };
                        name = Release;
                };