From b1d1783da4b7daf2696e547ac3ec265e00eebbc7 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Tue, 10 Nov 2020 17:21:43 +0100 Subject: [PATCH] USB: warnings fixups --- pcsx2/USB/qemu-usb/usb-ohci.cpp | 22 ++++++++-------------- pcsx2/USB/qemu-usb/vl.h | 7 ------- pcsx2/gui/SysState.cpp | 6 ++---- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/pcsx2/USB/qemu-usb/usb-ohci.cpp b/pcsx2/USB/qemu-usb/usb-ohci.cpp index 6ed34fb0f8..7653a074aa 100644 --- a/pcsx2/USB/qemu-usb/usb-ohci.cpp +++ b/pcsx2/USB/qemu-usb/usb-ohci.cpp @@ -237,36 +237,34 @@ static void ohci_wakeup(USBPort* port1) static USBDevice* ohci_find_device(OHCIState* ohci, uint8_t addr) { USBDevice* dev; - int i; - for (i = 0; i < ohci->num_ports; i++) + for (unsigned int i = 0; i < ohci->num_ports; i++) { if ((ohci->rhport[i].ctrl & OHCI_PORT_PES) == 0) { continue; } dev = usb_find_device(&ohci->rhport[i].port, addr); - if (dev != NULL) + if (dev != nullptr) { return dev; } } - return NULL; + return nullptr; } //TODO no devices using this yet static void ohci_stop_endpoints(OHCIState* ohci) { USBDevice* dev; - int i, j; - for (i = 0; i < ohci->num_ports; i++) + for (unsigned int i = 0; i < ohci->num_ports; i++) { dev = ohci->rhport[i].port.dev; if (dev && dev->attached) { usb_device_ep_stopped(dev, &dev->ep_ctl); - for (j = 0; j < USB_MAX_ENDPOINTS; j++) + for (int j = 0; j < USB_MAX_ENDPOINTS; j++) { usb_device_ep_stopped(dev, &dev->ep_in[j]); usb_device_ep_stopped(dev, &dev->ep_out[j]); @@ -719,7 +717,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, // str, len, ret); /* Writeback */ - if (dir == OHCI_TD_DIR_IN && ret >= 0 && ret <= len) + if (dir == OHCI_TD_DIR_IN && ret >= 0 && ret <= (int)len) { /* IN transfer succeeded */ if (ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, ret, @@ -1397,17 +1395,13 @@ static void ohci_set_hub_status(OHCIState* ohci, uint32_t val) if (val & OHCI_RHS_LPS) { - int i; - - for (i = 0; i < ohci->num_ports; i++) + for (unsigned int i = 0; i < ohci->num_ports; i++) ohci_port_power(ohci, i, 0); } if (val & OHCI_RHS_LPSC) { - int i; - - for (i = 0; i < ohci->num_ports; i++) + for (unsigned int i = 0; i < ohci->num_ports; i++) ohci_port_power(ohci, i, 1); } diff --git a/pcsx2/USB/qemu-usb/vl.h b/pcsx2/USB/qemu-usb/vl.h index ec6b8ebd82..047adb7ecd 100644 --- a/pcsx2/USB/qemu-usb/vl.h +++ b/pcsx2/USB/qemu-usb/vl.h @@ -43,13 +43,6 @@ #define inline __inline #endif -#ifdef _WIN32 -#define PRId64 "I64d" -#define PRIx64 "I64x" -#define PRIu64 "I64u" -#define PRIo64 "I64o" -#endif - #include "qusb.h" #ifndef glue diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index b1d21d16cf..b2be86d603 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -251,11 +251,10 @@ public: void FreezeIn(pxInputStream& reader) const { return SPU2DoFreezeIn(reader); } void FreezeOut(SaveStateBase& writer) const { - int size = 0; freezeData fP = {0, NULL}; if (SPU2freeze(FREEZE_SIZE, &fP) == 0) { - size = fP.size; + const int size = fP.size; writer.PrepBlock(size); SPU2DoFreezeOut(writer.GetBlockPtr()); writer.CommitBlock(size); @@ -274,11 +273,10 @@ public: void FreezeIn(pxInputStream& reader) const { return USBDoFreezeIn(reader); } void FreezeOut(SaveStateBase& writer) const { - int size = 0; freezeData fP = {0, NULL}; if (USBfreeze(FREEZE_SIZE, &fP) == 0) { - size = fP.size; + const int size = fP.size; writer.PrepBlock(size); USBDoFreezeOut(writer.GetBlockPtr()); writer.CommitBlock(size);