From 4df5c9e1e1cb4b8cda2f601cbc5c6edce259023d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 25 Dec 2022 15:58:11 +1000 Subject: [PATCH] USB: Warning fixes for clang-cl --- pcsx2/USB/qemu-usb/bus.cpp | 6 ++++++ pcsx2/USB/qemu-usb/core.cpp | 4 +++- pcsx2/USB/qemu-usb/hid.cpp | 5 +++++ pcsx2/USB/qemu-usb/usb-ohci.cpp | 3 +++ pcsx2/USB/usb-eyetoy/cam-windows.cpp | 9 +++++++++ pcsx2/USB/usb-eyetoy/cam-windows.h | 9 ++++----- pcsx2/USB/usb-mic/usb-headset.cpp | 23 ----------------------- pcsx2/USB/usb-pad/usb-pad.cpp | 13 ------------- pcsx2/USB/usb-printer/usb-printer.cpp | 3 ++- 9 files changed, 32 insertions(+), 43 deletions(-) diff --git a/pcsx2/USB/qemu-usb/bus.cpp b/pcsx2/USB/qemu-usb/bus.cpp index 036e6e80cd..8817cc4fe8 100644 --- a/pcsx2/USB/qemu-usb/bus.cpp +++ b/pcsx2/USB/qemu-usb/bus.cpp @@ -19,6 +19,8 @@ #define USB_DEVICE_GET_CLASS(p) (&p->klass) +#if 0 +// Unused static void usb_device_realize(USBDevice* dev /*, Error **errp*/) { USBDeviceClass* klass = USB_DEVICE_GET_CLASS(dev); @@ -28,6 +30,7 @@ static void usb_device_realize(USBDevice* dev /*, Error **errp*/) klass->realize(dev /*, errp*/); } } +#endif USBDevice* usb_device_find_device(USBDevice* dev, uint8_t addr) { @@ -39,6 +42,8 @@ USBDevice* usb_device_find_device(USBDevice* dev, uint8_t addr) return NULL; } +#if 0 +// Unused static void usb_device_unrealize(USBDevice* dev /*, Error **errp*/) { USBDeviceClass* klass = USB_DEVICE_GET_CLASS(dev); @@ -48,6 +53,7 @@ static void usb_device_unrealize(USBDevice* dev /*, Error **errp*/) klass->unrealize(dev /*, errp*/); } } +#endif void usb_device_cancel_packet(USBDevice* dev, USBPacket* p) { diff --git a/pcsx2/USB/qemu-usb/core.cpp b/pcsx2/USB/qemu-usb/core.cpp index c33e291340..132b951140 100644 --- a/pcsx2/USB/qemu-usb/core.cpp +++ b/pcsx2/USB/qemu-usb/core.cpp @@ -562,7 +562,8 @@ void usb_cancel_packet(USBPacket* p) } } - +#if 0 +// Unused static const char* usb_packet_state_name(USBPacketState state) { static const char* name[] = { @@ -579,6 +580,7 @@ static const char* usb_packet_state_name(USBPacketState state) } return "INVALID"; } +#endif void usb_packet_check_state(USBPacket* p, USBPacketState expected) { diff --git a/pcsx2/USB/qemu-usb/hid.cpp b/pcsx2/USB/qemu-usb/hid.cpp index b330698c1e..2b956da0c4 100644 --- a/pcsx2/USB/qemu-usb/hid.cpp +++ b/pcsx2/USB/qemu-usb/hid.cpp @@ -298,6 +298,8 @@ bool hid_has_events(HIDState* hs) return hs->n > 0 || hs->idle_pending; } +#if 0 +// Unused static void hid_idle_timer(void* opaque) { HIDState* hs = (HIDState*)opaque; @@ -305,6 +307,7 @@ static void hid_idle_timer(void* opaque) hs->idle_pending = true; hs->event(hs); } +#endif static void hid_del_idle_timer(HIDState* hs) { @@ -760,6 +763,7 @@ int hid_keyboard_poll(HIDState* hs, uint8_t* buf, int len) int hid_keyboard_write(HIDState* hs, uint8_t* buf, int len) { +#if 0 if (len > 0) { int ledstate = 0; @@ -783,6 +787,7 @@ int hid_keyboard_write(HIDState* hs, uint8_t* buf, int len) } //kbd_put_ledstate(ledstate); } +#endif return 0; } diff --git a/pcsx2/USB/qemu-usb/usb-ohci.cpp b/pcsx2/USB/qemu-usb/usb-ohci.cpp index 55982fd6a7..4be7c5c1a0 100644 --- a/pcsx2/USB/qemu-usb/usb-ohci.cpp +++ b/pcsx2/USB/qemu-usb/usb-ohci.cpp @@ -110,7 +110,9 @@ static void ohci_die(OHCIState* ohci) // PCI_STATUS_DETECTED_PARITY); } +#if 0 /* Attach or detach a device on a root hub port. */ +// Unused static void ohci_attach2(USBPort* port1, USBDevice* dev) { OHCIState* s = (OHCIState*)port1->opaque; @@ -162,6 +164,7 @@ static void ohci_attach2(USBPort* port1, USBDevice* dev) if (old_state != port->ctrl) ohci_set_interrupt(s, OHCI_INTR_RHSC); } +#endif /* Attach or detach a device on a root hub port. */ static void ohci_attach(USBPort* port1) diff --git a/pcsx2/USB/usb-eyetoy/cam-windows.cpp b/pcsx2/USB/usb-eyetoy/cam-windows.cpp index c52d5316f6..06dcb2440f 100644 --- a/pcsx2/USB/usb-eyetoy/cam-windows.cpp +++ b/pcsx2/USB/usb-eyetoy/cam-windows.cpp @@ -24,6 +24,11 @@ #include "jo_mpeg.h" #include "USB/USB.h" +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmicrosoft-goto" +#endif + namespace usb_eyetoy { namespace windows_api @@ -598,3 +603,7 @@ namespace usb_eyetoy return windows_api::getDevList(); } } // namespace usb_eyetoy + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/pcsx2/USB/usb-eyetoy/cam-windows.h b/pcsx2/USB/usb-eyetoy/cam-windows.h index 2ac49c4725..399cc78d07 100644 --- a/pcsx2/USB/usb-eyetoy/cam-windows.h +++ b/pcsx2/USB/usb-eyetoy/cam-windows.h @@ -14,15 +14,14 @@ */ #include "videodev.h" +#include "common/RedtapeWindows.h" +#include "common/RedtapeWilCom.h" + +#include #include #pragma comment(lib, "strmiids") -#include -#include - -#include - extern "C" { extern GUID IID_ISampleGrabberCB; extern GUID CLSID_SampleGrabber; diff --git a/pcsx2/USB/usb-mic/usb-headset.cpp b/pcsx2/USB/usb-mic/usb-headset.cpp index e24e23798f..e79bb917a6 100644 --- a/pcsx2/USB/usb-mic/usb-headset.cpp +++ b/pcsx2/USB/usb-mic/usb-headset.cpp @@ -886,29 +886,6 @@ namespace usb_mic delete s; } - static int headset_handle_open(USBDevice* dev) - { - HeadsetState* s = USB_CONTAINER_OF(dev, HeadsetState, dev); - if (s) - { - - } - return 0; - } - - static void headset_handle_close(USBDevice* dev) - { - HeadsetState* s = USB_CONTAINER_OF(dev, HeadsetState, dev); - if (s) - { - if (s->audsrc) - s->audsrc->Stop(); - - if (s->audsink) - s->audsink->Stop(); - } - } - USBDevice* HeadsetDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const { HeadsetState* s = new HeadsetState(); diff --git a/pcsx2/USB/usb-pad/usb-pad.cpp b/pcsx2/USB/usb-pad/usb-pad.cpp index 3751a4da9a..15b3b89c72 100644 --- a/pcsx2/USB/usb-pad/usb-pad.cpp +++ b/pcsx2/USB/usb-pad/usb-pad.cpp @@ -616,19 +616,6 @@ namespace usb_pad #endif } - static u32 gametrak_compute_key(u32* key) - { - u32 ret = 0; - ret = *key << 2 & 0xFC0000; - ret |= *key << 17 & 0x020000; - ret ^= *key << 16 & 0xFE0000; - ret |= *key & 0x010000; - ret |= *key >> 9 & 0x007F7F; - ret |= *key << 7 & 0x008080; - *key = ret; - return ret >> 16; - } - static void pad_handle_data(USBDevice* dev, USBPacket* p) { PadState* s = USB_CONTAINER_OF(dev, PadState, dev); diff --git a/pcsx2/USB/usb-printer/usb-printer.cpp b/pcsx2/USB/usb-printer/usb-printer.cpp index 1b37ef6a2b..e4160eec5c 100644 --- a/pcsx2/USB/usb-printer/usb-printer.cpp +++ b/pcsx2/USB/usb-printer/usb-printer.cpp @@ -20,6 +20,7 @@ #include "USB/USB.h" #include "common/FileSystem.h" #include "common/Path.h" +#include "common/StringUtil.h" #include "Config.h" #include "fmt/format.h" #include "StateWrapper.h" @@ -73,7 +74,7 @@ namespace usb_printer switch (request) { case ClassInterfaceRequest | GET_DEVICE_ID: - ret = 2 + sprintf((char*)data + 2, sPrinters[s->selected_printer].device_id); + ret = 2 + StringUtil::Strlcpy((char*)data + 2, sPrinters[s->selected_printer].device_id, length - 2); data[0] = ret >> 8; data[1] = ret & 0xff; p->actual_length = ret;