From 41bc4832f3808fcc0bb13803d8d9311c2c9b9cc2 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Sun, 26 Jun 2022 19:23:49 +0200 Subject: [PATCH] USB: More variable scope warnings. Looks like there are still more, let's see if it complains more about this file. Codacy. --- pcsx2/USB/qemu-usb/usb-ohci.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pcsx2/USB/qemu-usb/usb-ohci.cpp b/pcsx2/USB/qemu-usb/usb-ohci.cpp index 672b0a35d6..65eccd76ce 100644 --- a/pcsx2/USB/qemu-usb/usb-ohci.cpp +++ b/pcsx2/USB/qemu-usb/usb-ohci.cpp @@ -506,13 +506,10 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, int pid; int ret; int i; - 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; + uint32_t next_offset; uint32_t start_addr, end_addr; addr = ed->head & OHCI_DPTR_MASK; @@ -524,8 +521,8 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, return 1; } - starting_frame = OHCI_BM(iso_td.flags, TD_SF); - frame_count = OHCI_BM(iso_td.flags, TD_FC); + const uint16_t starting_frame = OHCI_BM(iso_td.flags, TD_SF); + const int frame_count = OHCI_BM(iso_td.flags, TD_FC); relative_frame_number = USUB(ohci->frame_number, starting_frame); /*trace_usb_ohci_iso_td_head( @@ -597,7 +594,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, return 1; } - start_offset = iso_td.offset[relative_frame_number]; + const uint32_t start_offset = iso_td.offset[relative_frame_number]; if (relative_frame_number < frame_count) { next_offset = iso_td.offset[relative_frame_number + 1]; @@ -691,7 +688,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, //trace_usb_ohci_td_dev_error(); return 1; } - ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN)); + USBEndpoint* ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN)); usb_packet_setup(&ohci->usb_packet, pid, ep, 0, addr, false, int_req); usb_packet_addbuf(&ohci->usb_packet, ohci->usb_buf, len); usb_handle_packet(dev, &ohci->usb_packet);