From 3356b83fc76f0a6cfbe7a7737988dcd4704fe634 Mon Sep 17 00:00:00 2001 From: Alfonso Gregory <83477269+AtariDreams@users.noreply.github.com> Date: Mon, 30 Aug 2021 14:52:36 -0400 Subject: Sync usb-darwin to upstream --- backend/usb-darwin.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index ee75b9e0d..f0d04ab42 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -359,6 +359,8 @@ print_device(const char *uri, /* I - Device URI */ (void)uri; + (void)argc; + (void)argv; /* * Catch SIGQUIT to determine who is sending it... @@ -1512,12 +1514,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); @@ -1615,14 +1616,14 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, if (actualLength > 2 && actualLength <= bufferLength - 2) { - ret = CFStringCreateWithBytes(NULL, (const UInt8 *) &request.pData[2], actualLength - 2, kCFStringEncodingUTF8, false); + ret = CFStringCreateWithBytes(NULL, (const UInt8 *)request.pData + 2, actualLength - 2, kCFStringEncodingUTF8, false); } else if (actualLength > 2) { err = sendRequest(actualLength); if (err == kIOReturnSuccess && request.wLenDone > 0) { actualLength = OSSwapBigToHostInt16(*((UInt16 *)request.pData)); - ret = CFStringCreateWithBytes(NULL, (const UInt8 *) &request.pData[2], actualLength - 2, kCFStringEncodingUTF8, false); + ret = CFStringCreateWithBytes(NULL, (const UInt8 *)request.pData + 2, actualLength - 2, kCFStringEncodingUTF8, false); } } } @@ -1703,13 +1704,8 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, { CFStringAppend(extras, ret); CFRelease(ret); - - ret = extras; - } - else - { - ret = extras; } + ret = extras; } } @@ -1816,7 +1812,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ if ((description[0] & 1) != 0) description[0] &= 0xfe; - char buffer[258] = {}; + char buffer[258] = {0}; unsigned int maxLength = sizeof buffer; if (description[0] > 1) { -- cgit v1.2.1