Code lower scope, remove unused vars, optimize reference exception and etc

This commit is contained in:
lainon 2022-09-21 15:40:07 +03:00
parent 0e645e5320
commit de38447d8a
11 changed files with 13 additions and 25 deletions

View 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;

View 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

View 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)

View 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;

View 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;

View 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);

View 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)

View 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;

View 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);
}

View 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);
}

View 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) { // ?
;