From: lainon Date: Wed, 21 Sep 2022 12:40:07 +0000 (+0300) Subject: Code lower scope, remove unused vars, optimize reference exception and etc X-Git-Tag: 41000~143^2~1 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=de38447d8ac7c561ec737ae4d1a6ac0237c4e90a;p=francis%2Fwinuae.git Code lower scope, remove unused vars, optimize reference exception and etc --- diff --git a/cputest/main.c b/cputest/main.c index 9bf1ba64..dfab4727 100644 --- a/cputest/main.c +++ b/cputest/main.c @@ -3512,7 +3512,6 @@ static uae_u32 read_u32(uae_u8 *headerfile, int *poffset) static int test_mnemo(const char *opcode) { int size; - uae_u8 data[4] = { 0 }; uae_u32 v; char tfname[256]; int filecnt = 0; diff --git a/include/mmu_common.h b/include/mmu_common.h index dbe21ff7..1fed7055 100644 --- a/include/mmu_common.h +++ b/include/mmu_common.h @@ -17,7 +17,7 @@ struct m68k_exception { #define SAVE_EXCEPTION #define RESTORE_EXCEPTION #define TRY(var) try -#define CATCH(var) catch([[maybe_unused]] m68k_exception var) +#define CATCH(var) catch([[maybe_unused]] m68k_exception &var) #define THROW(n) throw m68k_exception(n) #define THROW_AGAIN(var) throw #define ENDTRY diff --git a/mame/a2410.cpp b/mame/a2410.cpp index 11cf005a..161e7e6d 100644 --- a/mame/a2410.cpp +++ b/mame/a2410.cpp @@ -880,8 +880,8 @@ static void tms_hsync_handler2(struct a2410_struct *data) bool overlay0color = !(data->a2410_palette_control[6 - 4] & 0x40); uae_u16 bitmap_mask = data->a2410_palette_control[4 - 4]; - uae_u8 overlay_mask[2] = { data->a2410_overlay_mask[0], data->a2410_overlay_mask[1] }; if (data->a2410_overlay_blink_cnt >= data->a2410_overlay_blink_rate_on) { + uae_u8 overlay_mask[2] = { data->a2410_overlay_mask[0], data->a2410_overlay_mask[1] }; if (data->a2410_palette_control[6 - 4] & 4) overlay_mask[0] = 0; if (data->a2410_palette_control[6 - 4] & 8) diff --git a/od-win32/blkdev_win32_spti.cpp b/od-win32/blkdev_win32_spti.cpp index bf5ebaa1..ef4f6029 100644 --- a/od-win32/blkdev_win32_spti.cpp +++ b/od-win32/blkdev_win32_spti.cpp @@ -532,7 +532,6 @@ static void checkcapabilities (struct dev_info_spti *di) static int inquiry (struct dev_info_spti *di, int unitnum, uae_u8 *inquirydata) { uae_u8 cmd[6] = { 0x12,0,0,0,36,0 }; /* INQUIRY */ - uae_u8 out[INQUIRY_SIZE] = { 0 }; int outlen = sizeof (out); uae_u8 *p = execscsicmd_in_internal (di, unitnum, cmd, sizeof (cmd), &outlen, 0); int inqlen = 0; diff --git a/od-win32/d3dx.h b/od-win32/d3dx.h index 7e4784cc..cdcdc773 100644 --- a/od-win32/d3dx.h +++ b/od-win32/d3dx.h @@ -12,9 +12,7 @@ class D3DXVECTOR2 { public: float x, y; - D3DXVECTOR2() - { - } + D3DXVECTOR2() = default; D3DXVECTOR2(float x, float y) { this->x = x; @@ -26,9 +24,7 @@ class D3DXVECTOR3 { public: float x, y, z; - D3DXVECTOR3() - { - } + D3DXVECTOR3() = default; D3DXVECTOR3(float x, float y, float z) { this->x = x; @@ -45,9 +41,7 @@ class D3DXVECTOR4 { public: float x, y, z, w; - D3DXVECTOR4() - { - } + D3DXVECTOR4() = default; D3DXVECTOR4(float x, float y, float z, float w) { this->x = x; diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index ab5b0ab3..34719800 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -3543,7 +3543,7 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t write_log(_T("IDXGIOutput QueryInterface %08x\n"), result); return 0; } - adapterOutputx = adapterOutput1; + adapterOutputx = std::move(adapterOutput1); } else { DXGI_OUTPUT_DESC1 desc1; result = adapterOutput6->GetDesc1(&desc1); diff --git a/pcem/mouse_ps2.cpp b/pcem/mouse_ps2.cpp index 15fd484c..e3108ab1 100644 --- a/pcem/mouse_ps2.cpp +++ b/pcem/mouse_ps2.cpp @@ -176,7 +176,6 @@ void mouse_ps2_write(uint8_t val, void *p) void mouse_ps2_poll(int x, int y, int z, int b, void *p) { mouse_ps2_t *mouse = (mouse_ps2_t *)p; - uint8_t packet[3] = {0x08, 0, 0}; if (!x && !y && !z && b == mouse->b) return; @@ -190,6 +189,7 @@ void mouse_ps2_poll(int x, int y, int z, int b, void *p) if (mouse->mode == MOUSE_STREAM && (mouse->flags & MOUSE_ENABLE) && ((mouse_queue_end - mouse_queue_start) & 0xf) < 13) { + uint8_t packet[3] = { 0x08, 0, 0 }; mouse->b = b; // pclog("Send packet : %i %i\n", ps2_x, ps2_y); if (mouse->x > 255) diff --git a/prowizard/rippers/skizzo.c b/prowizard/rippers/skizzo.c index d9396cf9..9e45d4da 100644 --- a/prowizard/rippers/skizzo.c +++ b/prowizard/rippers/skizzo.c @@ -60,7 +60,6 @@ void Depack_Skizzo ( void ) { Uchar *Whatever; long i=0,k=0; - Ushort Pattern_Addresses_Table[128]; short BODYaddy, SAMPaddy, nbr_sample, siz_patlist, nbr_patstored; long Total_Sample_Size=0; long Where = PW_Start_Address; diff --git a/qemuvga/vga.cpp b/qemuvga/vga.cpp index 6dbae9b7..bbfa55b9 100644 --- a/qemuvga/vga.cpp +++ b/qemuvga/vga.cpp @@ -2572,8 +2572,6 @@ void vga_init(VGACommonState *s, MemoryRegion *address_space, { MemoryRegion *vga_io_memory; const MemoryRegionPortio *vga_ports, *vbe_ports; - PortioList *vga_port_list = g_new(PortioList, 1); - PortioList *vbe_port_list = g_new(PortioList, 1); // qemu_register_reset(vga_reset, s); @@ -2588,10 +2586,12 @@ void vga_init(VGACommonState *s, MemoryRegion *address_space, 1); memory_region_set_coalescing(vga_io_memory); if (init_vga_ports) { + PortioList* vga_port_list = g_new(PortioList, 1); portio_list_init(vga_port_list, vga_ports, s, "vga"); portio_list_add(vga_port_list, address_space_io, 0x3b0); } if (vbe_ports) { + PortioList* vbe_port_list = g_new(PortioList, 1); portio_list_init(vbe_port_list, vbe_ports, s, "vbe"); portio_list_add(vbe_port_list, address_space_io, 0x1ce); } diff --git a/savestate.cpp b/savestate.cpp index ed444e6b..eafa765c 100644 --- a/savestate.cpp +++ b/savestate.cpp @@ -379,7 +379,6 @@ TCHAR *restore_path_full_func(uae_u8 **dstp) static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, const TCHAR *name, int compress) { uae_u8 tmp[8], *dst; - uae_u8 zero[4]= { 0, 0, 0, 0 }; uae_u32 flags; size_t pos; size_t chunklen, len2; @@ -436,8 +435,10 @@ static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, const TCHAR zfile_fwrite (chunk, 1, len, f); /* alignment */ len2 = 4 - (len & 3); - if (len2) - zfile_fwrite (zero, 1, len2, f); + if (len2) { + uae_u8 zero[4] = { 0, 0, 0, 0 }; + zfile_fwrite(zero, 1, len2, f); + } write_log (_T("Chunk '%s' chunk size %u (%u)\n"), name, chunklen, len); } diff --git a/sndboard.cpp b/sndboard.cpp index 3a0c3fb1..9d19c3dd 100644 --- a/sndboard.cpp +++ b/sndboard.cpp @@ -1971,8 +1971,6 @@ static void toccata_put(struct snddev_data *data, uaecptr addr, uae_u8 v) data->fifo_write_index = 0; data->fifo_read_index = 0; data->data_in_fifo = 0; - data->snddev_status = 0; - data->snddev_irq = 0; data->fifo_half = 0; } else if (addr < 0x90 || addr >= 0xc0) { hit = false; @@ -1987,8 +1985,6 @@ static void toccata_put(struct snddev_data *data, uaecptr addr, uae_u8 v) data->fifo_write_index = 0; data->fifo_read_index = 0; data->data_in_fifo = 0; - data->snddev_status = 0; - data->snddev_irq = 0; data->fifo_half = 0; } else if ((addr & 0x00ff) == 0x19) { // ? ;