]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Code lower scope, remove unused vars, optimize reference exception and etc
authorlainon <GermanAizek@yandex.ru>
Wed, 21 Sep 2022 12:40:07 +0000 (15:40 +0300)
committerlainon <GermanAizek@yandex.ru>
Wed, 21 Sep 2022 12:40:07 +0000 (15:40 +0300)
cputest/main.c
include/mmu_common.h
mame/a2410.cpp
od-win32/blkdev_win32_spti.cpp
od-win32/d3dx.h
od-win32/direct3d11.cpp
pcem/mouse_ps2.cpp
prowizard/rippers/skizzo.c
qemuvga/vga.cpp
savestate.cpp
sndboard.cpp

index 9bf1ba64219d4e786844832cbbe0404653d17a39..dfab4727f93e4d060eefe045b3a1de1b8c3b73ac 100644 (file)
@@ -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;
index dbe21ff758eaed9f709b61726dc5afcbddec55e0..1fed705543aa87584b7c73f75420d34b20447838 100644 (file)
@@ -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
index 11cf005a1da71b51d77fd3f1e290c47569efed79..161e7e6d2328ccd3d6b372f10873e899a8e8bd62 100644 (file)
@@ -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)
index bf5ebaa16e31b09e7e749ac09cc466680828264e..ef4f6029e6c1a0f8129e610d500ef68439d49413 100644 (file)
@@ -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;
index 7e4784ccc147863be8054cfe969ef7fb2c9b9c9c..cdcdc7734f1cf42d1ae94d49e411e9547cf58b4a 100644 (file)
@@ -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;
index ab5b0ab325fe3a9f7d8bd1682c11401b0883b7f3..3471980051d9056574a6edf972188becda2cd324 100644 (file)
@@ -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);
index 15fd484c2814a9c341c0fb2fa72c0c649994b069..e3108ab1aad6b72fb87e6c9c09ef42b7a9277997 100644 (file)
@@ -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)
index d9396cf96aff863f02f22d3ccae3345806afd09b..9e45d4da515b15e45f0a561a92f6e54a709dd313 100644 (file)
@@ -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;
index 6dbae9b75eb56cb9460e751061aff1f1f5db85d0..bbfa55b903f5098ff1aaefda675bebfa0b8bcb10 100644 (file)
@@ -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);
     }
index ed444e6b4b22040a25aedaacf73c58e40c0656fa..eafa765caba73a1daccbbcbc2fd31aa756fbc288 100644 (file)
@@ -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);
 }
index 3a0c3fb1ee8e563e309357953b53cfd87d3cb352..9d19c3dd36cebb4796f4ad4effbe691d2e041e60 100644 (file)
@@ -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) { // ?
                                ;