USB: Cleanup more variable scope warnings.

Codacy.
Looks like I missed some.
This commit is contained in:
lightningterror 2022-06-26 18:06:44 +02:00
parent 15d8b891d6
commit 3dbaf96a9a
4 changed files with 8 additions and 10 deletions

View File

@ -114,11 +114,10 @@ int INIReadLine(ACTUALHANDLE infile, char *buffer) {
int INIFindSection(ACTUALHANDLE infile, const char *section) {
int charcount = 0;
int retflag = 0;
int retval;
char scanbuffer[INIMAXLEN+1];
while(retflag == 0) {
retval = INIReadLine(infile, scanbuffer);
const int retval = INIReadLine(infile, scanbuffer);
if(retval == 0) return(-1); // EOF? Stop here.
if(scanbuffer[0] == '[') {

View File

@ -506,14 +506,13 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
int pid;
int ret;
int i;
USBDevice* dev;
USBEndpoint* ep;
struct ohci_iso_td iso_td;
uint32_t addr;
uint16_t starting_frame;
int16_t relative_frame_number;
int frame_count;
uint32_t start_offset, next_offset, end_offset = 0;
uint32_t start_offset, next_offset;
uint32_t start_addr, end_addr;
addr = ed->head & OHCI_DPTR_MASK;
@ -635,7 +634,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
if (relative_frame_number < frame_count)
{
end_offset = next_offset - 1;
const uint32_t end_offset = next_offset - 1;
if ((end_offset & 0x1000) == 0)
{
end_addr = (iso_td.bp & OHCI_PAGE_MASK) |
@ -684,9 +683,9 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
if (!completion)
{
bool int_req = relative_frame_number == frame_count &&
const bool int_req = relative_frame_number == frame_count &&
OHCI_BM(iso_td.flags, TD_DI) == 0;
dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA));
USBDevice* dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA));
if (dev == NULL)
{
//trace_usb_ohci_td_dev_error();

View File

@ -323,7 +323,6 @@ namespace usb_eyetoy
{
EYETOYState* s = (EYETOYState*)dev;
static const int max_ep_size = 960; // 961
uint8_t data[max_ep_size];
uint8_t devep = p->ep->nr;
if (!s->hw_camera_running)
@ -338,6 +337,7 @@ namespace usb_eyetoy
case USB_TOKEN_IN:
if (devep == 1)
{
uint8_t data[max_ep_size];
memset(data, 0x00, sizeof(data));
if (s->frame_step == 0)

View File

@ -100,14 +100,12 @@ namespace usb_pad
if (!mFFdev)
return;
static int warned = 0;
DevCon.WriteLn("FFB %02X, %02X, %02X, %02X : %02X, %02X, %02X, %02X",
ffdata->cmdslot, ffdata->type, ffdata->u.params[0], ffdata->u.params[1],
ffdata->u.params[2], ffdata->u.params[3], ffdata->u.params[4], ffdata->padd0);
if (ffdata->cmdslot != CMD_EXTENDED_CMD)
{
int caps = 0;
uint8_t slots = (ffdata->cmdslot & 0xF0) >> 4;
uint8_t cmd = ffdata->cmdslot & 0x0F;
@ -132,6 +130,8 @@ namespace usb_pad
}
}
static int warned = 0;
int caps = 0;
switch (ffdata->type)
{
case FTYPE_CONSTANT: