USB: Warning fixes for clang-cl

This commit is contained in:
Stenzek 2022-12-25 15:58:11 +10:00 committed by refractionpcsx2
parent a2abe49d3f
commit 4df5c9e1e1
9 changed files with 32 additions and 43 deletions

View File

@ -19,6 +19,8 @@
#define USB_DEVICE_GET_CLASS(p) (&p->klass) #define USB_DEVICE_GET_CLASS(p) (&p->klass)
#if 0
// Unused
static void usb_device_realize(USBDevice* dev /*, Error **errp*/) static void usb_device_realize(USBDevice* dev /*, Error **errp*/)
{ {
USBDeviceClass* klass = USB_DEVICE_GET_CLASS(dev); USBDeviceClass* klass = USB_DEVICE_GET_CLASS(dev);
@ -28,6 +30,7 @@ static void usb_device_realize(USBDevice* dev /*, Error **errp*/)
klass->realize(dev /*, errp*/); klass->realize(dev /*, errp*/);
} }
} }
#endif
USBDevice* usb_device_find_device(USBDevice* dev, uint8_t addr) 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; return NULL;
} }
#if 0
// Unused
static void usb_device_unrealize(USBDevice* dev /*, Error **errp*/) static void usb_device_unrealize(USBDevice* dev /*, Error **errp*/)
{ {
USBDeviceClass* klass = USB_DEVICE_GET_CLASS(dev); USBDeviceClass* klass = USB_DEVICE_GET_CLASS(dev);
@ -48,6 +53,7 @@ static void usb_device_unrealize(USBDevice* dev /*, Error **errp*/)
klass->unrealize(dev /*, errp*/); klass->unrealize(dev /*, errp*/);
} }
} }
#endif
void usb_device_cancel_packet(USBDevice* dev, USBPacket* p) void usb_device_cancel_packet(USBDevice* dev, USBPacket* p)
{ {

View File

@ -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* usb_packet_state_name(USBPacketState state)
{ {
static const char* name[] = { static const char* name[] = {
@ -579,6 +580,7 @@ static const char* usb_packet_state_name(USBPacketState state)
} }
return "INVALID"; return "INVALID";
} }
#endif
void usb_packet_check_state(USBPacket* p, USBPacketState expected) void usb_packet_check_state(USBPacket* p, USBPacketState expected)
{ {

View File

@ -298,6 +298,8 @@ bool hid_has_events(HIDState* hs)
return hs->n > 0 || hs->idle_pending; return hs->n > 0 || hs->idle_pending;
} }
#if 0
// Unused
static void hid_idle_timer(void* opaque) static void hid_idle_timer(void* opaque)
{ {
HIDState* hs = (HIDState*)opaque; HIDState* hs = (HIDState*)opaque;
@ -305,6 +307,7 @@ static void hid_idle_timer(void* opaque)
hs->idle_pending = true; hs->idle_pending = true;
hs->event(hs); hs->event(hs);
} }
#endif
static void hid_del_idle_timer(HIDState* hs) 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) int hid_keyboard_write(HIDState* hs, uint8_t* buf, int len)
{ {
#if 0
if (len > 0) if (len > 0)
{ {
int ledstate = 0; int ledstate = 0;
@ -783,6 +787,7 @@ int hid_keyboard_write(HIDState* hs, uint8_t* buf, int len)
} }
//kbd_put_ledstate(ledstate); //kbd_put_ledstate(ledstate);
} }
#endif
return 0; return 0;
} }

View File

@ -110,7 +110,9 @@ static void ohci_die(OHCIState* ohci)
// PCI_STATUS_DETECTED_PARITY); // PCI_STATUS_DETECTED_PARITY);
} }
#if 0
/* Attach or detach a device on a root hub port. */ /* Attach or detach a device on a root hub port. */
// Unused
static void ohci_attach2(USBPort* port1, USBDevice* dev) static void ohci_attach2(USBPort* port1, USBDevice* dev)
{ {
OHCIState* s = (OHCIState*)port1->opaque; OHCIState* s = (OHCIState*)port1->opaque;
@ -162,6 +164,7 @@ static void ohci_attach2(USBPort* port1, USBDevice* dev)
if (old_state != port->ctrl) if (old_state != port->ctrl)
ohci_set_interrupt(s, OHCI_INTR_RHSC); ohci_set_interrupt(s, OHCI_INTR_RHSC);
} }
#endif
/* Attach or detach a device on a root hub port. */ /* Attach or detach a device on a root hub port. */
static void ohci_attach(USBPort* port1) static void ohci_attach(USBPort* port1)

View File

@ -24,6 +24,11 @@
#include "jo_mpeg.h" #include "jo_mpeg.h"
#include "USB/USB.h" #include "USB/USB.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmicrosoft-goto"
#endif
namespace usb_eyetoy namespace usb_eyetoy
{ {
namespace windows_api namespace windows_api
@ -598,3 +603,7 @@ namespace usb_eyetoy
return windows_api::getDevList(); return windows_api::getDevList();
} }
} // namespace usb_eyetoy } // namespace usb_eyetoy
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -14,15 +14,14 @@
*/ */
#include "videodev.h" #include "videodev.h"
#include "common/RedtapeWindows.h"
#include "common/RedtapeWilCom.h"
#include <dshow.h>
#include <mutex> #include <mutex>
#pragma comment(lib, "strmiids") #pragma comment(lib, "strmiids")
#include <windows.h>
#include <dshow.h>
#include <wil/com.h>
extern "C" { extern "C" {
extern GUID IID_ISampleGrabberCB; extern GUID IID_ISampleGrabberCB;
extern GUID CLSID_SampleGrabber; extern GUID CLSID_SampleGrabber;

View File

@ -886,29 +886,6 @@ namespace usb_mic
delete s; 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 USBDevice* HeadsetDevice::CreateDevice(SettingsInterface& si, u32 port, u32 subtype) const
{ {
HeadsetState* s = new HeadsetState(); HeadsetState* s = new HeadsetState();

View File

@ -616,19 +616,6 @@ namespace usb_pad
#endif #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) static void pad_handle_data(USBDevice* dev, USBPacket* p)
{ {
PadState* s = USB_CONTAINER_OF(dev, PadState, dev); PadState* s = USB_CONTAINER_OF(dev, PadState, dev);

View File

@ -20,6 +20,7 @@
#include "USB/USB.h" #include "USB/USB.h"
#include "common/FileSystem.h" #include "common/FileSystem.h"
#include "common/Path.h" #include "common/Path.h"
#include "common/StringUtil.h"
#include "Config.h" #include "Config.h"
#include "fmt/format.h" #include "fmt/format.h"
#include "StateWrapper.h" #include "StateWrapper.h"
@ -73,7 +74,7 @@ namespace usb_printer
switch (request) switch (request)
{ {
case ClassInterfaceRequest | GET_DEVICE_ID: 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[0] = ret >> 8;
data[1] = ret & 0xff; data[1] = ret & 0xff;
p->actual_length = ret; p->actual_length = ret;