USB: warnings fixups

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-10 17:21:43 +01:00 committed by refractionpcsx2
parent 6bdee6a5bd
commit b1d1783da4
3 changed files with 10 additions and 25 deletions

View File

@ -237,36 +237,34 @@ static void ohci_wakeup(USBPort* port1)
static USBDevice* ohci_find_device(OHCIState* ohci, uint8_t addr) static USBDevice* ohci_find_device(OHCIState* ohci, uint8_t addr)
{ {
USBDevice* dev; 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) if ((ohci->rhport[i].ctrl & OHCI_PORT_PES) == 0)
{ {
continue; continue;
} }
dev = usb_find_device(&ohci->rhport[i].port, addr); dev = usb_find_device(&ohci->rhport[i].port, addr);
if (dev != NULL) if (dev != nullptr)
{ {
return dev; return dev;
} }
} }
return NULL; return nullptr;
} }
//TODO no devices using this yet //TODO no devices using this yet
static void ohci_stop_endpoints(OHCIState* ohci) static void ohci_stop_endpoints(OHCIState* ohci)
{ {
USBDevice* dev; 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; dev = ohci->rhport[i].port.dev;
if (dev && dev->attached) if (dev && dev->attached)
{ {
usb_device_ep_stopped(dev, &dev->ep_ctl); 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_in[j]);
usb_device_ep_stopped(dev, &dev->ep_out[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); // str, len, ret);
/* Writeback */ /* 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 */ /* IN transfer succeeded */
if (ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, ret, 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) if (val & OHCI_RHS_LPS)
{ {
int i; for (unsigned int i = 0; i < ohci->num_ports; i++)
for (i = 0; i < ohci->num_ports; i++)
ohci_port_power(ohci, i, 0); ohci_port_power(ohci, i, 0);
} }
if (val & OHCI_RHS_LPSC) if (val & OHCI_RHS_LPSC)
{ {
int i; for (unsigned int i = 0; i < ohci->num_ports; i++)
for (i = 0; i < ohci->num_ports; i++)
ohci_port_power(ohci, i, 1); ohci_port_power(ohci, i, 1);
} }

View File

@ -43,13 +43,6 @@
#define inline __inline #define inline __inline
#endif #endif
#ifdef _WIN32
#define PRId64 "I64d"
#define PRIx64 "I64x"
#define PRIu64 "I64u"
#define PRIo64 "I64o"
#endif
#include "qusb.h" #include "qusb.h"
#ifndef glue #ifndef glue

View File

@ -251,11 +251,10 @@ public:
void FreezeIn(pxInputStream& reader) const { return SPU2DoFreezeIn(reader); } void FreezeIn(pxInputStream& reader) const { return SPU2DoFreezeIn(reader); }
void FreezeOut(SaveStateBase& writer) const void FreezeOut(SaveStateBase& writer) const
{ {
int size = 0;
freezeData fP = {0, NULL}; freezeData fP = {0, NULL};
if (SPU2freeze(FREEZE_SIZE, &fP) == 0) if (SPU2freeze(FREEZE_SIZE, &fP) == 0)
{ {
size = fP.size; const int size = fP.size;
writer.PrepBlock(size); writer.PrepBlock(size);
SPU2DoFreezeOut(writer.GetBlockPtr()); SPU2DoFreezeOut(writer.GetBlockPtr());
writer.CommitBlock(size); writer.CommitBlock(size);
@ -274,11 +273,10 @@ public:
void FreezeIn(pxInputStream& reader) const { return USBDoFreezeIn(reader); } void FreezeIn(pxInputStream& reader) const { return USBDoFreezeIn(reader); }
void FreezeOut(SaveStateBase& writer) const void FreezeOut(SaveStateBase& writer) const
{ {
int size = 0;
freezeData fP = {0, NULL}; freezeData fP = {0, NULL};
if (USBfreeze(FREEZE_SIZE, &fP) == 0) if (USBfreeze(FREEZE_SIZE, &fP) == 0)
{ {
size = fP.size; const int size = fP.size;
writer.PrepBlock(size); writer.PrepBlock(size);
USBDoFreezeOut(writer.GetBlockPtr()); USBDoFreezeOut(writer.GetBlockPtr());
writer.CommitBlock(size); writer.CommitBlock(size);