diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index c9fb65e58..3357f5918 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -40,9 +40,10 @@ #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/nvr.h> +#include <86box/plat_unused.h> static void -machine_at_thor_common_init(const machine_t *model, int mr) +machine_at_thor_common_init(const machine_t *model, UNUSED(int mr)) { machine_at_common_init_ex(model, 2); diff --git a/src/machine/m_ps1_hdc.c b/src/machine/m_ps1_hdc.c index 116acbf11..f35879458 100644 --- a/src/machine/m_ps1_hdc.c +++ b/src/machine/m_ps1_hdc.c @@ -649,7 +649,7 @@ do_format(hdc_t *dev, drive_t *drive, ccb_t *ccb) fcb = (fcb_t *)dev->data; #endif dev->state = STATE_FINIT; - /*FALLTHROUGH*/ + fallthrough; case STATE_FINIT: do_fmt: @@ -745,7 +745,7 @@ hdc_callback(void *priv) switch (ccb->cmd) { case CMD_READ_VERIFY: no_data = 1; - /*FALLTHROUGH*/ + fallthrough; case CMD_READ_SECTORS: if (!drive->present) { @@ -772,7 +772,7 @@ hdc_callback(void *priv) dev->buf_len = (128 << dev->ssb.sect_size); dev->state = STATE_SEND; - /*FALLTHROUGH*/ + fallthrough; case STATE_SEND: /* Activate the status icon. */ @@ -938,7 +938,7 @@ do_send: case CMD_WRITE_VERIFY: no_data = 1; - /*FALLTHROUGH*/ + fallthrough; case CMD_WRITE_SECTORS: if (!drive->present) { @@ -965,7 +965,7 @@ do_send: dev->buf_len = (128 << dev->ssb.sect_size); dev->state = STATE_RECV; - /*FALLTHROUGH*/ + fallthrough; case STATE_RECV: /* Activate the status icon. */ diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 6cd1afde9..1d4c3303f 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1239,7 +1239,7 @@ static void * eep_init(const device_t *info) { t1keep_t *eep; - FILE *f = NULL; + FILE *fp = NULL; eep = (t1keep_t *) malloc(sizeof(t1keep_t)); memset(eep, 0x00, sizeof(t1keep_t)); @@ -1257,11 +1257,11 @@ eep_init(const device_t *info) break; } - f = nvr_fopen(eep->path, "rb"); - if (f != NULL) { - if (fread(eep->store, 1, 128, f) != 128) + fp = nvr_fopen(eep->path, "rb"); + if (fp != NULL) { + if (fread(eep->store, 1, 128, fp) != 128) fatal("eep_init(): Error reading Tandy EEPROM\n"); - (void) fclose(f); + (void) fclose(fp); } else memset(eep->store, 0x00, 128); @@ -1274,12 +1274,12 @@ static void eep_close(void *priv) { t1keep_t *eep = (t1keep_t *) priv; - FILE *f = NULL; + FILE *fp = NULL; - f = nvr_fopen(eep->path, "wb"); - if (f != NULL) { - (void) fwrite(eep->store, 128, 1, f); - (void) fclose(f); + fp = nvr_fopen(eep->path, "wb"); + if (fp != NULL) { + (void) fwrite(eep->store, 128, 1, fp); + (void) fclose(fp); } free(eep); diff --git a/src/machine/m_xt_philips.c b/src/machine/m_xt_philips.c index 4caff1431..1fc284a46 100644 --- a/src/machine/m_xt_philips.c +++ b/src/machine/m_xt_philips.c @@ -91,8 +91,8 @@ philips_write(uint16_t port, uint8_t val, void *priv) static uint8_t philips_read(uint16_t port, void *priv) { - philips_t *dev = (philips_t *) priv; - uint8_t ret = 0xff; + const philips_t *dev = (philips_t *) priv; + uint8_t ret = 0xff; switch (port) { /* port 0xc0 diff --git a/src/machine/m_xt_t1000.c b/src/machine/m_xt_t1000.c index 1b7cdab91..a12fa4e96 100644 --- a/src/machine/m_xt_t1000.c +++ b/src/machine/m_xt_t1000.c @@ -833,7 +833,7 @@ t1000_read_roml(uint32_t addr, void *priv) int machine_xt_t1000_init(const machine_t *model) { - FILE *f; + FILE *fp; int ret; ret = bios_load_linear("roms/machines/t1000/t1000.rom", @@ -856,15 +856,15 @@ machine_xt_t1000_init(const machine_t *model) * If the file is missing, continue to boot; the BIOS will * complain 'No ROM drive' but boot normally from floppy. */ - f = rom_fopen("roms/machines/t1000/t1000dos.rom", "rb"); - if (f != NULL) { + fp = rom_fopen("roms/machines/t1000/t1000dos.rom", "rb"); + if (fp != NULL) { t1000.romdrive = malloc(T1000_ROMSIZE); if (t1000.romdrive) { memset(t1000.romdrive, 0xff, T1000_ROMSIZE); - if (fread(t1000.romdrive, 1, T1000_ROMSIZE, f) != T1000_ROMSIZE) + if (fread(t1000.romdrive, 1, T1000_ROMSIZE, fp) != T1000_ROMSIZE) fatal("machine_xt_t1000_init(): Error reading DOS ROM data\n"); } - fclose(f); + fclose(fp); } mem_mapping_add(&t1000.rom_mapping, 0xa0000, 0x10000, t1000_read_rom, t1000_read_romw, t1000_read_roml, @@ -986,62 +986,62 @@ t1000_syskey(uint8_t andmask, uint8_t ormask, uint8_t xormask) static void t1000_configsys_load(void) { - FILE *f; + FILE *fp; int size; memset(t1000.t1000_nvram, 0x1a, sizeof(t1000.t1000_nvram)); - f = plat_fopen(nvr_path("t1000_config.nvr"), "rb"); - if (f != NULL) { + fp = plat_fopen(nvr_path("t1000_config.nvr"), "rb"); + if (fp != NULL) { size = sizeof(t1000.t1000_nvram); - if (fread(t1000.t1000_nvram, 1, size, f) != size) + if (fread(t1000.t1000_nvram, 1, size, fp) != size) fatal("t1000_configsys_load(): Error reading data\n"); - fclose(f); + fclose(fp); } } static void t1000_configsys_save(void) { - FILE *f; + FILE *fp; int size; - f = plat_fopen(nvr_path("t1000_config.nvr"), "wb"); - if (f != NULL) { + fp = plat_fopen(nvr_path("t1000_config.nvr"), "wb"); + if (fp != NULL) { size = sizeof(t1000.t1000_nvram); - if (fwrite(t1000.t1000_nvram, 1, size, f) != size) + if (fwrite(t1000.t1000_nvram, 1, size, fp) != size) fatal("t1000_configsys_save(): Error writing data\n"); - fclose(f); + fclose(fp); } } static void t1200_state_load(void) { - FILE *f; + FILE *fp; int size; memset(t1000.t1200_nvram, 0, sizeof(t1000.t1200_nvram)); - f = plat_fopen(nvr_path("t1200_state.nvr"), "rb"); - if (f != NULL) { + fp = plat_fopen(nvr_path("t1200_state.nvr"), "rb"); + if (fp != NULL) { size = sizeof(t1000.t1200_nvram); - if (fread(t1000.t1200_nvram, 1, size, f) != size) + if (fread(t1000.t1200_nvram, 1, size, fp) != size) fatal("t1200_state_load(): Error reading data\n"); - fclose(f); + fclose(fp); } } static void t1200_state_save(void) { - FILE *f; + FILE *fp; int size; - f = plat_fopen(nvr_path("t1200_state.nvr"), "wb"); - if (f != NULL) { + fp = plat_fopen(nvr_path("t1200_state.nvr"), "wb"); + if (fp != NULL) { size = sizeof(t1000.t1200_nvram); - if (fwrite(t1000.t1200_nvram, 1, size, f) != size) + if (fwrite(t1000.t1200_nvram, 1, size, fp) != size) fatal("t1200_state_save(): Error writing data\n"); - fclose(f); + fclose(fp); } } @@ -1049,13 +1049,13 @@ t1200_state_save(void) static void t1000_emsboard_load(void) { - FILE *f; + FILE *fp; if (mem_size > 512) { - f = plat_fopen(nvr_path("t1000_ems.nvr"), "rb"); - if (f != NULL) { - (void) !fread(&ram[512 * 1024], 1024, (mem_size - 512), f); - fclose(f); + fp = plat_fopen(nvr_path("t1000_ems.nvr"), "rb"); + if (fp != NULL) { + (void) !fread(&ram[512 * 1024], 1024, (mem_size - 512), fp); + fclose(fp); } } } @@ -1063,13 +1063,13 @@ t1000_emsboard_load(void) static void t1000_emsboard_save(void) { - FILE *f; + FILE *fp; if (mem_size > 512) { - f = plat_fopen(nvr_path("t1000_ems.nvr"), "wb"); - if (f != NULL) { - fwrite(&ram[512 * 1024], 1024, (mem_size - 512), f); - fclose(f); + fp = plat_fopen(nvr_path("t1000_ems.nvr"), "wb"); + if (fp != NULL) { + fwrite(&ram[512 * 1024], 1024, (mem_size - 512), fp); + fclose(fp); } } } diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index 5525b36ce..0e0f9b9b0 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -56,7 +56,8 @@ typedef struct { static uint8_t zenith_scratchpad_read(uint32_t addr, void *priv) { - zenith_t *dev = (zenith_t *) priv; + const zenith_t *dev = (zenith_t *) priv; + return dev->scratchpad_ram[addr & 0x3fff]; } diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 7a0b3efdb..5ce4b0795 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -12981,16 +12981,16 @@ machine_count(void) return ((sizeof(machines) / sizeof(machine_t)) - 1); } -char * +const char * machine_getname(void) { - return ((char *) machines[machine].name); + return (machines[machine].name); } -char * +const char * machine_getname_ex(int m) { - return ((char *) machines[m].name); + return (machines[m].name); } const device_t * @@ -13056,16 +13056,16 @@ machine_get_net_device(int m) return (NULL); } -char * +const char * machine_get_internal_name(void) { - return ((char *) machines[machine].internal_name); + return (machines[machine].internal_name); } -char * +const char * machine_get_internal_name_ex(int m) { - return ((char *) machines[m].internal_name); + return (machines[m].internal_name); } int @@ -13121,12 +13121,12 @@ machine_get_type(int m) } int -machine_get_machine_from_internal_name(char *s) +machine_get_machine_from_internal_name(const char *s) { int c = 0; while (machines[c].init != NULL) { - if (!strcmp(machines[c].internal_name, (const char *) s)) + if (!strcmp(machines[c].internal_name, s)) return c; c++; }