From: Michael R Sweet Date: Mon, 8 Mar 2021 00:39:57 +0000 (-0500) Subject: Fix some clang-reported warnings. X-Git-Tag: v2.4b1~188^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e28e9df0723e67933c9472a71f22544d89bf5f;p=thirdparty%2Fcups.git Fix some clang-reported warnings. --- diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index bea182c6b7..0b69967621 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -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); diff --git a/cups/dest.c b/cups/dest.c index df38d89269..c1746da9c4 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -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'; } diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c index 977d0c6000..5446fe189d 100644 --- a/cups/ppd-cache.c +++ b/cups/ppd-cache.c @@ -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); diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 29ada3e028..2104d46bbc 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -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... diff --git a/scheduler/main.c b/scheduler/main.c index d9f5087e3a..3c7da9f74c 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -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"); diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 51bbfc5562..3d69bfc72a 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -11588,6 +11588,7 @@ "-Wno-shorten-64-to-32", ); USE_HEADERMAP = NO; + WARNING_CFLAGS = "-Wno-deprecated-declarations"; }; name = Debug; }; @@ -11638,6 +11639,7 @@ "-Wno-shorten-64-to-32", ); USE_HEADERMAP = NO; + WARNING_CFLAGS = "-Wno-deprecated-declarations"; }; name = Release; };