From eb539cce9d58a349e0dffff237dc96bb926ca06f Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 12 Mar 2009 07:43:03 +0000 Subject: [PATCH] Many casts added to the core files, and various other tweaks to make them compile as either C or C++. --- src/build/file2str.c | 2 +- src/build/png2bdc.c | 6 +- src/build/verinfo.c | 2 +- src/emu/audit.c | 4 +- src/emu/cheat.c | 25 +++---- src/emu/clifront.c | 4 +- src/emu/config.c | 2 +- src/emu/cpu/e132xs/e132xs.c | 2 +- src/emu/cpu/m68000/m68kmake.c | 10 +-- src/emu/cpu/mcs48/mcs48.c | 2 +- src/emu/cpu/mips/mips3com.c | 2 +- src/emu/cpu/tms57002/tmsmake.c | 2 +- src/emu/cpuexec.c | 20 +++--- src/emu/debug/debugcmd.c | 4 +- src/emu/debug/debugcon.c | 2 +- src/emu/debug/debugcpu.c | 54 +++++++------- src/emu/debug/debugvw.c | 124 ++++++++++++++++----------------- src/emu/debug/express.c | 22 +++--- src/emu/debug/textbuf.c | 6 +- src/emu/debugger.c | 2 +- src/emu/devcb.c | 10 +-- src/emu/devintrf.c | 4 +- src/emu/drawgfx.c | 12 ++-- src/emu/driver.c | 4 +- src/emu/emupal.c | 26 +++---- src/emu/fileio.c | 10 +-- src/emu/hash.c | 2 +- src/emu/info.c | 2 +- src/emu/inptport.c | 32 ++++----- src/emu/inptport.h | 1 + src/emu/input.c | 28 ++++---- src/emu/input.h | 8 ++- src/emu/inputseq.c | 4 +- src/emu/machine/6522via.c | 6 +- src/emu/machine/6526cia.c | 4 +- src/emu/machine/6532riot.c | 4 +- src/emu/machine/6840ptm.c | 4 +- src/emu/machine/6850acia.c | 11 +-- src/emu/machine/68681.c | 6 +- src/emu/machine/74123.c | 6 +- src/emu/machine/8237dma.c | 6 +- src/emu/machine/8255ppi.c | 2 +- src/emu/machine/8257dma.c | 8 +-- src/emu/machine/at28c16.c | 6 +- src/emu/machine/cdp1852.c | 4 +- src/emu/machine/cdp1852.h | 2 +- src/emu/machine/cr589.c | 20 +++--- src/emu/machine/f3853.c | 4 +- src/emu/machine/generic.c | 8 +-- src/emu/machine/i2cmem.c | 4 +- src/emu/machine/idectrl.c | 18 ++--- src/emu/machine/intelfsh.c | 20 +++--- src/emu/machine/latch8.c | 6 +- src/emu/machine/latch8.h | 4 +- src/emu/machine/ldcore.c | 40 +++++------ src/emu/machine/ldcore.h | 2 +- src/emu/machine/ldpr8210.c | 8 +-- src/emu/machine/ldv1000.c | 6 +- src/emu/machine/ldvp931.c | 12 ++-- src/emu/machine/mc146818.c | 2 +- src/emu/machine/pci.c | 2 +- src/emu/machine/pic8259.c | 4 +- src/emu/machine/pit8253.c | 4 +- src/emu/machine/scsicd.c | 32 ++++----- src/emu/machine/scsidev.c | 36 +++++----- src/emu/machine/scsihd.c | 32 ++++----- src/emu/machine/smc91c9x.c | 2 +- src/emu/machine/timekpr.c | 2 +- src/emu/machine/wd33c93.c | 2 +- src/emu/machine/x2212.c | 6 +- src/emu/machine/x76f041.c | 2 +- src/emu/machine/x76f100.c | 2 +- src/emu/machine/z80ctc.c | 4 +- src/emu/machine/z80dma.c | 6 +- src/emu/machine/z80pio.c | 2 +- src/emu/machine/z80sio.c | 6 +- src/emu/mame.c | 18 ++--- src/emu/mamecore.h | 14 +++- src/emu/mconfig.c | 4 +- src/emu/memory.c | 110 ++++++++++++++--------------- src/emu/output.c | 6 +- src/emu/render.c | 20 +++--- src/emu/rendfont.c | 16 ++--- src/emu/rendlay.c | 20 +++--- src/emu/rendutil.c | 4 +- src/emu/restrack.c | 12 ++-- src/emu/romload.c | 12 ++-- src/emu/sound.c | 34 ++++----- src/emu/sound/cdp1869.c | 2 +- src/emu/sound/filter.c | 4 +- src/emu/sound/flt_rc.c | 4 +- src/emu/sound/flt_vol.c | 2 +- src/emu/sound/wavwrite.c | 6 +- src/emu/state.c | 14 ++-- src/emu/state.h | 2 +- src/emu/streams.c | 18 ++--- src/emu/tilemap.c | 36 +++++----- src/emu/timer.c | 14 ++-- src/emu/ui.c | 38 +++++----- src/emu/uigfx.c | 4 +- src/emu/uiinput.c | 2 +- src/emu/uimenu.c | 100 +++++++++++++------------- src/emu/validity.c | 8 +-- src/emu/video.c | 70 +++++++++---------- src/emu/video/mc6845.c | 18 ++--- src/emu/video/poly.c | 8 +-- src/emu/video/resnet.c | 6 +- src/emu/video/s2636.c | 2 +- src/emu/video/tms34061.c | 4 +- src/emu/video/v9938.c | 6 +- src/emu/video/vector.c | 2 +- src/emu/video/voodoo.c | 24 +++---- src/lib/util/chd.c | 6 +- src/osd/osdcomm.h | 2 +- src/osd/windows/main.c | 2 +- src/osd/windows/windows.mak | 2 +- 116 files changed, 751 insertions(+), 732 deletions(-) diff --git a/src/build/file2str.c b/src/build/file2str.c index c19ca46a513..e7a44742892 100644 --- a/src/build/file2str.c +++ b/src/build/file2str.c @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) fseek(src, 0, SEEK_SET); /* allocate memory */ - buffer = malloc(bytes + 1); + buffer = (unsigned char *)malloc(bytes + 1); if (buffer == NULL) { fprintf(stderr, "Out of memory allocating %d byte buffer\n", bytes); diff --git a/src/build/png2bdc.c b/src/build/png2bdc.c index 1ee75c4d763..c60d7182b37 100644 --- a/src/build/png2bdc.c +++ b/src/build/png2bdc.c @@ -128,10 +128,10 @@ static int render_font_save_cached(render_font *font, const char *filename, UINT numchars++; /* allocate an array to hold the character data */ - chartable = malloc(numchars * CACHED_CHAR_SIZE); + chartable = (UINT8 *)malloc(numchars * CACHED_CHAR_SIZE); /* allocate a temp buffer to compress into */ - tempbuffer = malloc(65536); + tempbuffer = (UINT8 *)malloc(65536); if (chartable == NULL || tempbuffer == NULL) goto error; @@ -405,7 +405,7 @@ int main(int argc, char *argv[]) bdcname = argv[argc - 1]; /* allocate a font */ - font = malloc(sizeof(*font)); + font = (render_font *)malloc(sizeof(*font)); if (font == NULL) return 1; memset(font, 0, sizeof(*font)); diff --git a/src/build/verinfo.c b/src/build/verinfo.c index 998c246afc7..00646ef4b7a 100644 --- a/src/build/verinfo.c +++ b/src/build/verinfo.c @@ -233,7 +233,7 @@ int main(int argc, char *argv[]) fseek(f, 0, SEEK_SET); // allocate a buffer - buffer = malloc(size + 1); + buffer = (char *)malloc(size + 1); if (buffer == NULL) { fclose(f); diff --git a/src/emu/audit.c b/src/emu/audit.c index 211cc6d5941..e32b4c4f583 100644 --- a/src/emu/audit.c +++ b/src/emu/audit.c @@ -82,7 +82,7 @@ int audit_images(core_options *options, const game_driver *gamedrv, UINT32 valid if (records > 0) { /* allocate memory for the records */ - *audit = malloc_or_die(sizeof(**audit) * records); + *audit = (audit_record *)malloc_or_die(sizeof(**audit) * records); memset(*audit, 0, sizeof(**audit) * records); record = *audit; @@ -163,7 +163,7 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor goto skip; /* allocate memory for the records */ - *audit = malloc_or_die(sizeof(**audit) * records); + *audit = (audit_record *)malloc_or_die(sizeof(**audit) * records); memset(*audit, 0, sizeof(**audit) * records); record = *audit; diff --git a/src/emu/cheat.c b/src/emu/cheat.c index d995d8e261f..ad98a8efa1a 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -82,6 +82,7 @@ enum _script_state SCRIPT_STATE_COUNT }; typedef enum _script_state script_state; +DECLARE_ENUM_OPERATORS(script_state) @@ -265,7 +266,7 @@ void cheat_init(running_machine *machine) add_exit_callback(machine, cheat_exit); /* allocate memory */ - cheatinfo = auto_malloc(sizeof(*cheatinfo)); + cheatinfo = (cheat_private *)auto_malloc(sizeof(*cheatinfo)); memset(cheatinfo, 0, sizeof(*cheatinfo)); machine->cheat_data = cheatinfo; @@ -343,7 +344,7 @@ void cheat_render_text(running_machine *machine) void *cheat_get_next_menu_entry(running_machine *machine, void *previous, const char **description, const char **state, UINT32 *flags) { cheat_private *cheatinfo = machine->cheat_data; - cheat_entry *preventry = previous; + cheat_entry *preventry = (cheat_entry *)previous; cheat_entry *cheat; /* NULL previous means get the first */ @@ -455,7 +456,7 @@ void *cheat_get_next_menu_entry(running_machine *machine, void *previous, const int cheat_activate(running_machine *machine, void *entry) { cheat_private *cheatinfo = machine->cheat_data; - cheat_entry *cheat = entry; + cheat_entry *cheat = (cheat_entry *)entry; int changed = FALSE; /* if we have no parameter and no run or off script, but we do have an on script, it's a oneshot cheat */ @@ -479,7 +480,7 @@ int cheat_activate(running_machine *machine, void *entry) int cheat_select_default_state(running_machine *machine, void *entry) { cheat_private *cheatinfo = machine->cheat_data; - cheat_entry *cheat = entry; + cheat_entry *cheat = (cheat_entry *)entry; int changed = FALSE; /* if we have no parameter and no run or off script, it's either text or a oneshot cheat */ @@ -508,7 +509,7 @@ int cheat_select_default_state(running_machine *machine, void *entry) int cheat_select_previous_state(running_machine *machine, void *entry) { cheat_private *cheatinfo = machine->cheat_data; - cheat_entry *cheat = entry; + cheat_entry *cheat = (cheat_entry *)entry; int changed = FALSE; /* if we have no parameter and no run or off script, it's either text or a oneshot cheat */ @@ -584,7 +585,7 @@ int cheat_select_previous_state(running_machine *machine, void *entry) int cheat_select_next_state(running_machine *machine, void *entry) { cheat_private *cheatinfo = machine->cheat_data; - cheat_entry *cheat = entry; + cheat_entry *cheat = (cheat_entry *)entry; int changed = FALSE; /* if we have no parameter and no run or off script, it's a oneshot cheat */ @@ -937,7 +938,7 @@ static cheat_entry *cheat_entry_load(running_machine *machine, const char *filen } /* allocate memory for the cheat */ - cheat = malloc_or_die(sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar)); + cheat = (cheat_entry *)malloc_or_die(sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar)); memset(cheat, 0, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar)); cheat->numtemp = tempcount; @@ -1108,7 +1109,7 @@ static cheat_parameter *cheat_parameter_load(const char *filename, xml_data_node cheat_parameter *param; /* allocate memory for it */ - param = malloc_or_die(sizeof(*param)); + param = (cheat_parameter *)malloc_or_die(sizeof(*param)); memset(param, 0, sizeof(*param)); /* read the core attributes */ @@ -1126,7 +1127,7 @@ static cheat_parameter *cheat_parameter_load(const char *filename, xml_data_node parameter_item *curitem; /* allocate memory for it */ - curitem = malloc_or_die(sizeof(*curitem)); + curitem = (parameter_item *)malloc_or_die(sizeof(*curitem)); memset(curitem, 0, sizeof(*curitem)); /* check for NULL text */ @@ -1237,7 +1238,7 @@ static cheat_script *cheat_script_load(running_machine *machine, const char *fil const char *state; /* allocate memory for it */ - script = malloc_or_die(sizeof(*script)); + script = (cheat_script *)malloc_or_die(sizeof(*script)); memset(script, 0, sizeof(*script)); /* read the core attributes */ @@ -1352,7 +1353,7 @@ static script_entry *script_entry_load(running_machine *machine, const char *fil EXPRERR experr; /* allocate memory for it */ - entry = malloc_or_die(sizeof(*entry)); + entry = (script_entry *)malloc_or_die(sizeof(*entry)); memset(entry, 0, sizeof(*entry)); /* read the condition if present */ @@ -1422,7 +1423,7 @@ static script_entry *script_entry_load(running_machine *machine, const char *fil output_argument *curarg; /* allocate memory for it */ - curarg = malloc_or_die(sizeof(*curarg)); + curarg = (output_argument *)malloc_or_die(sizeof(*curarg)); memset(curarg, 0, sizeof(*curarg)); /* first extract attributes */ diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 2e60ea20918..743d5910efd 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -440,7 +440,7 @@ int cli_info_listclones(core_options *options, const char *gamename) int cli_info_listbrothers(core_options *options, const char *gamename) { - UINT8 *didit = malloc_or_die(driver_list_get_count(drivers)); + UINT8 *didit = (UINT8 *)malloc_or_die(driver_list_get_count(drivers)); astring *filename = astring_alloc(); int drvindex, count = 0; @@ -954,7 +954,7 @@ static void identify_data(const char *name, const UINT8 *data, int length, romid { /* now determine the new data length and allocate temporary memory for it */ length = jedbin_output(&jed, NULL, 0); - tempjed = malloc(length); + tempjed = (UINT8 *)malloc(length); if (tempjed == NULL) return; diff --git a/src/emu/config.c b/src/emu/config.c index 651aa1c80ce..3d0edbf74f7 100644 --- a/src/emu/config.c +++ b/src/emu/config.c @@ -92,7 +92,7 @@ void config_register(running_machine *machine, const char *nodename, config_call config_type **ptype; /* allocate a new type */ - newtype = auto_malloc(sizeof(*newtype)); + newtype = (config_type *)auto_malloc(sizeof(*newtype)); newtype->next = NULL; newtype->name = nodename; newtype->load = load; diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index 78b6c388a4f..2adced72c43 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -631,7 +631,7 @@ static void adjust_timer_interrupt(hyperstone_state *cpustate) static TIMER_CALLBACK( e132xs_timer_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; hyperstone_state *cpustate = device->token; int update = param; diff --git a/src/emu/cpu/m68000/m68kmake.c b/src/emu/cpu/m68000/m68kmake.c index fba9f0da189..c0ad9d68a5b 100644 --- a/src/emu/cpu/m68000/m68kmake.c +++ b/src/emu/cpu/m68000/m68kmake.c @@ -808,7 +808,7 @@ static void add_opcode_output_table_entry(opcode_struct* op, char* name) */ static int DECL_SPEC compare_nof_true_bits(const void* aptr, const void* bptr) { - const opcode_struct *a = aptr, *b = bptr; + const opcode_struct *a = (const opcode_struct *)aptr, *b = (const opcode_struct *)bptr; if(a->bits != b->bits) return a->bits - b->bits; if(a->op_mask != b->op_mask) @@ -863,7 +863,7 @@ static void set_opcode_struct(opcode_struct* src, opcode_struct* dst, int ea_mod static void generate_opcode_handler(FILE* filep, body_struct* body, replace_struct* replace, opcode_struct* opinfo, int ea_mode) { char str[MAX_LINE_LENGTH+1]; - opcode_struct* op = malloc(sizeof(opcode_struct)); + opcode_struct* op = (opcode_struct *)malloc(sizeof(opcode_struct)); /* Set the opcode structure and write the tables, prototypes, etc */ set_opcode_struct(opinfo, op, ea_mode); @@ -956,7 +956,7 @@ static void generate_opcode_cc_variants(FILE* filep, body_struct* body, replace_ char replnot[20]; int i; int old_length = replace->length; - opcode_struct* op = malloc(sizeof(opcode_struct)); + opcode_struct* op = (opcode_struct *)malloc(sizeof(opcode_struct)); *op = *op_in; @@ -995,8 +995,8 @@ static void process_opcode_handlers(FILE* filep) char oper_spec_proc[MAX_LINE_LENGTH+1]; char oper_spec_ea[MAX_LINE_LENGTH+1]; opcode_struct* opinfo; - replace_struct* replace = malloc(sizeof(replace_struct)); - body_struct* body = malloc(sizeof(body_struct)); + replace_struct* replace = (replace_struct*)malloc(sizeof(replace_struct)); + body_struct* body = (body_struct*)malloc(sizeof(body_struct)); for(;;) { diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index 0bba6dd122f..d955286add3 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -1192,7 +1192,7 @@ UINT8 upi41_master_r(const device_config *device, UINT8 a0) static TIMER_CALLBACK( master_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mcs48_state *cpustate = device->token; UINT8 a0 = (param >> 8) & 1; UINT8 data = param; diff --git a/src/emu/cpu/mips/mips3com.c b/src/emu/cpu/mips/mips3com.c index 27ef9a16500..a1e906a1968 100644 --- a/src/emu/cpu/mips/mips3com.c +++ b/src/emu/cpu/mips/mips3com.c @@ -706,7 +706,7 @@ void mips3com_get_info(mips3_state *mips, UINT32 state, cpuinfo *info) static TIMER_CALLBACK( compare_int_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; cpu_set_input_line(device, MIPS3_IRQ5, ASSERT_LINE); } diff --git a/src/emu/cpu/tms57002/tmsmake.c b/src/emu/cpu/tms57002/tmsmake.c index 49b80c11785..c61c89cdd4e 100644 --- a/src/emu/cpu/tms57002/tmsmake.c +++ b/src/emu/cpu/tms57002/tmsmake.c @@ -101,7 +101,7 @@ static char *sconcat(char *dest, const char *src) char *r; int len = strlen(src); int pos = dest ? strlen(dest) : 0; - r = realloc(dest, pos+len+2); + r = (char *)realloc(dest, pos+len+2); memcpy(r + pos, src, len); r[pos+len] = '\n'; r[pos+len+1] = 0; diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index bb4c70a26b0..50424aa4c78 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -223,7 +223,7 @@ void cpuexec_init(running_machine *machine) attotime min_quantum; /* allocate global state */ - machine->cpuexec_data = auto_malloc(sizeof(*machine->cpuexec_data)); + machine->cpuexec_data = (cpuexec_private *)auto_malloc(sizeof(*machine->cpuexec_data)); memset(machine->cpuexec_data, 0, sizeof(*machine->cpuexec_data)); /* set the core scheduling quantum */ @@ -457,7 +457,7 @@ static DEVICE_START( cpu ) assert(device->machine->config != NULL); /* get pointers to our data */ - config = device->inline_config; + config = (const cpu_config *)device->inline_config; header = cpu_get_class_header(device); classdata = get_class_data(device); @@ -553,7 +553,7 @@ static DEVICE_START( cpu ) static DEVICE_RESET( cpu ) { cpu_class_data *classdata = get_class_data(device); - const cpu_config *config = device->inline_config; + const cpu_config *config = (const cpu_config *)device->inline_config; cpu_reset_func reset; int line; @@ -685,7 +685,7 @@ static DEVICE_SET_INFO( cpu ) DEVICE_GET_INFO( cpu ) { - const cpu_config *config = (device != NULL) ? device->inline_config : NULL; + const cpu_config *config = (device != NULL) ? (const cpu_config *)device->inline_config : NULL; cpuinfo cinfo = { 0 }; switch (state) @@ -1363,7 +1363,7 @@ static void on_vblank(const device_config *device, void *param, int vblank_state /* find any CPUs that have this screen as their VBLANK interrupt source */ for (cpu = device->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext) { - const cpu_config *config = cpu->inline_config; + const cpu_config *config = (const cpu_config *)cpu->inline_config; cpu_class_data *classdata = get_class_data(cpu); int cpu_interested; @@ -1410,8 +1410,8 @@ static void on_vblank(const device_config *device, void *param, int vblank_state static TIMER_CALLBACK( trigger_partial_frame_interrupt ) { - const device_config *device = ptr; - const cpu_config *config = device->inline_config; + const device_config *device = (const device_config *)ptr; + const cpu_config *config = (const cpu_config *)device->inline_config; cpu_class_data *classdata = get_class_data(device); if (classdata->iloops == 0) @@ -1436,8 +1436,8 @@ static TIMER_CALLBACK( trigger_partial_frame_interrupt ) static TIMER_CALLBACK( trigger_periodic_interrupt ) { - const device_config *device = ptr; - const cpu_config *config = device->inline_config; + const device_config *device = (const device_config *)ptr; + const cpu_config *config = (const cpu_config *)device->inline_config; /* bail if there is no routine */ if (config->timed_interrupt != NULL && !cpu_is_suspended(device, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) @@ -1462,7 +1462,7 @@ static TIMER_CALLBACK( triggertime_callback ) static TIMER_CALLBACK( empty_event_queue ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; cpu_class_data *classdata = get_class_data(device); cpu_input_data *inputline = &classdata->input[param]; int curevent; diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 0abed9ec682..f08f5fa105c 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -322,7 +322,7 @@ static UINT64 execute_if(void *globalref, void *ref, UINT32 params, const UINT64 static UINT64 global_get(void *globalref, void *ref) { - global_entry *global = ref; + global_entry *global = (global_entry *)ref; switch (global->size) { case 1: return *(UINT8 *)global->base; @@ -340,7 +340,7 @@ static UINT64 global_get(void *globalref, void *ref) static void global_set(void *globalref, void *ref, UINT64 value) { - global_entry *global = ref; + global_entry *global = (global_entry *)ref; switch (global->size) { case 1: *(UINT8 *)global->base = value; break; diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index a52ef07da7f..cc2fd0b7117 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -404,7 +404,7 @@ void debug_console_register_command(running_machine *machine, const char *comman assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); assert_always((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); - cmd = auto_malloc(sizeof(*cmd)); + cmd = (debug_command *)auto_malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); /* fill in the command */ diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index c3712de34a1..0c7987df683 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -158,7 +158,7 @@ void debug_cpu_init(running_machine *machine) int regnum; /* allocate and reset globals */ - machine->debugcpu_data = global = auto_malloc(sizeof(*global)); + machine->debugcpu_data = global = (debugcpu_private *)auto_malloc(sizeof(*global)); memset(global, 0, sizeof(*global)); global->execution_state = EXECUTION_STATE_STOPPED; global->bpindex = 1; @@ -190,7 +190,7 @@ void debug_cpu_init(running_machine *machine) cpu_debug_data *info; /* allocate some information */ - info = auto_malloc(sizeof(*info)); + info = (cpu_debug_data *)auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); classheader->debug = info; @@ -983,7 +983,7 @@ int debug_cpu_breakpoint_set(const device_config *device, offs_t address, parsed assert_always(device != NULL, "debug_cpu_breakpoint_set() called with invalid cpu!"); /* allocate breakpoint */ - bp = malloc_or_die(sizeof(*bp)); + bp = (debug_cpu_breakpoint *)malloc_or_die(sizeof(*bp)); bp->index = global->bpindex++; bp->enabled = TRUE; bp->address = address; @@ -991,7 +991,7 @@ int debug_cpu_breakpoint_set(const device_config *device, offs_t address, parsed bp->action = NULL; if (action != NULL) { - bp->action = malloc_or_die(strlen(action) + 1); + bp->action = (char *)malloc_or_die(strlen(action) + 1); strcpy(bp->action, action); } @@ -1087,7 +1087,7 @@ int debug_cpu_watchpoint_set(const address_space *space, int type, offs_t addres { debugcpu_private *global = space->machine->debugcpu_data; cpu_debug_data *info = cpu_get_debug_data(space->cpu); - debug_cpu_watchpoint *wp = malloc_or_die(sizeof(*wp)); + debug_cpu_watchpoint *wp = (debug_cpu_watchpoint *)malloc_or_die(sizeof(*wp)); /* fill in the structure */ wp->index = global->wpindex++; @@ -1099,7 +1099,7 @@ int debug_cpu_watchpoint_set(const address_space *space, int type, offs_t addres wp->action = NULL; if (action != NULL) { - wp->action = malloc_or_die(strlen(action) + 1); + wp->action = (char *)malloc_or_die(strlen(action) + 1); strcpy(wp->action, action); } @@ -1245,7 +1245,7 @@ void debug_cpu_trace(const device_config *device, FILE *file, int trace_over, co info->trace.trace_over_target = ~0; if (action != NULL) { - info->trace.action = malloc_or_die(strlen(action) + 1); + info->trace.action = (char *)malloc_or_die(strlen(action) + 1); strcpy(info->trace.action, action); } @@ -1313,7 +1313,7 @@ int debug_cpu_hotspot_track(const device_config *device, int numspots, int thres if (numspots > 0) { /* allocate memory for hotspots */ - info->hotspots = malloc_or_die(sizeof(*info->hotspots) * numspots); + info->hotspots = (debug_hotspot_entry *)malloc_or_die(sizeof(*info->hotspots) * numspots); memset(info->hotspots, 0xff, sizeof(*info->hotspots) * numspots); /* fill in the info */ @@ -2429,7 +2429,7 @@ static const device_config *expression_cpu_index(running_machine *machine, const static UINT64 expression_read_memory(void *param, const char *name, int space, UINT32 address, int size) { - running_machine *machine = param; + running_machine *machine = (running_machine *)param; const device_config *cpu = NULL; switch (space) @@ -2532,9 +2532,9 @@ static UINT64 expression_read_program_direct(const address_space *space, int opc /* get the base of memory, aligned to the address minus the lowbits */ if (opcode & 1) - base = memory_decrypted_read_ptr(space, address & ~lowmask); + base = (UINT8 *)memory_decrypted_read_ptr(space, address & ~lowmask); else - base = memory_get_read_ptr(space, address & ~lowmask); + base = (UINT8 *)memory_get_read_ptr(space, address & ~lowmask); /* if we have a valid base, return the appropriate byte */ if (base != NULL) @@ -2634,7 +2634,7 @@ static UINT64 expression_read_eeprom(running_machine *machine, offs_t address, i static void expression_write_memory(void *param, const char *name, int space, UINT32 address, int size, UINT64 data) { - running_machine *machine = param; + running_machine *machine = (running_machine *)param; const device_config *cpu = NULL; switch (space) @@ -2743,9 +2743,9 @@ static void expression_write_program_direct(const address_space *space, int opco /* get the base of memory, aligned to the address minus the lowbits */ if (opcode & 1) - base = memory_decrypted_read_ptr(space, address & ~lowmask); + base = (UINT8 *)memory_decrypted_read_ptr(space, address & ~lowmask); else - base = memory_get_read_ptr(space, address & ~lowmask); + base = (UINT8 *)memory_get_read_ptr(space, address & ~lowmask); /* if we have a valid base, write the appropriate byte */ if (base != NULL) @@ -2866,7 +2866,7 @@ static void expression_write_eeprom(running_machine *machine, offs_t address, in static EXPRERR expression_validate(void *param, const char *name, int space) { - running_machine *machine = param; + running_machine *machine = (running_machine *)param; const device_config *cpu = NULL; switch (space) @@ -2928,7 +2928,7 @@ static EXPRERR expression_validate(void *param, const char *name, int space) static UINT64 get_wpaddr(void *globalref, void *ref) { - running_machine *machine = globalref; + running_machine *machine = (running_machine *)globalref; return machine->debugcpu_data->wpaddr; } @@ -2940,7 +2940,7 @@ static UINT64 get_wpaddr(void *globalref, void *ref) static UINT64 get_wpdata(void *globalref, void *ref) { - running_machine *machine = globalref; + running_machine *machine = (running_machine *)globalref; return machine->debugcpu_data->wpdata; } @@ -2952,7 +2952,7 @@ static UINT64 get_wpdata(void *globalref, void *ref) static UINT64 get_cpunum(void *globalref, void *ref) { - running_machine *machine = globalref; + running_machine *machine = (running_machine *)globalref; return cpu_get_index(machine->debugcpu_data->visiblecpu); } @@ -2985,7 +2985,7 @@ static void set_tempvar(void *globalref, void *ref, UINT64 value) static UINT64 get_beamx(void *globalref, void *ref) { - const device_config *screen = ref; + const device_config *screen = (const device_config *)ref; return (screen != NULL) ? video_screen_get_hpos(screen) : 0; } @@ -2996,7 +2996,7 @@ static UINT64 get_beamx(void *globalref, void *ref) static UINT64 get_beamy(void *globalref, void *ref) { - const device_config *screen = ref; + const device_config *screen = (const device_config *)ref; return (screen != NULL) ? video_screen_get_vpos(screen) : 0; } @@ -3007,7 +3007,7 @@ static UINT64 get_beamy(void *globalref, void *ref) static UINT64 get_frame(void *globalref, void *ref) { - const device_config *screen = ref; + const device_config *screen = (const device_config *)ref; return (screen != NULL) ? video_screen_get_frame_number(screen) : 0; } @@ -3019,7 +3019,7 @@ static UINT64 get_frame(void *globalref, void *ref) static UINT64 get_current_pc(void *globalref, void *ref) { - const device_config *device = globalref; + const device_config *device = (const device_config *)globalref; return cpu_get_pc(device); } @@ -3031,7 +3031,7 @@ static UINT64 get_current_pc(void *globalref, void *ref) static UINT64 get_cycles(void *globalref, void *ref) { - const device_config *device = globalref; + const device_config *device = (const device_config *)globalref; return *cpu_get_icount_ptr(device); } @@ -3043,7 +3043,7 @@ static UINT64 get_cycles(void *globalref, void *ref) static UINT64 get_logunmap(void *globalref, void *ref) { - const address_space *space = ref; + const address_space *space = (const address_space *)ref; return (space != NULL) ? memory_get_log_unmap(space) : TRUE; } @@ -3055,7 +3055,7 @@ static UINT64 get_logunmap(void *globalref, void *ref) static void set_logunmap(void *globalref, void *ref, UINT64 value) { - const address_space *space = ref; + const address_space *space = (const address_space *)ref; if (space != NULL) memory_set_log_unmap(space, value ? 1 : 0); } @@ -3068,7 +3068,7 @@ static void set_logunmap(void *globalref, void *ref, UINT64 value) static UINT64 get_cpu_reg(void *globalref, void *ref) { - const device_config *device = globalref; + const device_config *device = (const device_config *)globalref; return cpu_get_reg(device, (FPTR)ref); } @@ -3080,6 +3080,6 @@ static UINT64 get_cpu_reg(void *globalref, void *ref) static void set_cpu_reg(void *globalref, void *ref, UINT64 value) { - const device_config *device = globalref; + const device_config *device = (const device_config *)globalref; cpu_set_reg(device, (FPTR)ref, value); } diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 042c42d5404..d7a03e0597b 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -342,7 +342,7 @@ void debug_view_init(running_machine *machine) debugvw_private *global; /* allocate memory for our globals */ - global = machine->debugvw_data = auto_malloc(sizeof(*machine->debugvw_data)); + global = machine->debugvw_data = (debugvw_private *)auto_malloc(sizeof(*machine->debugvw_data)); memset(global, 0, sizeof(*global)); /* register for some manual cleanup */ @@ -387,7 +387,7 @@ debug_view *debug_view_alloc(running_machine *machine, int type, debug_view_osd_ assert(type >= 0 && type < ARRAY_LENGTH(callback_table)); /* allocate memory for the view */ - view = malloc(sizeof(*view)); + view = (debug_view *)malloc(sizeof(*view)); if (view == NULL) return NULL; memset(view, 0, sizeof(*view)); @@ -405,7 +405,7 @@ debug_view *debug_view_alloc(running_machine *machine, int type, debug_view_osd_ /* allocate memory for the buffer */ view->viewdata_size = view->visible.y * view->visible.x; - view->viewdata = malloc(sizeof(view->viewdata[0]) * view->viewdata_size); + view->viewdata = (debug_view_char *)malloc(sizeof(view->viewdata[0]) * view->viewdata_size); if (view->viewdata == NULL) { free(view); @@ -499,7 +499,7 @@ void debug_view_end_update(debug_view *view) if (size > view->viewdata_size) { view->viewdata_size = size; - view->viewdata = realloc(view->viewdata, sizeof(view->viewdata[0]) * view->viewdata_size); + view->viewdata = (debug_view_char *)realloc(view->viewdata, sizeof(view->viewdata[0]) * view->viewdata_size); } /* update the view */ @@ -908,7 +908,7 @@ static int textbuf_view_alloc(debug_view *view, text_buffer *textbuf) debug_view_textbuf *textdata; /* allocate memory */ - textdata = malloc(sizeof(*textdata)); + textdata = (debug_view_textbuf *)malloc(sizeof(*textdata)); if (textdata == NULL) return FALSE; memset(textdata, 0, sizeof(*textdata)); @@ -930,7 +930,7 @@ static int textbuf_view_alloc(debug_view *view, text_buffer *textbuf) static void textbuf_view_free(debug_view *view) { - debug_view_textbuf *textdata = view->extra_data; + debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; /* free any memory we callocated */ if (textdata != NULL) @@ -946,7 +946,7 @@ static void textbuf_view_free(debug_view *view) static void textbuf_view_update(debug_view *view) { - debug_view_textbuf *textdata = view->extra_data; + debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; debug_view_char *dest = view->viewdata; UINT32 curseq = 0, row; @@ -1014,7 +1014,7 @@ static void textbuf_view_update(debug_view *view) static void textbuf_view_notify(debug_view *view, view_notification type) { - debug_view_textbuf *textdata = view->extra_data; + debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; if (type == VIEW_NOTIFY_VISIBLE_CHANGED) { @@ -1053,7 +1053,7 @@ static const registers_subview_item *registers_view_enumerate_subviews(running_m /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); - subview = auto_malloc(sizeof(*subview) + astring_len(tempstring)); + subview = (registers_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); memset(subview, 0, sizeof(*subview)); /* populate the subview */ @@ -1087,7 +1087,7 @@ static int registers_view_alloc(debug_view *view) return FALSE; /* allocate memory */ - regdata = malloc(sizeof(*regdata)); + regdata = (debug_view_registers *)malloc(sizeof(*regdata)); if (regdata == NULL) return FALSE; memset(regdata, 0, sizeof(*regdata)); @@ -1108,7 +1108,7 @@ static int registers_view_alloc(debug_view *view) static void registers_view_free(debug_view *view) { - debug_view_registers *regdata = view->extra_data; + debug_view_registers *regdata = (debug_view_registers *)view->extra_data; /* free any memory we callocated */ if (regdata != NULL) @@ -1124,7 +1124,7 @@ static void registers_view_free(debug_view *view) static void registers_view_add_register(debug_view *view, int regnum, const char *str) { - debug_view_registers *regdata = view->extra_data; + debug_view_registers *regdata = (debug_view_registers *)view->extra_data; int tagstart, taglen, valstart, vallen; const char *colon; @@ -1183,7 +1183,7 @@ static void registers_view_add_register(debug_view *view, int regnum, const char static void registers_view_recompute(debug_view *view) { - debug_view_registers *regdata = view->extra_data; + debug_view_registers *regdata = (debug_view_registers *)view->extra_data; int regnum, maxtaglen, maxvallen; const cpu_state_table *table; @@ -1296,7 +1296,7 @@ static void registers_view_recompute(debug_view *view) static void registers_view_update(debug_view *view) { const device_config *screen = view->machine->primary_screen; - debug_view_registers *regdata = view->extra_data; + debug_view_registers *regdata = (debug_view_registers *)view->extra_data; debug_view_char *dest = view->viewdata; UINT64 total_cycles; UINT32 row, i; @@ -1434,7 +1434,7 @@ const registers_subview_item *registers_view_get_subview_list(debug_view *view) int registers_view_get_subview(debug_view *view) { - debug_view_registers *regdata = view->extra_data; + debug_view_registers *regdata = (debug_view_registers *)view->extra_data; const registers_subview_item *subview; int index = 0; @@ -1460,7 +1460,7 @@ int registers_view_get_subview(debug_view *view) void registers_view_set_subview(debug_view *view, int index) { const registers_subview_item *subview = registers_view_get_subview_by_index(view->machine->debugvw_data->registers_subviews, index); - debug_view_registers *regdata = view->extra_data; + debug_view_registers *regdata = (debug_view_registers *)view->extra_data; assert(view->type == DVT_REGISTERS); assert(subview != NULL); @@ -1506,7 +1506,7 @@ static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); - subview = auto_malloc(sizeof(*subview) + astring_len(tempstring)); + subview = (disasm_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); memset(subview, 0, sizeof(*subview)); /* populate the subview */ @@ -1543,7 +1543,7 @@ static int disasm_view_alloc(debug_view *view) return FALSE; /* allocate disasm */ - dasmdata = malloc(sizeof(*dasmdata)); + dasmdata = (debug_view_disasm *)malloc(sizeof(*dasmdata)); if (dasmdata == NULL) return FALSE; memset(dasmdata, 0, sizeof(*dasmdata)); @@ -1580,7 +1580,7 @@ static int disasm_view_alloc(debug_view *view) static void disasm_view_free(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; /* free any disasm we callocated */ if (dasmdata != NULL) @@ -1615,7 +1615,7 @@ static void disasm_view_notify(debug_view *view, view_notification type) static void disasm_view_char(debug_view *view, int chval) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; debug_view_xy origcursor = view->cursor; UINT8 end_buffer = 3; INT32 temp; @@ -1824,7 +1824,7 @@ static void disasm_view_generate_bytes(const address_space *space, offs_t pcbyte static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int lines) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const address_space *space = dasmdata->space; int minbytes, maxbytes, maxbytes_clamped; int changed = FALSE; @@ -1864,12 +1864,12 @@ static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int /* allocate address array */ if (dasmdata->byteaddress != NULL) free(dasmdata->byteaddress); - dasmdata->byteaddress = malloc_or_die(sizeof(dasmdata->byteaddress[0]) * dasmdata->allocated.y); + dasmdata->byteaddress = (offs_t *)malloc_or_die(sizeof(dasmdata->byteaddress[0]) * dasmdata->allocated.y); /* allocate disassembly buffer */ if (dasmdata->dasm != NULL) free(dasmdata->dasm); - dasmdata->dasm = malloc_or_die(sizeof(dasmdata->dasm[0]) * dasmdata->allocated.x * dasmdata->allocated.y); + dasmdata->dasm = (char *)malloc_or_die(sizeof(dasmdata->dasm[0]) * dasmdata->allocated.x * dasmdata->allocated.y); } /* iterate over lines */ @@ -1955,7 +1955,7 @@ static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int static void disasm_view_update(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const address_space *space = dasmdata->space; debug_view_char *dest = view->viewdata; int recomputed_this_time = FALSE; @@ -2163,7 +2163,7 @@ const disasm_subview_item *disasm_view_get_subview_list(debug_view *view) int disasm_view_get_subview(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const disasm_subview_item *subview; int index = 0; @@ -2188,7 +2188,7 @@ int disasm_view_get_subview(debug_view *view) const char *disasm_view_get_expression(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); @@ -2203,7 +2203,7 @@ const char *disasm_view_get_expression(debug_view *view) disasm_right_column disasm_view_get_right_column(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); @@ -2219,7 +2219,7 @@ disasm_right_column disasm_view_get_right_column(debug_view *view) UINT32 disasm_view_get_backward_steps(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); @@ -2235,7 +2235,7 @@ UINT32 disasm_view_get_backward_steps(debug_view *view) UINT32 disasm_view_get_disasm_width(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); @@ -2251,7 +2251,7 @@ UINT32 disasm_view_get_disasm_width(debug_view *view) offs_t disasm_view_get_selected_address(debug_view *view) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); @@ -2267,7 +2267,7 @@ offs_t disasm_view_get_selected_address(debug_view *view) void disasm_view_set_subview(debug_view *view, int index) { const disasm_subview_item *subview = disasm_view_get_subview_by_index(view->machine->debugvw_data->disasm_subviews, index); - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(subview != NULL); @@ -2295,7 +2295,7 @@ void disasm_view_set_subview(debug_view *view, int index) void disasm_view_set_expression(debug_view *view, const char *expression) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(expression != NULL); @@ -2314,7 +2314,7 @@ void disasm_view_set_expression(debug_view *view, const char *expression) void disasm_view_set_right_column(debug_view *view, disasm_right_column contents) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(contents == DASM_RIGHTCOL_RAW || contents == DASM_RIGHTCOL_ENCRYPTED || contents == DASM_RIGHTCOL_COMMENTS); @@ -2337,7 +2337,7 @@ void disasm_view_set_right_column(debug_view *view, disasm_right_column contents void disasm_view_set_backward_steps(debug_view *view, UINT32 steps) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); @@ -2359,7 +2359,7 @@ void disasm_view_set_backward_steps(debug_view *view, UINT32 steps) void disasm_view_set_disasm_width(debug_view *view, UINT32 width) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); @@ -2381,7 +2381,7 @@ void disasm_view_set_disasm_width(debug_view *view, UINT32 width) void disasm_view_set_selected_address(debug_view *view, offs_t address) { - debug_view_disasm *dasmdata = view->extra_data; + debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; offs_t byteaddress = memory_address_to_byte(dasmdata->space, address) & dasmdata->space->logbytemask; int line; @@ -2429,7 +2429,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s) %s memory", cpu->tag, cpu_get_name(cpu), space->name); - subview = auto_malloc(sizeof(*subview) + astring_len(tempstring)); + subview = (memory_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); memset(subview, 0, sizeof(*subview)); /* populate the subview */ @@ -2459,7 +2459,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "Region '%s'", rgntag); - subview = auto_malloc(sizeof(*subview) + astring_len(tempstring)); + subview = (memory_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); memset(subview, 0, sizeof(*subview)); /* populate the subview */ @@ -2497,7 +2497,7 @@ static const memory_subview_item *memory_view_enumerate_subviews(running_machine /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "%s", strrchr(name, '/') + 1); - subview = auto_malloc(sizeof(*subview) + astring_len(tempstring)); + subview = (memory_subview_item *)auto_malloc(sizeof(*subview) + astring_len(tempstring)); memset(subview, 0, sizeof(*subview)); /* populate the subview */ @@ -2536,7 +2536,7 @@ static int memory_view_alloc(debug_view *view) return FALSE; /* allocate memory */ - memdata = malloc(sizeof(*memdata)); + memdata = (debug_view_memory *)malloc(sizeof(*memdata)); if (memdata == NULL) return FALSE; memset(memdata, 0, sizeof(*memdata)); @@ -2570,7 +2570,7 @@ static int memory_view_alloc(debug_view *view) static void memory_view_free(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; /* free any memory we allocated */ if (memdata != NULL) @@ -2608,7 +2608,7 @@ static void memory_view_notify(debug_view *view, view_notification type) static void memory_view_update(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; const memory_view_pos *posdata; UINT32 row; @@ -2704,7 +2704,7 @@ static void memory_view_update(debug_view *view) static void memory_view_char(debug_view *view, int chval) { static const char hexvals[] = "0123456789abcdef"; - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; offs_t address; char *hexchar; int ismapped; @@ -2777,7 +2777,7 @@ static void memory_view_char(debug_view *view, int chval) break; default: - hexchar = strchr(hexvals, tolower(chval)); + hexchar = (char *)strchr(hexvals, tolower(chval)); if (hexchar == NULL) break; ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, address, &data); @@ -2824,7 +2824,7 @@ static void memory_view_char(debug_view *view, int chval) static void memory_view_recompute(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; offs_t cursoraddr; UINT8 cursorshift; @@ -2904,7 +2904,7 @@ static void memory_view_recompute(debug_view *view) static int memory_view_needs_recompute(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; int recompute = view->recompute; @@ -2931,7 +2931,7 @@ static int memory_view_needs_recompute(debug_view *view) static void memory_view_get_cursor_pos(debug_view *view, offs_t *address, UINT8 *shift) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const memory_view_pos *posdata = &memory_pos_table[memdata->bytes_per_chunk]; int xposition, chunknum, chunkoffs; @@ -2967,7 +2967,7 @@ static void memory_view_get_cursor_pos(debug_view *view, offs_t *address, UINT8 static void memory_view_set_cursor_pos(debug_view *view, offs_t address, UINT8 shift) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const memory_view_pos *posdata = &memory_pos_table[memdata->bytes_per_chunk]; int chunknum; @@ -3131,7 +3131,7 @@ const memory_subview_item *memory_view_get_subview_list(debug_view *view) int memory_view_get_subview(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); @@ -3148,7 +3148,7 @@ int memory_view_get_subview(debug_view *view) const char *memory_view_get_expression(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); @@ -3163,7 +3163,7 @@ const char *memory_view_get_expression(debug_view *view) UINT8 memory_view_get_bytes_per_chunk(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); @@ -3178,7 +3178,7 @@ UINT8 memory_view_get_bytes_per_chunk(debug_view *view) UINT32 memory_view_get_chunks_per_row(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); @@ -3193,7 +3193,7 @@ UINT32 memory_view_get_chunks_per_row(debug_view *view) UINT8 memory_view_get_reverse(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); @@ -3209,7 +3209,7 @@ UINT8 memory_view_get_reverse(debug_view *view) UINT8 memory_view_get_ascii(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); @@ -3225,7 +3225,7 @@ UINT8 memory_view_get_ascii(debug_view *view) UINT8 memory_view_get_physical(debug_view *view) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); @@ -3241,7 +3241,7 @@ UINT8 memory_view_get_physical(debug_view *view) void memory_view_set_subview(debug_view *view, int index) { const memory_subview_item *subview = memory_view_get_subview_by_index(view->machine->debugvw_data->memory_subviews, index); - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(subview != NULL); @@ -3271,7 +3271,7 @@ void memory_view_set_subview(debug_view *view, int index) void memory_view_set_expression(debug_view *view, const char *expression) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(expression != NULL); @@ -3290,7 +3290,7 @@ void memory_view_set_expression(debug_view *view, const char *expression) void memory_view_set_bytes_per_chunk(debug_view *view, UINT8 chunkbytes) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(chunkbytes < ARRAY_LENGTH(memory_pos_table) && memory_pos_table[chunkbytes].spacing != 0); @@ -3325,7 +3325,7 @@ void memory_view_set_bytes_per_chunk(debug_view *view, UINT8 chunkbytes) void memory_view_set_chunks_per_row(debug_view *view, UINT32 rowchunks) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); @@ -3354,7 +3354,7 @@ void memory_view_set_chunks_per_row(debug_view *view, UINT32 rowchunks) void memory_view_set_reverse(debug_view *view, UINT8 reverse) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); @@ -3381,7 +3381,7 @@ void memory_view_set_reverse(debug_view *view, UINT8 reverse) void memory_view_set_ascii(debug_view *view, UINT8 ascii) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); @@ -3408,7 +3408,7 @@ void memory_view_set_ascii(debug_view *view, UINT8 ascii) void memory_view_set_physical(debug_view *view, UINT8 physical) { - debug_view_memory *memdata = view->extra_data; + debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); diff --git a/src/emu/debug/express.c b/src/emu/debug/express.c index 37679815926..98284bf4bda 100644 --- a/src/emu/debug/express.c +++ b/src/emu/debug/express.c @@ -304,7 +304,7 @@ INLINE EXPRERR pop_token_lval(parsed_expression *expr, parse_token *token, const /* to be an lval, the token must be a valid read/write symbol or a memory token */ if (token->type == TOK_SYMBOL) { - symbol_entry *symbol = token->value.p; + symbol_entry *symbol = (symbol_entry *)token->value.p; if (symbol == NULL || symbol->type != SMT_REGISTER || symbol->info.reg.setter == NULL) return MAKE_EXPRERR_NOT_LVAL(token->offset); } @@ -332,7 +332,7 @@ INLINE EXPRERR pop_token_rval(parsed_expression *expr, parse_token *token, const /* symbol tokens get resolved down to number tokens */ if (token->type == TOK_SYMBOL) { - symbol_entry *symbol = token->value.p; + symbol_entry *symbol = (symbol_entry *)token->value.p; if (symbol == NULL || (symbol->type != SMT_REGISTER && symbol->type != SMT_VALUE)) return MAKE_EXPRERR_NOT_RVAL(token->offset); token->type = TOK_NUMBER; @@ -371,7 +371,7 @@ INLINE UINT64 get_lval_value(parsed_expression *expr, parse_token *token, const { if (token->type == TOK_SYMBOL) { - symbol_entry *symbol = token->value.p; + symbol_entry *symbol = (symbol_entry *)token->value.p; if (symbol != NULL && symbol->type == SMT_REGISTER) return (*symbol->info.reg.getter)(symbol->table->globalref, symbol->ref); } @@ -396,7 +396,7 @@ INLINE void set_lval_value(parsed_expression *expr, parse_token *token, const sy { if (token->type == TOK_SYMBOL) { - symbol_entry *symbol = token->value.p; + symbol_entry *symbol = (symbol_entry *)token->value.p; if (symbol != NULL && symbol->type == SMT_REGISTER && symbol->info.reg.setter) (*symbol->info.reg.setter)(symbol->table->globalref, symbol->ref, value); } @@ -618,7 +618,7 @@ static EXPRERR parse_string_into_tokens(const char *stringstart, parsed_expressi expr->table = table; /* make a copy of the original string */ - expr->original_string = malloc(strlen(stringstart) + 1); + expr->original_string = (char *)malloc(strlen(stringstart) + 1); if (!expr->original_string) return MAKE_EXPRERR_OUT_OF_MEMORY(0); strcpy(expr->original_string, stringstart); @@ -1214,7 +1214,7 @@ static EXPRERR execute_function(parsed_expression *expr, parse_token *token) /* if it is a function symbol, break out of the loop */ if (peek->type == TOK_SYMBOL) { - symbol = peek->value.p; + symbol = (symbol_entry *)peek->value.p; if (symbol != NULL && symbol->type == SMT_FUNCTION) { pop_token(expr, &t1); @@ -1666,7 +1666,7 @@ static char *add_expression_string(parsed_expression *expr, const char *string, expression_string *expstring; /* allocate memory */ - expstring = malloc(sizeof(expression_string) + length); + expstring = (expression_string *)malloc(sizeof(expression_string) + length); if (expstring == NULL) return NULL; @@ -1800,7 +1800,7 @@ EXPRERR expression_parse(const char *expression, const symbol_table *table, cons goto cleanup; /* allocate memory for the result */ - *result = malloc(sizeof(temp_expression)); + *result = (parsed_expression *)malloc(sizeof(temp_expression)); if (!*result) { exprerr = MAKE_EXPRERR_OUT_OF_MEMORY(0); @@ -1920,7 +1920,7 @@ symbol_table *symtable_alloc(symbol_table *parent, void *globalref) symbol_table *table; /* allocate memory for the table */ - table = malloc(sizeof(*table)); + table = (symbol_table *)malloc(sizeof(*table)); if (!table) return NULL; @@ -1980,13 +1980,13 @@ int symtable_add(symbol_table *table, const char *name, const symbol_entry *entr } /* otherwise, allocate a new entry */ - symbol = malloc(sizeof(*symbol)); + symbol = (internal_symbol_entry *)malloc(sizeof(*symbol)); if (!symbol) return 0; memset(symbol, 0, sizeof(*symbol)); /* allocate space for a copy of the string */ - newstring = malloc(strlen(name) + 1); + newstring = (char *)malloc(strlen(name) + 1); if (!newstring) { free(symbol); diff --git a/src/emu/debug/textbuf.c b/src/emu/debug/textbuf.c index 72c2681e7fd..3ad15b1b159 100644 --- a/src/emu/debug/textbuf.c +++ b/src/emu/debug/textbuf.c @@ -88,12 +88,12 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) text_buffer *text; /* allocate memory for the text buffer object */ - text = malloc(sizeof(*text)); + text = (text_buffer *)malloc(sizeof(*text)); if (!text) return NULL; /* allocate memory for the buffer itself */ - text->buffer = malloc(bytes); + text->buffer = (char *)malloc(bytes); if (!text->buffer) { free(text); @@ -101,7 +101,7 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) } /* allocate memory for the lines array */ - text->lineoffs = malloc(lines * sizeof(text->lineoffs[0])); + text->lineoffs = (INT32 *)malloc(lines * sizeof(text->lineoffs[0])); if (!text->lineoffs) { free(text->buffer); diff --git a/src/emu/debugger.c b/src/emu/debugger.c index c91c7901f2f..a6541e5237a 100644 --- a/src/emu/debugger.c +++ b/src/emu/debugger.c @@ -75,7 +75,7 @@ void debugger_init(running_machine *machine) /* allocate a new entry for our global list */ add_exit_callback(machine, debugger_exit); - entry = malloc_or_die(sizeof(*entry)); + entry = (machine_entry *)malloc_or_die(sizeof(*entry)); entry->next = machine_list; entry->machine = machine; machine_list = entry; diff --git a/src/emu/devcb.c b/src/emu/devcb.c index efe68e179f8..a9594a46e31 100644 --- a/src/emu/devcb.c +++ b/src/emu/devcb.c @@ -31,7 +31,7 @@ static READ_LINE_DEVICE_HANDLER( trampoline_read_port_to_read_line ) static READ_LINE_DEVICE_HANDLER( trampoline_read8_to_read_line ) { const devcb_resolved_read_line *resolved = (const devcb_resolved_read_line *)device; - return ((*resolved->real.readdevice)(resolved->realtarget, 0) & 1) ? ASSERT_LINE : CLEAR_LINE; + return ((*resolved->real.readdevice)((const device_config *)resolved->realtarget, 0) & 1) ? ASSERT_LINE : CLEAR_LINE; } void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_read_line *config, const device_config *device) @@ -95,13 +95,13 @@ void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_rea static WRITE_LINE_DEVICE_HANDLER( trampoline_write8_to_write_line ) { const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device; - (*resolved->real.writedevice)(resolved->realtarget, 0, state); + (*resolved->real.writedevice)((const device_config *)resolved->realtarget, 0, state); } static WRITE_LINE_DEVICE_HANDLER( trampoline_writecpu_to_write_line ) { const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device; - const device_config *cpu = resolved->realtarget; + const device_config *cpu = (const device_config *)resolved->realtarget; cpu_set_input_line(cpu, resolved->real.writeline, state ? ASSERT_LINE : CLEAR_LINE); } @@ -176,7 +176,7 @@ static READ8_DEVICE_HANDLER( trampoline_read_port_to_read8 ) static READ8_DEVICE_HANDLER( trampoline_read_line_to_read8 ) { const devcb_resolved_read8 *resolved = (const devcb_resolved_read8 *)device; - return (*resolved->real.readline)(resolved->realtarget); + return (*resolved->real.readline)((const device_config *)resolved->realtarget); } void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *config, const device_config *device) @@ -238,7 +238,7 @@ void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *conf static WRITE8_DEVICE_HANDLER( trampoline_write_line_to_write8 ) { const devcb_resolved_write8 *resolved = (const devcb_resolved_write8 *)device; - (*resolved->real.writeline)(resolved->realtarget, (data & 1) ? ASSERT_LINE : CLEAR_LINE); + (*resolved->real.writeline)((const device_config *)resolved->realtarget, (data & 1) ? ASSERT_LINE : CLEAR_LINE); } void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *config, const device_config *device) diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index fe290ff995d..7f115a913eb 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -111,7 +111,7 @@ device_config *device_list_add(device_config **listheadptr, const device_config configlen = (UINT32)devtype_get_info_int(type, DEVINFO_INT_INLINE_CONFIG_BYTES); /* allocate a new device */ - device = malloc_or_die(sizeof(*device) + strlen(tag) + configlen); + device = (device_config *)malloc_or_die(sizeof(*device) + strlen(tag) + configlen); /* populate device relationships */ device->next = NULL; @@ -121,7 +121,7 @@ device_config *device_list_add(device_config **listheadptr, const device_config /* populate device properties */ device->type = type; - device->devclass = devtype_get_info_int(type, DEVINFO_INT_CLASS); + device->devclass = (device_class)(INT32)devtype_get_info_int(type, DEVINFO_INT_CLASS); device->set_info = (device_set_info_func)devtype_get_info_fct(type, DEVINFO_FCT_SET_INFO); device->execute = NULL; diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index 0f79adeac4d..732f5fa9523 100644 --- a/src/emu/drawgfx.c +++ b/src/emu/drawgfx.c @@ -90,7 +90,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c gfx_element *gfx; /* allocate memory for the gfx_element structure */ - gfx = malloc_or_die(sizeof(*gfx)); + gfx = (gfx_element *)malloc_or_die(sizeof(*gfx)); memset(gfx, 0, sizeof(*gfx)); /* fill in the data */ @@ -120,7 +120,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c } else { - UINT32 *buffer = malloc_or_die(sizeof(buffer[0]) * gfx->layout.width); + UINT32 *buffer = (UINT32 *)malloc_or_die(sizeof(buffer[0]) * gfx->layout.width); memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width); gfx->layout.extxoffs = buffer; } @@ -135,7 +135,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c } else { - UINT32 *buffer = malloc_or_die(sizeof(buffer[0]) * gfx->layout.height); + UINT32 *buffer = (UINT32 *)malloc_or_die(sizeof(buffer[0]) * gfx->layout.height); memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height); gfx->layout.extyoffs = buffer; } @@ -143,10 +143,10 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c /* allocate a pen usage array for entries with 32 pens or less */ if (gfx->color_depth <= 32) - gfx->pen_usage = malloc_or_die(gfx->total_elements * sizeof(*gfx->pen_usage)); + gfx->pen_usage = (UINT32 *)malloc_or_die(gfx->total_elements * sizeof(*gfx->pen_usage)); /* allocate a dirty array */ - gfx->dirty = malloc_or_die(gfx->total_elements * sizeof(*gfx->dirty)); + gfx->dirty = (UINT8 *)malloc_or_die(gfx->total_elements * sizeof(*gfx->dirty)); memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty)); /* raw graphics case */ @@ -173,7 +173,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c gfx->char_modulo = gfx->line_modulo * gfx->origheight; /* allocate memory for the data */ - gfx->gfxdata = malloc_or_die(gfx->total_elements * gfx->char_modulo); + gfx->gfxdata = (UINT8 *)malloc_or_die(gfx->total_elements * gfx->char_modulo); } return gfx; diff --git a/src/emu/driver.c b/src/emu/driver.c index a50e3ef915a..d28094e66ee 100644 --- a/src/emu/driver.c +++ b/src/emu/driver.c @@ -114,7 +114,7 @@ void driver_list_get_approx_matches(const game_driver * const driverlist[], cons int shufnum; /* allocate a temporary list */ - templist = malloc_or_die(driver_list_get_count(driverlist) * sizeof(*templist)); + templist = (const game_driver **)malloc_or_die(driver_list_get_count(driverlist) * sizeof(*templist)); /* build up a list of valid entries */ for (drvnum = driver_count = 0; driverlist[drvnum] != NULL; drvnum++) @@ -145,7 +145,7 @@ void driver_list_get_approx_matches(const game_driver * const driverlist[], cons } /* allocate some temp memory */ - penalty = malloc_or_die(matches * sizeof(*penalty)); + penalty = (int *)malloc_or_die(matches * sizeof(*penalty)); /* initialize everyone's states */ for (matchnum = 0; matchnum < matches; matchnum++) diff --git a/src/emu/emupal.c b/src/emu/emupal.c index a9cf183e832..02268a67738 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -95,14 +95,14 @@ static void configure_rgb_shadows(running_machine *machine, int mode, float fact void palette_init(running_machine *machine) { - int format; - palette_private *palette = auto_malloc(sizeof(*palette)); + palette_private *palette = (palette_private *)auto_malloc(sizeof(*palette)); const device_config *device = video_screen_first(machine->config); + bitmap_format format; /* get the format from the first screen, or use BITMAP_FORMAT_INVALID, if screenless */ if (device != NULL) { - screen_config *config = device->inline_config; + screen_config *config = (screen_config *)device->inline_config; format = config->format; } else @@ -146,8 +146,8 @@ void palette_init(running_machine *machine) /* set up save/restore of the palette */ numcolors = palette_get_num_colors(machine->palette); - palette->save_pen = auto_malloc(sizeof(*palette->save_pen) * numcolors); - palette->save_bright = auto_malloc(sizeof(*palette->save_bright) * numcolors); + palette->save_pen = (pen_t *)auto_malloc(sizeof(*palette->save_pen) * numcolors); + palette->save_bright = (float *)auto_malloc(sizeof(*palette->save_bright) * numcolors); state_save_register_global_pointer(machine, palette->save_pen, numcolors); state_save_register_global_pointer(machine, palette->save_bright, numcolors); state_save_register_presave(machine, palette_presave, palette); @@ -330,7 +330,7 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) assert(palettesize > 0); /* allocate the colortable */ - ctable = auto_malloc(sizeof(*ctable)); + ctable = (colortable_t *)auto_malloc(sizeof(*ctable)); memset(ctable, 0, sizeof(*ctable)); /* fill in the basics */ @@ -339,13 +339,13 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) ctable->palentries = palettesize; /* allocate the raw colortable */ - ctable->raw = auto_malloc(ctable->entries * sizeof(*ctable->raw)); + ctable->raw = (UINT16 *)auto_malloc(ctable->entries * sizeof(*ctable->raw)); for (index = 0; index < ctable->entries; index++) ctable->raw[index] = index % ctable->palentries; state_save_register_global_pointer(machine, ctable->raw, ctable->entries); /* allocate the palette */ - ctable->palette = auto_malloc(ctable->palentries * sizeof(*ctable->palette)); + ctable->palette = (rgb_t *)auto_malloc(ctable->palentries * sizeof(*ctable->palette)); for (index = 0; index < ctable->palentries; index++) ctable->palette[index] = MAKE_ARGB(0x80,0xff,0xff,0xff); state_save_register_global_pointer(machine, ctable->palette, ctable->palentries); @@ -536,7 +536,7 @@ pen_t get_white_pen(running_machine *machine) static void palette_presave(running_machine *machine, void *param) { int numcolors = palette_get_num_colors(machine->palette); - palette_private *palette = param; + palette_private *palette = (palette_private *)param; int index; /* fill the save arrays with updated pen and brightness information */ @@ -556,7 +556,7 @@ static void palette_presave(running_machine *machine, void *param) static void palette_postload(running_machine *machine, void *param) { int numcolors = palette_get_num_colors(machine->palette); - palette_private *palette = param; + palette_private *palette = (palette_private *)param; int index; /* reset the pen and brightness for each entry */ @@ -660,7 +660,7 @@ static void allocate_color_tables(running_machine *machine, palette_private *pal { case BITMAP_FORMAT_INDEXED16: /* create a dummy 1:1 mapping */ - machine->pens = pentable = auto_malloc((total_colors + 2) * sizeof(machine->pens[0])); + machine->pens = pentable = (pen_t *)auto_malloc((total_colors + 2) * sizeof(machine->pens[0])); for (i = 0; i < total_colors + 2; i++) pentable[i] = i; break; @@ -690,7 +690,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa /* if we have shadows, allocate shadow tables */ if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) { - pen_t *table = auto_malloc(65536 * sizeof(*table)); + pen_t *table = (pen_t *)auto_malloc(65536 * sizeof(*table)); int i; /* palettized mode gets a single 64k table in slots 0 and 2 */ @@ -713,7 +713,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa /* if we have hilights, allocate shadow tables */ if (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS) { - pen_t *table = auto_malloc(65536 * sizeof(*table)); + pen_t *table = (pen_t *)auto_malloc(65536 * sizeof(*table)); int i; /* palettized mode gets a single 64k table in slots 1 and 3 */ diff --git a/src/emu/fileio.c b/src/emu/fileio.c index 886e9afec52..85bc2938e86 100644 --- a/src/emu/fileio.c +++ b/src/emu/fileio.c @@ -181,7 +181,7 @@ file_error mame_fopen_ram(const void *data, UINT32 length, UINT32 openflags, mam file_error filerr; /* allocate the file itself */ - *file = malloc(sizeof(**file)); + *file = (mame_file *)malloc(sizeof(**file)); if (*file == NULL) return FILERR_OUT_OF_MEMORY; @@ -222,7 +222,7 @@ static file_error fopen_internal(core_options *opts, const char *searchpath, con return FILERR_INVALID_ACCESS; /* allocate the file itself */ - *file = malloc(sizeof(**file)); + *file = (mame_file *)malloc(sizeof(**file)); if (*file == NULL) return FILERR_OUT_OF_MEMORY; @@ -651,7 +651,7 @@ mame_path *mame_openpath(core_options *opts, const char *searchpath) mame_path *path; /* allocate a new mame_path */ - path = malloc(sizeof(*path)); + path = (mame_path *)malloc(sizeof(*path)); if (path == NULL) return NULL; memset(path, 0, sizeof(*path)); @@ -779,7 +779,7 @@ const char *mame_fhash(mame_file *file, UINT32 functions) return file->hash; /* read the data if we can */ - filedata = core_fbuffer(file->file); + filedata = (const UINT8 *)core_fbuffer(file->file); if (filedata == NULL) return file->hash; @@ -853,7 +853,7 @@ static file_error load_zipped_file(mame_file *file) assert(file->zipfile != NULL); /* allocate some memory */ - file->zipdata = malloc(file->ziplength); + file->zipdata = (UINT8 *)malloc(file->ziplength); if (file->zipdata == NULL) return FILERR_OUT_OF_MEMORY; diff --git a/src/emu/hash.c b/src/emu/hash.c index b25c257c76a..bdf8fbb519e 100644 --- a/src/emu/hash.c +++ b/src/emu/hash.c @@ -459,7 +459,7 @@ int hash_data_extract_binary_checksum(const char* data, unsigned int function, u int hash_data_has_info(const char* data, unsigned int info) { - char* res = strstr(data, info_strings[info]); + char* res = (char*)strstr(data, info_strings[info]); if (!res) return 0; diff --git a/src/emu/info.c b/src/emu/info.c index 3cfeafd09f7..4e3db372620 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -601,7 +601,7 @@ static void print_game_display(FILE *out, const game_driver *game, const machine /* iterate over screens */ for (screen = video_screen_first(config); screen != NULL; screen = video_screen_next(screen)) { - const screen_config *scrconfig = screen->inline_config; + const screen_config *scrconfig = (const screen_config *)screen->inline_config; fprintf(out, "\t\tinput_port_data = auto_malloc(sizeof(*machine->input_port_data)); + machine->input_port_data = (input_port_private *)auto_malloc(sizeof(*machine->input_port_data)); memset(machine->input_port_data, 0, sizeof(*machine->input_port_data)); portdata = machine->input_port_data; @@ -857,7 +857,7 @@ void input_field_set_user_settings(const input_field_config *field, const input_ /* copy the basics */ for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++) { - const input_seq *defseq = input_type_seq(field->port->machine, field->type, field->player, seqtype); + const input_seq *defseq = input_type_seq(field->port->machine, field->type, field->player, (input_seq_type)seqtype); if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0) field->state->seq[seqtype] = default_seq; else @@ -1500,7 +1500,7 @@ static void init_port_types(running_machine *machine) for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++) { /* allocate memory for the state and link it to the end of the list */ - *stateptr = auto_malloc(sizeof(**stateptr)); + *stateptr = (input_type_state *)auto_malloc(sizeof(**stateptr)); memset(*stateptr, 0, sizeof(**stateptr)); /* copy the type description and link the previous description to it */ @@ -1550,7 +1550,7 @@ static void init_port_state(running_machine *machine) input_port_state *portstate; /* allocate a new input_port_info structure */ - portstate = auto_malloc(sizeof(*portstate)); + portstate = (input_port_state *)auto_malloc(sizeof(*portstate)); memset(portstate, 0, sizeof(*portstate)); ((input_port_config *)port)->state = portstate; ((input_port_config *)port)->machine = machine; @@ -1567,7 +1567,7 @@ static void init_port_state(running_machine *machine) int seqtype; /* allocate a new input_field_info structure */ - fieldstate = auto_malloc(sizeof(*fieldstate)); + fieldstate = (input_field_state *)auto_malloc(sizeof(*fieldstate)); memset(fieldstate, 0, sizeof(*fieldstate)); ((input_field_config *)field)->state = fieldstate; @@ -1714,7 +1714,7 @@ static callback_field_info *init_field_callback_info(const input_field_config *f input_port_value mask; /* allocate memory */ - info = auto_malloc(sizeof(*info)); + info = (callback_field_info *)auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); /* fill in the data */ @@ -1737,7 +1737,7 @@ static analog_field_state *init_field_analog_state(const input_field_config *fie input_port_value mask; /* allocate memory */ - state = auto_malloc(sizeof(*state)); + state = (analog_field_state *)auto_malloc(sizeof(*state)); memset(state, 0, sizeof(*state)); /* compute the shift amount and number of bits */ @@ -2403,7 +2403,7 @@ static input_port_config *port_config_detokenize(input_port_config *listhead, co TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); if (curport == NULL) - return error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FIELD encountered with no active port (mask=%X defval=%X)\n", mask, defval); + return (input_port_config *)error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FIELD encountered with no active port (mask=%X defval=%X)\n", mask, defval); if (curfield != NULL) field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); @@ -2953,7 +2953,7 @@ static input_port_config *port_config_alloc(const input_port_config **listhead) input_port_config *config; /* allocate memory */ - config = malloc_or_die(sizeof(*config)); + config = (input_port_config *)malloc_or_die(sizeof(*config)); memset(config, 0, sizeof(*config)); /* add it to the tail */ @@ -3015,7 +3015,7 @@ static input_field_config *field_config_alloc(input_port_config *port, int type, int seqtype; /* allocate memory */ - config = malloc_or_die(sizeof(*config)); + config = (input_field_config *)malloc_or_die(sizeof(*config)); memset(config, 0, sizeof(*config)); /* fill in the basic field values */ @@ -3123,7 +3123,7 @@ static input_setting_config *setting_config_alloc(input_field_config *field, inp input_setting_config *config; /* allocate memory */ - config = malloc_or_die(sizeof(*config)); + config = (input_setting_config *)malloc_or_die(sizeof(*config)); memset(config, 0, sizeof(*config)); /* fill in the basic setting values */ @@ -3183,7 +3183,7 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c const char *comma, *colon, *number; /* allocate a new entry */ - *tailptr = malloc_or_die(sizeof(**tailptr)); + *tailptr = (input_field_diplocation *)malloc_or_die(sizeof(**tailptr)); memset(*tailptr, 0, sizeof(**tailptr)); entries++; @@ -3203,7 +3203,7 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c /* allocate and copy the name if it is present */ if (colon != NULL) { - (*tailptr)->swname = lastname = malloc_or_die(colon - tempbuf + 1); + (*tailptr)->swname = lastname = (char *)malloc_or_die(colon - tempbuf + 1); strncpy(lastname, tempbuf, colon - tempbuf); lastname[colon - tempbuf] = 0; number = colon + 1; @@ -3218,7 +3218,7 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c error_buf_append(errorbuf, errorbuflen, "Switch location '%s' missing switch name!\n", location); lastname = (char *)"UNK"; } - (*tailptr)->swname = namecopy = malloc_or_die(strlen(lastname) + 1); + (*tailptr)->swname = namecopy = (char *)malloc_or_die(strlen(lastname) + 1); strcpy(namecopy, lastname); } @@ -3450,8 +3450,8 @@ static void load_remap_table(running_machine *machine, xml_data_node *parentnode int remapnum; /* allocate tables */ - oldtable = malloc_or_die(count * sizeof(*oldtable)); - newtable = malloc_or_die(count * sizeof(*newtable)); + oldtable = (input_code *)malloc_or_die(count * sizeof(*oldtable)); + newtable = (input_code *)malloc_or_die(count * sizeof(*newtable)); /* build up the remap table */ count = 0; diff --git a/src/emu/inptport.h b/src/emu/inptport.h index a53a55e44be..9e1b939c716 100644 --- a/src/emu/inptport.h +++ b/src/emu/inptport.h @@ -59,6 +59,7 @@ enum _input_seq_type SEQ_TYPE_TOTAL }; typedef enum _input_seq_type input_seq_type; +DECLARE_ENUM_OPERATORS(input_seq_type) /* conditions for DIP switches */ diff --git a/src/emu/input.c b/src/emu/input.c index 1aa74c847b9..61e404c66b2 100644 --- a/src/emu/input.c +++ b/src/emu/input.c @@ -677,7 +677,7 @@ static void input_frame(running_machine *machine) int changed = FALSE; /* update the state of all the keys and see if any changed state */ - for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++) + for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++) { input_device_item *item = device->item[itemid]; if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH) @@ -695,7 +695,7 @@ static void input_frame(running_machine *machine) } /* if the keyboard state is stable, copy it over */ - for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++) + for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++) { input_device_item *item = device->item[itemid]; if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH) @@ -729,7 +729,7 @@ input_device *input_device_add(running_machine *machine, input_device_class devc assert(devclass != DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM); /* allocate a new device */ - devlist->list = auto_realloc(devlist->list, (devlist->count + 1) * sizeof(devlist->list[0])); + devlist->list = (input_device *)auto_realloc(devlist->list, (devlist->count + 1) * sizeof(devlist->list[0])); device = &devlist->list[devlist->count++]; memset(device, 0, sizeof(*device)); @@ -769,7 +769,7 @@ void input_device_item_add(input_device *device, const char *name, void *interna /* if we have a generic ID, pick a new internal one */ if (itemid >= ITEM_ID_OTHER_SWITCH && itemid <= ITEM_ID_OTHER_AXIS_RELATIVE) - for (itemid = ITEM_ID_MAXIMUM + 1; itemid <= ITEM_ID_ABSOLUTE_MAXIMUM; itemid++) + for (itemid = (input_item_id)(ITEM_ID_MAXIMUM + 1); itemid <= ITEM_ID_ABSOLUTE_MAXIMUM; itemid++) if (device->item[itemid] == NULL) break; assert(itemid <= ITEM_ID_ABSOLUTE_MAXIMUM); @@ -778,7 +778,7 @@ void input_device_item_add(input_device *device, const char *name, void *interna assert(device->item[itemid] == NULL); /* allocate a new item and copy data into it */ - item = auto_malloc(sizeof(*item)); + item = (input_device_item *)auto_malloc(sizeof(*item)); memset(item, 0, sizeof(*item)); device->item[itemid] = item; device->maxitem = MAX(device->maxitem, itemid); @@ -947,7 +947,7 @@ input_code input_code_from_input_item_id(input_item_id itemid) input_device_class devclass; /* iterate over device classes and devices */ - for (devclass = DEVICE_CLASS_INVALID + 1; devclass < DEVICE_CLASS_MAXIMUM; devclass++) + for (devclass = DEVICE_CLASS_FIRST_VALID; devclass < DEVICE_CLASS_MAXIMUM; devclass++) { input_device_list *devlist = &device_list[devclass]; int devnum; @@ -977,7 +977,7 @@ input_code input_code_poll_switches(int reset) code_pressed_memory_reset(); /* iterate over device classes and devices */ - for (devclass = DEVICE_CLASS_INVALID + 1; devclass < DEVICE_CLASS_MAXIMUM; devclass++) + for (devclass = DEVICE_CLASS_FIRST_VALID; devclass < DEVICE_CLASS_MAXIMUM; devclass++) { input_device_list *devlist = &device_list[devclass]; int devnum; @@ -989,7 +989,7 @@ input_code input_code_poll_switches(int reset) input_item_id itemid; /* iterate over items within each device */ - for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++) + for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++) { input_device_item *item = device->item[itemid]; if (item != NULL) @@ -1072,7 +1072,7 @@ input_code input_code_poll_keyboard_switches(int reset) input_item_id itemid; /* iterate over items within each device */ - for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++) + for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++) { input_device_item *item = device->item[itemid]; if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH) @@ -1098,7 +1098,7 @@ input_code input_code_poll_axes(int reset) input_device_class devclass; /* iterate over device classes and devices */ - for (devclass = DEVICE_CLASS_INVALID + 1; devclass < DEVICE_CLASS_MAXIMUM; devclass++) + for (devclass = DEVICE_CLASS_FIRST_VALID; devclass < DEVICE_CLASS_MAXIMUM; devclass++) { input_device_list *devlist = &device_list[devclass]; int devnum; @@ -1110,7 +1110,7 @@ input_code input_code_poll_axes(int reset) input_item_id itemid; /* iterate over items within each device */ - for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++) + for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++) { input_device_item *item = device->item[itemid]; if (item != NULL) @@ -1292,7 +1292,7 @@ input_code input_code_from_token(const char *_token) for (numtokens = 0; numtokens < ARRAY_LENGTH(token); ) { /* make a token up to the next underscore */ - char *score = strchr(_token, '_'); + char *score = (char *)strchr(_token, '_'); token[numtokens++] = astring_dupch(_token, (score == NULL) ? strlen(_token) : (score - _token)); /* if we hit the end, we're done, else advance our pointer */ @@ -1323,7 +1323,7 @@ input_code input_code_from_token(const char *_token) /* if we're a standard code, default the itemclass based on it */ if (standard) - itemclass = input_item_standard_class(devclass, itemid); + itemclass = input_item_standard_class((input_device_class)devclass, (input_item_id)itemid); /* otherwise, keep parsing */ else @@ -1336,7 +1336,7 @@ input_code input_code_from_token(const char *_token) device = &device_list[devclass].list[devindex]; /* if not a standard code, look it up in the device specific codes */ - for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++) + for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++) { input_device_item *item = device->item[itemid]; if (item != NULL && item->token != NULL && astring_cmp(token[curtok], item->token) == 0) diff --git a/src/emu/input.h b/src/emu/input.h index 06a6f874479..04d0c2e7452 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -74,13 +74,15 @@ enum _input_device_class { DEVICE_CLASS_INVALID, - DEVICE_CLASS_KEYBOARD, + DEVICE_CLASS_FIRST_VALID, + DEVICE_CLASS_KEYBOARD = DEVICE_CLASS_FIRST_VALID, DEVICE_CLASS_MOUSE, DEVICE_CLASS_LIGHTGUN, DEVICE_CLASS_JOYSTICK, DEVICE_CLASS_MAXIMUM }; typedef enum _input_device_class input_device_class; +DECLARE_ENUM_OPERATORS(input_device_class) /* input item classes */ @@ -114,9 +116,10 @@ typedef enum _input_item_modifier input_item_modifier; enum _input_item_id { ITEM_ID_INVALID, + ITEM_ID_FIRST_VALID, /* standard keyboard IDs */ - ITEM_ID_A, + ITEM_ID_A = ITEM_ID_FIRST_VALID, ITEM_ID_B, ITEM_ID_C, ITEM_ID_D, @@ -334,6 +337,7 @@ enum _input_item_id ITEM_ID_ABSOLUTE_MAXIMUM = 0xfff }; typedef enum _input_item_id input_item_id; +DECLARE_ENUM_OPERATORS(input_item_id) /* expanded codes referencing specific devices for input definitions */ diff --git a/src/emu/inputseq.c b/src/emu/inputseq.c index 30e1f869bee..b136ea4b8f8 100644 --- a/src/emu/inputseq.c +++ b/src/emu/inputseq.c @@ -361,7 +361,7 @@ int input_seq_poll(input_seq *finalseq) { /* increment the modifier, wrapping back to none */ input_item_modifier oldmod = INPUT_CODE_MODIFIER(lastcode); - input_item_modifier newmod = (oldmod < ITEM_MODIFIER_NEG) ? oldmod + 1 : ITEM_MODIFIER_NONE; + input_item_modifier newmod = (oldmod < ITEM_MODIFIER_NEG) ? (input_item_modifier)(oldmod + 1) : ITEM_MODIFIER_NONE; newcode = INPUT_CODE_SET_MODIFIER(newcode, newmod); /* back up over the previous code so we can re-append */ @@ -511,7 +511,7 @@ astring *input_seq_to_tokens(astring *string, const input_seq *seq) int input_seq_from_tokens(const char *string, input_seq *seq) { - char *strcopy = malloc_or_die(strlen(string) + 1); + char *strcopy = (char *)malloc_or_die(strlen(string) + 1); char *str = strcopy; int result = FALSE; diff --git a/src/emu/machine/6522via.c b/src/emu/machine/6522via.c index 1a9377f5ddf..0c49a44d6e1 100644 --- a/src/emu/machine/6522via.c +++ b/src/emu/machine/6522via.c @@ -380,7 +380,7 @@ static void via_shift(const device_config *device) static TIMER_CALLBACK( via_shift_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; via_shift(device); } @@ -391,7 +391,7 @@ static TIMER_CALLBACK( via_shift_callback ) static TIMER_CALLBACK( via_t1_timeout ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; via6522_t *v = get_token(device); if (T1_CONTINUOUS (v->acr)) @@ -424,7 +424,7 @@ static TIMER_CALLBACK( via_t1_timeout ) static TIMER_CALLBACK( via_t2_timeout ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; via6522_t *v = get_token(device); v->t2_active = 0; diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index 685eba1c042..fa29e33d11c 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -448,7 +448,7 @@ static void cia_timer_underflow(const device_config *device, int timer) static TIMER_CALLBACK( cia_timer_proc ) { - cia_timer *timer = ptr; + cia_timer *timer = (cia_timer *)ptr; cia_state *cia = timer->cia; cia_timer_underflow(cia->device, timer - cia->timer); @@ -554,7 +554,7 @@ void cia_clock_tod(const device_config *device) static TIMER_CALLBACK( cia_clock_tod_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; cia_clock_tod(device); } diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 2a5ee74486f..f9fdccadf98 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -166,7 +166,7 @@ INLINE UINT8 get_timer(riot6532_state *riot) static TIMER_CALLBACK( timer_end_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; riot6532_state *riot = get_safe_token(device); assert(riot->timerstate != TIMER_IDLE); @@ -434,7 +434,7 @@ static DEVICE_START( riot6532 ) /* set static values */ riot->device = device; - riot->intf = device->static_config; + riot->intf = (riot6532_interface *)device->static_config; riot->index = device_list_index(device->machine->config->devicelist, RIOT6532, device->tag); /* configure the ports */ diff --git a/src/emu/machine/6840ptm.c b/src/emu/machine/6840ptm.c index d5f4faa8c6b..010d81232d6 100644 --- a/src/emu/machine/6840ptm.c +++ b/src/emu/machine/6840ptm.c @@ -355,7 +355,7 @@ static void reload_count(running_machine *machine, int which, int idx) if (idx == 2) duration = attotime_mul(duration, currptr->t3_divisor); PLOG(("MC6840 #%d: reload_count(%d): output = %lf\n", which, idx, attotime_to_double(duration))); - if (!currptr->control_reg[idx] & 0x02) + if (!(currptr->control_reg[idx] & 0x02)) { if (!currptr->intf->external_clock[idx]) { @@ -739,7 +739,7 @@ void ptm6840_set_ext_clock(int which, int counter, int clock) ptm6840 *currptr = ptm + which; currptr->external_clock[counter] = clock; - if (!currptr->control_reg[counter] & 0x02) + if (!(currptr->control_reg[counter] & 0x02)) { if (!currptr->intf->external_clock[counter]) { diff --git a/src/emu/machine/6850acia.c b/src/emu/machine/6850acia.c index 5a6ef84c82b..efc1927eb53 100644 --- a/src/emu/machine/6850acia.c +++ b/src/emu/machine/6850acia.c @@ -39,12 +39,13 @@ enum serial_state STOP2, }; -enum parity_type +enum _parity_type { NONE, ODD, EVEN }; +typedef enum _parity_type parity_type; typedef struct _acia6850_t acia6850_t; struct _acia6850_t @@ -80,7 +81,7 @@ struct _acia6850_t /* TX/RX state */ int bits; - enum parity_type parity; + parity_type parity; int stopbits; int tx_int; @@ -295,7 +296,7 @@ WRITE8_DEVICE_HANDLER( acia6850_ctrl_w ) wordsel = (data & CR4_2) >> 2; acia_p->bits = ACIA6850_WORD[wordsel][0]; - acia_p->parity = ACIA6850_WORD[wordsel][1]; + acia_p->parity = (parity_type)ACIA6850_WORD[wordsel][1]; acia_p->stopbits = ACIA6850_WORD[wordsel][2]; // Transmitter Control Bits @@ -565,7 +566,7 @@ static void tx_tick(const device_config *device) static TIMER_CALLBACK( transmit_event ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; acia6850_t *acia_p = get_token(device); tx_tick(device); acia_p->tx_counter = 0; @@ -756,7 +757,7 @@ static void rx_tick(const device_config *device) static TIMER_CALLBACK( receive_event ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; acia6850_t *acia_p = get_token(device); rx_tick(device); acia_p->rx_counter = 0; diff --git a/src/emu/machine/68681.c b/src/emu/machine/68681.c index d9f5e773a53..de614a0753f 100644 --- a/src/emu/machine/68681.c +++ b/src/emu/machine/68681.c @@ -120,7 +120,7 @@ static void duart68681_update_interrupts(duart68681_state *duart68681) static TIMER_CALLBACK( duart_timer_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; duart68681_state *duart68681 = get_safe_token(device); duart68681->ISR |= INT_COUNTER_READY; @@ -275,7 +275,7 @@ static UINT8 duart68681_read_rx_fifo(duart68681_state *duart68681, int ch) static TIMER_CALLBACK( tx_timer_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; duart68681_state *duart68681 = get_safe_token(device); int ch = param & 1; @@ -592,7 +592,7 @@ static DEVICE_RESET(duart68681) duart68681_state *duart68681 = get_safe_token(device); memset(duart68681, 0, sizeof(duart68681_state)); - duart68681->duart_config = device->static_config; + duart68681->duart_config = (const duart68681_config *)device->static_config; duart68681->device = device; duart68681->IVR = 0x0f; diff --git a/src/emu/machine/74123.c b/src/emu/machine/74123.c index 4df4d98ca30..fbffdede487 100644 --- a/src/emu/machine/74123.c +++ b/src/emu/machine/74123.c @@ -73,7 +73,7 @@ static int timer_running(ttl74123_t *chip) static TIMER_CALLBACK( output_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; ttl74123_t *chip = get_safe_token(device); chip->intf->output_changed_cb(device, 0, param); @@ -93,7 +93,7 @@ static void set_output(const device_config *device) static TIMER_CALLBACK( clear_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; ttl74123_t *chip = get_safe_token(device); int output = timer_running(chip); @@ -191,7 +191,7 @@ static DEVICE_START( ttl74123 ) ttl74123_t *chip = get_safe_token(device); /* validate arguments */ - chip->intf = device->static_config; + chip->intf = (ttl74123_config *)device->static_config; assert_always(chip->intf, "No interface specified"); assert_always((chip->intf->connection_type != TTL74123_GROUNDED) || (chip->intf->cap >= CAP_U(0.01)), "Only capacitors >= 0.01uF supported for GROUNDED type"); diff --git a/src/emu/machine/8237dma.c b/src/emu/machine/8237dma.c index 2a2aefcc764..c2574abe67d 100644 --- a/src/emu/machine/8237dma.c +++ b/src/emu/machine/8237dma.c @@ -114,7 +114,7 @@ static int dma8237_do_operation(const device_config *device, int channel) static TIMER_CALLBACK( dma8237_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; dma8237_t *dma8237 = get_safe_token(device); int channel = param % 4; int done; @@ -134,7 +134,7 @@ static TIMER_CALLBACK( dma8237_timerproc ) static TIMER_CALLBACK( dma8237_msbflip_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; dma8237_t *dma8237 = get_safe_token(device); dma8237->msb ^= 1; } @@ -394,7 +394,7 @@ void dma8237_run_transfer(const device_config *device, int channel) static DEVICE_START( dma8237 ) { dma8237_t *dma8237 = get_safe_token(device); - dma8237->intf = device->static_config; + dma8237->intf = (struct dma8237_interface *)device->static_config; } diff --git a/src/emu/machine/8255ppi.c b/src/emu/machine/8255ppi.c index 0d07e695a57..4cb6e80401c 100644 --- a/src/emu/machine/8255ppi.c +++ b/src/emu/machine/8255ppi.c @@ -501,7 +501,7 @@ UINT8 ppi8255_get_port_c( const device_config *device ) { static DEVICE_START( ppi8255 ) { ppi8255_t *ppi8255 = get_safe_token(device); - ppi8255->intf = device->static_config; + ppi8255->intf = (const ppi8255_interface *)device->static_config; devcb_resolve_read8(&ppi8255->port_read[0], &ppi8255->intf->port_a_read, device); devcb_resolve_read8(&ppi8255->port_read[1], &ppi8255->intf->port_b_read, device); diff --git a/src/emu/machine/8257dma.c b/src/emu/machine/8257dma.c index 1415ad65d69..e8b73a8dde9 100644 --- a/src/emu/machine/8257dma.c +++ b/src/emu/machine/8257dma.c @@ -153,7 +153,7 @@ static int dma8257_do_operation(const device_config *device, int channel) static TIMER_CALLBACK( dma8257_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; dma8257_t *dma8257 = get_safe_token(device); int i, channel = 0, rr; int done; @@ -186,7 +186,7 @@ static TIMER_CALLBACK( dma8257_timerproc ) static TIMER_CALLBACK( dma8257_msbflip_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; dma8257_t *dma8257 = get_safe_token(device); dma8257->msb ^= 1; } @@ -324,7 +324,7 @@ WRITE8_DEVICE_HANDLER( dma8257_w ) static TIMER_CALLBACK( dma8257_drq_write_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; dma8257_t *dma8257 = get_safe_token(device); int channel = param >> 1; int state = param & 0x01; @@ -368,7 +368,7 @@ static DEVICE_START( dma8257 ) assert(device->tag != NULL); //dma8257->device_type = device_type; - dma8257->intf = device->static_config; + dma8257->intf = (dma8257_interface *)device->static_config; dma8257->status = 0x0f; dma8257->timer = timer_alloc(device->machine, dma8257_timerproc, (void *) device); diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c index 23250b500ea..7d5197b6503 100644 --- a/src/emu/machine/at28c16.c +++ b/src/emu/machine/at28c16.c @@ -137,15 +137,15 @@ static DEVICE_START(at28c16) assert(device->machine != NULL); assert(device->machine->config != NULL); - c->data = auto_malloc( SIZE_DATA ); - c->id = auto_malloc( SIZE_ID ); + c->data = (UINT8 *)auto_malloc( SIZE_DATA ); + c->id = (UINT8 *)auto_malloc( SIZE_ID ); c->a9_12v = 0; c->oe_12v = 0; c->last_write = -1; c->write_timer = timer_alloc(device->machine, write_finished, c ); c->default_data = device->region; - config = device->inline_config; + config = (const at28c16_config *)device->inline_config; if (config->id != NULL) c->default_id = memory_region( device->machine, config->id ); diff --git a/src/emu/machine/cdp1852.c b/src/emu/machine/cdp1852.c index b30eb8e9ee7..0b599b8b19e 100644 --- a/src/emu/machine/cdp1852.c +++ b/src/emu/machine/cdp1852.c @@ -75,7 +75,7 @@ static void set_sr_line(cdp1852_t *cdp1852, int level) static TIMER_CALLBACK( cdp1852_scan_tick ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; cdp1852_t *cdp1852 = get_safe_token(device); switch (cdp1852->mode) @@ -161,7 +161,7 @@ static DEVICE_START( cdp1852 ) devcb_resolve_write_line(&cdp1852->out_sr_func, &intf->out_sr_func, device); /* set initial values */ - cdp1852->mode = intf->mode; + cdp1852->mode = (cdp1852_mode)intf->mode; if (device->clock > 0) { diff --git a/src/emu/machine/cdp1852.h b/src/emu/machine/cdp1852.h index ace42f1f4a7..30233048677 100644 --- a/src/emu/machine/cdp1852.h +++ b/src/emu/machine/cdp1852.h @@ -49,11 +49,11 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef enum _cdp1852_mode cdp1852_mode; enum _cdp1852_mode { CDP1852_MODE_INPUT = 0, CDP1852_MODE_OUTPUT }; +typedef enum _cdp1852_mode cdp1852_mode; typedef struct _cdp1852_interface cdp1852_interface; struct _cdp1852_interface diff --git a/src/emu/machine/cr589.c b/src/emu/machine/cr589.c index acca8481835..538bde46ea3 100644 --- a/src/emu/machine/cr589.c +++ b/src/emu/machine/cr589.c @@ -20,7 +20,7 @@ static int cr589_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) { UINT8 *command; int commandLength; - SCSICr589 *our_this = SCSIThis( &SCSIClassCr589, scsiInstance ); + SCSICr589 *our_this = (SCSICr589 *)SCSIThis( &SCSIClassCr589, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch( command[ 0 ] ) @@ -48,7 +48,7 @@ static void cr589_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataLe { UINT8 *command; int commandLength; - SCSICr589 *our_this = SCSIThis( &SCSIClassCr589, scsiInstance ); + SCSICr589 *our_this = (SCSICr589 *)SCSIThis( &SCSIClassCr589, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch( command[ 0 ] ) @@ -81,7 +81,7 @@ static void cr589_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL { UINT8 *command; int commandLength; - SCSICr589 *our_this = SCSIThis( &SCSIClassCr589, scsiInstance ); + SCSICr589 *our_this = (SCSICr589 *)SCSIThis( &SCSIClassCr589, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch( command[ 0 ] ) @@ -111,7 +111,7 @@ static void cr589_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL static void cr589_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { running_machine *machine = scsiInstance->machine; - SCSICr589 *our_this = SCSIThis( &SCSIClassCr589, scsiInstance ); + SCSICr589 *our_this = (SCSICr589 *)SCSIThis( &SCSIClassCr589, scsiInstance ); our_this->download = 0; memcpy( &our_this->buffer[ identity_offset ], "MATSHITACD-ROM CR-589 GS0N", 28 ); @@ -128,24 +128,24 @@ static int cr589_dispatch( int operation, void *file, INT64 intparm, void *ptrpa switch( operation ) { case SCSIOP_EXEC_COMMAND: - return cr589_exec_command( file, ptrparm ); + return cr589_exec_command( (SCSIInstance *)file, (UINT8 *)ptrparm ); case SCSIOP_READ_DATA: - cr589_read_data( file, ptrparm, intparm ); + cr589_read_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_WRITE_DATA: - cr589_write_data( file, ptrparm, intparm ); + cr589_write_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_ALLOC_INSTANCE: - params = ptrparm; - SCSIBase( &SCSIClassCr589, operation, file, intparm, ptrparm ); + params = (SCSIAllocInstanceParams *)ptrparm; + SCSIBase( &SCSIClassCr589, operation, (SCSIInstance *)file, intparm, (UINT8 *)ptrparm ); cr589_alloc_instance( params->instance, params->diskregion ); return 0; } - return SCSIBase( &SCSIClassCr589, operation, file, intparm, ptrparm ); + return SCSIBase( &SCSIClassCr589, operation, (SCSIInstance *)file, intparm, (UINT8 *)ptrparm ); } const SCSIClass SCSIClassCr589 = diff --git a/src/emu/machine/f3853.c b/src/emu/machine/f3853.c index 020b0685cd0..ca63905951d 100644 --- a/src/emu/machine/f3853.c +++ b/src/emu/machine/f3853.c @@ -83,7 +83,7 @@ static void f3853_timer_start(const device_config *device, UINT8 value) static TIMER_CALLBACK( f3853_timer_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; f3853_t *f3853 = get_safe_token( device ); if (f3853->timer_enable) @@ -167,7 +167,7 @@ static DEVICE_START( f3853 ) UINT8 reg=0xfe; int i; - f3853->config = device->static_config; + f3853->config = (const f3853_config *)device->static_config; for (i=254/*known to get 0xfe after 255 cycles*/; i>=0; i--) { diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index 776e6de9efb..fe8b4800fca 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -373,7 +373,7 @@ NVRAM_HANDLER( generic_randfill ) mame_fread(file, nvram_select(), generic_nvram_size); else { - UINT8 *nvram = nvram_select(); + UINT8 *nvram = (UINT8 *)nvram_select(); for (i = 0; i < generic_nvram_size; i++) nvram[i] = mame_rand(machine); } @@ -570,7 +570,7 @@ static void interrupt_reset(running_machine *machine) static TIMER_CALLBACK( clear_all_lines ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; int inputcount = cpu_get_input_lines(device); int line; @@ -587,7 +587,7 @@ static TIMER_CALLBACK( clear_all_lines ) static TIMER_CALLBACK( irq_pulse_clear ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; int irqline = param; cpu_set_input_line(device, irqline, CLEAR_LINE); } @@ -770,6 +770,6 @@ READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine); return 0x CUSTOM_INPUT( custom_port_read ) { - const char *tag = param; + const char *tag = (const char *)param; return input_port_read(field->port->machine, tag); } diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c index 1ce16b7d3c4..43cb3ca0ed1 100644 --- a/src/emu/machine/i2cmem.c +++ b/src/emu/machine/i2cmem.c @@ -86,12 +86,12 @@ void i2cmem_init( running_machine *machine, int chip, int slave_address, int pag if( data == NULL ) { - data = auto_malloc( data_size ); + data = (unsigned char *)auto_malloc( data_size ); } if( page_size > 0 ) { - page = auto_malloc( page_size ); + page = (unsigned char *)auto_malloc( page_size ); } c->slave_address = slave_address; diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index 1d0012a9b20..6a31eb16409 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -196,7 +196,7 @@ INLINE ide_state *get_safe_token(const device_config *device) INLINE void signal_interrupt(ide_state *ide) { - const ide_config *config = ide->device->inline_config; + const ide_config *config = (const ide_config *)ide->device->inline_config; LOG(("IDE interrupt assert\n")); @@ -210,7 +210,7 @@ INLINE void signal_interrupt(ide_state *ide) INLINE void clear_interrupt(ide_state *ide) { - const ide_config *config = ide->device->inline_config; + const ide_config *config = (const ide_config *)ide->device->inline_config; LOG(("IDE interrupt clear\n")); @@ -228,7 +228,7 @@ INLINE void clear_interrupt(ide_state *ide) static TIMER_CALLBACK( delayed_interrupt ) { - ide_state *ide = ptr; + ide_state *ide = (ide_state *)ptr; ide->status &= ~IDE_STATUS_BUSY; signal_interrupt(ide); } @@ -236,7 +236,7 @@ static TIMER_CALLBACK( delayed_interrupt ) static TIMER_CALLBACK( delayed_interrupt_buffer_ready ) { - ide_state *ide = ptr; + ide_state *ide = (ide_state *)ptr; ide->status &= ~IDE_STATUS_BUSY; ide->status |= IDE_STATUS_BUFFER_READY; signal_interrupt(ide); @@ -289,7 +289,7 @@ void ide_set_user_password(const device_config *device, const UINT8 *password) static TIMER_CALLBACK( reset_callback ) { - device_reset(ptr); + device_reset((const device_config *)ptr); } @@ -595,7 +595,7 @@ static void ide_build_features(ide_state *ide) static TIMER_CALLBACK( security_error_done ) { - ide_state *ide = ptr; + ide_state *ide = (ide_state *)ptr; /* clear error state */ ide->status &= ~IDE_STATUS_ERROR; @@ -763,7 +763,7 @@ static void read_sector_done(ide_state *ide) static TIMER_CALLBACK( read_sector_done_callback ) { - read_sector_done(ptr); + read_sector_done((ide_state *)ptr); } @@ -965,7 +965,7 @@ static void write_sector_done(ide_state *ide) static TIMER_CALLBACK( write_sector_done_callback ) { - write_sector_done(ptr); + write_sector_done((ide_state *)ptr); } @@ -1677,7 +1677,7 @@ static DEVICE_START( ide_controller ) ide->device = device; /* set MAME harddisk handle */ - config = device->inline_config; + config = (const ide_config *)device->inline_config; ide->disk = hard_disk_open(get_disk_handle((config->master != NULL) ? config->master : device->tag)); assert_always(config->slave == NULL, "IDE controller does not yet support slave drives\n"); diff --git a/src/emu/machine/intelfsh.c b/src/emu/machine/intelfsh.c index 2a80103b801..f62e89313f5 100644 --- a/src/emu/machine/intelfsh.c +++ b/src/emu/machine/intelfsh.c @@ -50,7 +50,7 @@ static struct flash_chip chips[FLASH_CHIPS_MAX]; static TIMER_CALLBACK( erase_finished ) { - struct flash_chip *c = ptr; + struct flash_chip *c = (struct flash_chip *)ptr; switch( c->flash_mode ) { @@ -159,13 +159,13 @@ UINT32 intelflash_read(int chip, UINT32 address) { case 8: { - UINT8 *flash_memory = c->flash_memory; + UINT8 *flash_memory = (UINT8 *)c->flash_memory; data = flash_memory[ address ]; } break; case 16: { - UINT16 *flash_memory = c->flash_memory; + UINT16 *flash_memory = (UINT16 *)c->flash_memory; data = flash_memory[ address ]; } break; @@ -345,13 +345,13 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) { case 8: { - UINT8 *flash_memory = c->flash_memory; + UINT8 *flash_memory = (UINT8 *)c->flash_memory; memset( &flash_memory[ address & ~0xffff ], 0xff, 64 * 1024 ); } break; case 16: { - UINT16 *flash_memory = c->flash_memory; + UINT16 *flash_memory = (UINT16 *)c->flash_memory; memset( &flash_memory[ address & ~0x7fff ], 0xff, 64 * 1024 ); } break; @@ -372,7 +372,7 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) { case 8: { - UINT8 *flash_memory = c->flash_memory; + UINT8 *flash_memory = (UINT8 *)c->flash_memory; flash_memory[ address ] = data; } break; @@ -387,13 +387,13 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) { case 8: { - UINT8 *flash_memory = c->flash_memory; + UINT8 *flash_memory = (UINT8 *)c->flash_memory; flash_memory[ address ] = data; } break; case 16: { - UINT16 *flash_memory = c->flash_memory; + UINT16 *flash_memory = (UINT16 *)c->flash_memory; flash_memory[ address ] = data; } break; @@ -412,13 +412,13 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) { case 8: { - UINT8 *flash_memory = c->flash_memory; + UINT8 *flash_memory = (UINT8 *)c->flash_memory; memset( &flash_memory[ address & ~0xffff ], 0xff, 64 * 1024 ); } break; case 16: { - UINT16 *flash_memory = c->flash_memory; + UINT16 *flash_memory = (UINT16 *)c->flash_memory; memset( &flash_memory[ address & ~0x7fff ], 0xff, 64 * 1024 ); } break; diff --git a/src/emu/machine/latch8.c b/src/emu/machine/latch8.c index a9fac543876..f842f445ee4 100644 --- a/src/emu/machine/latch8.c +++ b/src/emu/machine/latch8.c @@ -51,7 +51,7 @@ static void update(const device_config *device, UINT8 new_val, UINT8 mask) static TIMER_CALLBACK( latch8_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; UINT8 new_val = param & 0xFF; UINT8 mask = param >> 8; @@ -96,7 +96,7 @@ READ8_DEVICE_HANDLER( latch8_r ) } } - return (res & ~latch8->intf->maskout) ^ latch8->intf->xor; + return (res & ~latch8->intf->maskout) ^ latch8->intf->xorvalue; } @@ -188,7 +188,7 @@ static DEVICE_START( latch8 ) int i; /* validate arguments */ - latch8->intf = device->inline_config; + latch8->intf = (latch8_config *)device->inline_config; latch8->value = 0x0; diff --git a/src/emu/machine/latch8.h b/src/emu/machine/latch8.h index e83ec917eb1..9d673a537c3 100644 --- a/src/emu/machine/latch8.h +++ b/src/emu/machine/latch8.h @@ -36,7 +36,7 @@ struct _latch8_config { /* only for byte reads, does not affect bit reads and node_map */ UINT32 maskout; - UINT32 xor; /* after mask */ + UINT32 xorvalue; /* after mask */ UINT32 nosync; UINT32 node_map[8]; const char * node_device[8]; @@ -57,7 +57,7 @@ struct _latch8_config /* Bit mask specifying bits to be inverted */ #define MDRV_LATCH8_INVERT(_xor) \ - MDRV_DEVICE_CONFIG_DATA32(latch8_config, xor, _xor) + MDRV_DEVICE_CONFIG_DATA32(latch8_config, xorvalue, _xor) /* Bit mask specifying bits not needing cpu synchronization. */ #define MDRV_LATCH8_NOSYNC(_nosync) \ diff --git a/src/emu/machine/ldcore.c b/src/emu/machine/ldcore.c index 8d1359b2527..89656291dd3 100644 --- a/src/emu/machine/ldcore.c +++ b/src/emu/machine/ldcore.c @@ -197,7 +197,7 @@ INLINE void update_audio(laserdisc_state *ld) ldcore_data *ldcore = ld->core; if (ldcore->audiocustom != NULL) { - sound_token *token = ldcore->audiocustom->token; + sound_token *token = (sound_token *)ldcore->audiocustom->token; stream_update(token->stream); } } @@ -290,7 +290,7 @@ static void update_slider_pos(ldcore_data *ldcore, attotime curtime) static void vblank_state_changed(const device_config *screen, void *param, int vblank_state) { - const device_config *device = param; + const device_config *device = (const device_config *)param; laserdisc_state *ld = get_safe_token(device); ldcore_data *ldcore = ld->core; attotime curtime = timer_get_time(screen->machine); @@ -318,7 +318,7 @@ static void vblank_state_changed(const device_config *screen, void *param, int v static TIMER_CALLBACK( perform_player_update ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldcore_data *ldcore = ld->core; attotime curtime = timer_get_time(machine); @@ -940,7 +940,7 @@ static void process_track_data(const device_config *device) static DEVICE_START( laserdisc_sound ) { - sound_token *token = device->token; + sound_token *token = (sound_token *)device->token; token->stream = stream_create(device, 0, 2, 48000, token, custom_stream_callback); token->ld = NULL; } @@ -975,7 +975,7 @@ DEVICE_GET_INFO( laserdisc_sound ) static STREAM_UPDATE( custom_stream_callback ) { - sound_token *token = param; + sound_token *token = (sound_token *)param; laserdisc_state *ld = token->ld; ldcore_data *ldcore = ld->core; stream_sample_t *dst0 = outputs[0]; @@ -1103,7 +1103,7 @@ static void configuration_save(running_machine *machine, int config_type, xml_da /* iterate over disc devices */ for (device = device_list_first(machine->config->devicelist, LASERDISC); device != NULL; device = device_list_next(device, LASERDISC)) { - laserdisc_config *origconfig = device->inline_config; + laserdisc_config *origconfig = (laserdisc_config *)device->inline_config; laserdisc_state *ld = get_safe_token(device); ldcore_data *ldcore = ld->core; xml_data_node *overnode; @@ -1195,7 +1195,7 @@ VIDEO_UPDATE( laserdisc ) if (laserdisc != NULL) { const rectangle *visarea = video_screen_get_visible_area(screen); - laserdisc_state *ld = laserdisc->token; + laserdisc_state *ld = (laserdisc_state *)laserdisc->token; ldcore_data *ldcore = ld->core; bitmap_t *overbitmap = ldcore->overbitmap[ldcore->overindex]; bitmap_t *vidbitmap = NULL; @@ -1299,7 +1299,7 @@ void laserdisc_set_config(const device_config *device, const laserdisc_config *c static void init_disc(const device_config *device) { - const laserdisc_config *config = device->inline_config; + const laserdisc_config *config = (const laserdisc_config *)device->inline_config; laserdisc_state *ld = get_safe_token(device); ldcore_data *ldcore = ld->core; chd_error err; @@ -1349,7 +1349,7 @@ static void init_disc(const device_config *device) ldcore->chdtracks = totalhunks / 2; /* allocate memory for the precomputed per-frame metadata */ - ldcore->vbidata = auto_malloc(totalhunks * VBI_PACKED_BYTES); + ldcore->vbidata = (UINT8 *)auto_malloc(totalhunks * VBI_PACKED_BYTES); err = chd_get_metadata(ldcore->disc, AV_LD_METADATA_TAG, 0, ldcore->vbidata, totalhunks * VBI_PACKED_BYTES, &vbilength, NULL, NULL); if (err != CHDERR_NONE || vbilength != totalhunks * VBI_PACKED_BYTES) fatalerror("Precomputed VBI metadata missing or incorrect size"); @@ -1382,7 +1382,7 @@ static void init_video(const device_config *device) fillbitmap_yuy16(frame->bitmap, 40, 109, 240); /* make a copy of the bitmap that clips out the VBI and horizontal blanking areas */ - frame->visbitmap = auto_malloc(sizeof(*frame->visbitmap)); + frame->visbitmap = (bitmap_t *)auto_malloc(sizeof(*frame->visbitmap)); *frame->visbitmap = *frame->bitmap; frame->visbitmap->base = BITMAP_ADDR16(frame->visbitmap, 44, frame->bitmap->width * 8 / 720); frame->visbitmap->height -= 44; @@ -1410,8 +1410,8 @@ static void init_video(const device_config *device) if (ldcore->config.overwidth > 0 && ldcore->config.overheight > 0 && ldcore->config.overupdate != NULL) { ldcore->overenable = TRUE; - ldcore->overbitmap[0] = auto_bitmap_alloc(ldcore->config.overwidth, ldcore->config.overheight, ldcore->config.overformat); - ldcore->overbitmap[1] = auto_bitmap_alloc(ldcore->config.overwidth, ldcore->config.overheight, ldcore->config.overformat); + ldcore->overbitmap[0] = auto_bitmap_alloc(ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); + ldcore->overbitmap[1] = auto_bitmap_alloc(ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); ldcore->overtex = render_texture_alloc(NULL, NULL); if (ldcore->overtex == NULL) fatalerror("Out of memory allocating overlay texture"); @@ -1435,8 +1435,8 @@ static void init_audio(const device_config *device) /* allocate audio buffers */ ldcore->audiomaxsamples = ((UINT64)ldcore->samplerate * 1000000 + ldcore->fps_times_1million - 1) / ldcore->fps_times_1million; ldcore->audiobufsize = ldcore->audiomaxsamples * 4; - ldcore->audiobuffer[0] = auto_malloc(ldcore->audiobufsize * sizeof(ldcore->audiobuffer[0][0])); - ldcore->audiobuffer[1] = auto_malloc(ldcore->audiobufsize * sizeof(ldcore->audiobuffer[1][0])); + ldcore->audiobuffer[0] = (INT16 *)auto_malloc(ldcore->audiobufsize * sizeof(ldcore->audiobuffer[0][0])); + ldcore->audiobuffer[1] = (INT16 *)auto_malloc(ldcore->audiobufsize * sizeof(ldcore->audiobuffer[1][0])); } @@ -1451,7 +1451,7 @@ static void init_audio(const device_config *device) static DEVICE_START( laserdisc ) { - const laserdisc_config *config = device->inline_config; + const laserdisc_config *config = (const laserdisc_config *)device->inline_config; laserdisc_state *ld = get_safe_token(device); ldcore_data *ldcore; int statesize; @@ -1470,7 +1470,7 @@ static DEVICE_START( laserdisc ) ld->device = device; /* allocate memory for the core state */ - ld->core = auto_malloc(sizeof(*ld->core)); + ld->core = (ldcore_data *)auto_malloc(sizeof(*ld->core)); memset(ld->core, 0, sizeof(*ld->core)); ldcore = ld->core; @@ -1478,7 +1478,7 @@ static DEVICE_START( laserdisc ) statesize = 0; for (index = 0; index < ARRAY_LENGTH(player_interfaces); index++) statesize = MAX(statesize, player_interfaces[index]->statesize); - ld->player = auto_malloc(statesize); + ld->player = (ldplayer_data *)auto_malloc(statesize); memset(ld->player, 0, statesize); /* copy config data to the live state */ @@ -1549,7 +1549,7 @@ static DEVICE_RESET( laserdisc ) /* attempt to wire up the audio */ if (ldcore->audiocustom != NULL) { - sound_token *token = ldcore->audiocustom->token; + sound_token *token = (sound_token *)ldcore->audiocustom->token; token->ld = ld; stream_set_sample_rate(token->stream, ldcore->samplerate); } @@ -1608,8 +1608,8 @@ DEVICE_GET_INFO( laserdisc ) /* if we have a device, figure out where our config lives */ if (device != NULL) { - laserdisc_state *ld = device->token; - config = device->inline_config; + laserdisc_state *ld = (laserdisc_state *)device->token; + config = (const laserdisc_config *)device->inline_config; if (ld != NULL && ld->core != NULL) { config = &ld->core->config; diff --git a/src/emu/machine/ldcore.h b/src/emu/machine/ldcore.h index 8856e828141..0e040cbbb5a 100644 --- a/src/emu/machine/ldcore.h +++ b/src/emu/machine/ldcore.h @@ -137,7 +137,7 @@ typedef void (*laserdisc_init_func)(laserdisc_state *ld); typedef void (*laserdisc_vsync_func)(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime); typedef INT32 (*laserdisc_update_func)(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime); typedef void (*laserdisc_overlay_func)(laserdisc_state *ld, bitmap_t *bitmap); -typedef void (*laserdisc_w_func)(laserdisc_state *ld, UINT8 prev, UINT8 new); +typedef void (*laserdisc_w_func)(laserdisc_state *ld, UINT8 prev, UINT8 newval); typedef UINT8 (*laserdisc_r_func)(laserdisc_state *ld); diff --git a/src/emu/machine/ldpr8210.c b/src/emu/machine/ldpr8210.c index 485c4d38ef2..83d9d9478c0 100644 --- a/src/emu/machine/ldpr8210.c +++ b/src/emu/machine/ldpr8210.c @@ -521,7 +521,7 @@ static void pr8210_control_w(laserdisc_state *ld, UINT8 prev, UINT8 data) static TIMER_CALLBACK( vsync_off ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ld->player->vsync = FALSE; } @@ -535,7 +535,7 @@ static TIMER_CALLBACK( vsync_off ) static TIMER_CALLBACK( vbi_data_fetch ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; UINT8 focus_on = !(player->port1 & 0x08); UINT8 laser_on = !(player->port2 & 0x01); @@ -1097,7 +1097,7 @@ static void simutrek_init(laserdisc_state *ld) static TIMER_CALLBACK( irq_off ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; cpu_set_input_line(player->simutrek.cpu, MCS48_INPUT_IRQ, CLEAR_LINE); if (LOG_SIMUTREK) @@ -1181,7 +1181,7 @@ static void simutrek_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data) static TIMER_CALLBACK( simutrek_latched_data_w ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; /* store the data and set the ready flag */ diff --git a/src/emu/machine/ldv1000.c b/src/emu/machine/ldv1000.c index 3698b68d77e..e8f69cceac2 100644 --- a/src/emu/machine/ldv1000.c +++ b/src/emu/machine/ldv1000.c @@ -333,7 +333,7 @@ static UINT8 ldv1000_status_r(laserdisc_state *ld) static TIMER_CALLBACK( vsync_off ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ld->player->vsync = FALSE; } @@ -347,7 +347,7 @@ static TIMER_CALLBACK( vsync_off ) static TIMER_CALLBACK( vbi_data_fetch ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; UINT8 focus_on = !(player->portb1 & 0x01); UINT8 laser_on = (player->portb1 & 0x40); @@ -398,7 +398,7 @@ static TIMER_CALLBACK( vbi_data_fetch ) static TIMER_DEVICE_CALLBACK( multijump_timer ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; int direction; diff --git a/src/emu/machine/ldvp931.c b/src/emu/machine/ldvp931.c index a1fdeb46ae1..fe62af11fdd 100644 --- a/src/emu/machine/ldvp931.c +++ b/src/emu/machine/ldvp931.c @@ -321,7 +321,7 @@ static UINT8 vp931_data_ready(laserdisc_state *ld) static TIMER_CALLBACK( vbi_data_fetch ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; int which = param & 3; int line = param >> 2; @@ -364,7 +364,7 @@ static TIMER_CALLBACK( vbi_data_fetch ) static TIMER_CALLBACK( deferred_data_w ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; /* set the value and mark it pending */ @@ -389,7 +389,7 @@ static TIMER_CALLBACK( deferred_data_w ) static TIMER_CALLBACK( irq_off ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; cpu_set_input_line(ld->player->cpu, MCS48_INPUT_IRQ, CLEAR_LINE); } @@ -401,7 +401,7 @@ static TIMER_CALLBACK( irq_off ) static TIMER_CALLBACK( datastrobe_off ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ld->player->datastrobe = 0; } @@ -412,7 +412,7 @@ static TIMER_CALLBACK( datastrobe_off ) static TIMER_CALLBACK( erp_off ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ld->player->daticerp = 0; } @@ -423,7 +423,7 @@ static TIMER_CALLBACK( erp_off ) static TIMER_DEVICE_CALLBACK( track_timer ) { - laserdisc_state *ld = ptr; + laserdisc_state *ld = (laserdisc_state *)ptr; ldplayer_data *player = ld->player; /* advance by the count and toggle the state */ diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c index 4eaf445f42e..8099f0ec3b6 100644 --- a/src/emu/machine/mc146818.c +++ b/src/emu/machine/mc146818.c @@ -199,7 +199,7 @@ static TIMER_CALLBACK( mc146818_timer ) void mc146818_init(running_machine *machine, MC146818_TYPE type) { - mc146818 = auto_malloc(sizeof(*mc146818)); + mc146818 = (struct mc146818_chip *)auto_malloc(sizeof(*mc146818)); memset(mc146818, 0, sizeof(*mc146818)); mc146818->type = type; mc146818->last_refresh = timer_get_time(machine); diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c index 109cf65e58a..b8eab32d3be 100644 --- a/src/emu/machine/pci.c +++ b/src/emu/machine/pci.c @@ -211,7 +211,7 @@ static DEVICE_START( pci_bus ) assert(device->machine->config != NULL); /* store a pointer back to the device */ - pcibus->config = device->inline_config; + pcibus->config = (const pci_bus_config *)device->inline_config; pcibus->busdevice = device; pcibus->devicenum = -1; diff --git a/src/emu/machine/pic8259.c b/src/emu/machine/pic8259.c index 2c69b0d97d0..211349ae512 100644 --- a/src/emu/machine/pic8259.c +++ b/src/emu/machine/pic8259.c @@ -80,7 +80,7 @@ INLINE pic8259_t *get_safe_token(const device_config *device) { static TIMER_CALLBACK( pic8259_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; pic8259_t *pic8259 = get_safe_token(device); int irq; UINT8 mask; @@ -394,7 +394,7 @@ WRITE8_DEVICE_HANDLER( pic8259_w ) static DEVICE_START( pic8259 ) { pic8259_t *pic8259 = get_safe_token(device); - pic8259->intf = device->static_config; + pic8259->intf = (const struct pic8259_interface *)device->static_config; pic8259->timer = timer_alloc( device->machine, pic8259_timerproc, (void *)device ); } diff --git a/src/emu/machine/pit8253.c b/src/emu/machine/pit8253.c index 8493b92bdf4..2f7b10b9348 100644 --- a/src/emu/machine/pit8253.c +++ b/src/emu/machine/pit8253.c @@ -657,7 +657,7 @@ static void update(const device_config *device, struct pit8253_timer *timer) static TIMER_CALLBACK( update_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; pit8253_t *pit8253 = get_safe_token(device); struct pit8253_timer *timer = get_timer(pit8253,param); @@ -1042,7 +1042,7 @@ static void common_start( const device_config *device, int device_type ) { pit8253_t *pit8253 = get_safe_token(device); int timerno; - pit8253->config = device->static_config; + pit8253->config = (const struct pit8253_config *)device->static_config; pit8253->device_type = device_type; /* register for state saving */ diff --git a/src/emu/machine/scsicd.c b/src/emu/machine/scsicd.c index bf6dfa23ad1..d6eb3af5c5c 100644 --- a/src/emu/machine/scsicd.c +++ b/src/emu/machine/scsicd.c @@ -42,7 +42,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) { UINT8 *command; int commandLength; - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); cdrom_file *cdrom = our_this->cdrom; const device_config *cdda; @@ -310,7 +310,7 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL { UINT8 *command; int commandLength; - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); int i; UINT32 last_phys_frame; @@ -629,7 +629,7 @@ static void scsicd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int data { UINT8 *command; int commandLength; - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch (command[ 0 ]) @@ -673,7 +673,7 @@ static void scsicd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int data static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { running_machine *machine = scsiInstance->machine; - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); our_this->lba = 0; our_this->blocks = 0; @@ -707,7 +707,7 @@ static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr static void scsicd_delete_instance( SCSIInstance *scsiInstance ) { #ifndef MESS - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); if( our_this->cdrom ) { cdrom_close( our_this->cdrom ); @@ -717,13 +717,13 @@ static void scsicd_delete_instance( SCSIInstance *scsiInstance ) static void scsicd_get_device( SCSIInstance *scsiInstance, cdrom_file **cdrom ) { - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); *cdrom = our_this->cdrom; } static void scsicd_set_device( SCSIInstance *scsiInstance, cdrom_file *cdrom ) { - SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); + SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); our_this->cdrom = cdrom; } @@ -734,36 +734,36 @@ static int scsicd_dispatch(int operation, void *file, INT64 intparm, void *ptrpa switch (operation) { case SCSIOP_EXEC_COMMAND: - return scsicd_exec_command( file, ptrparm ); + return scsicd_exec_command( (SCSIInstance *)file, (UINT8 *)ptrparm ); case SCSIOP_READ_DATA: - scsicd_read_data( file, ptrparm, intparm ); + scsicd_read_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_WRITE_DATA: - scsicd_write_data( file, ptrparm, intparm ); + scsicd_write_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_ALLOC_INSTANCE: - params = ptrparm; - SCSIBase( &SCSIClassCDROM, operation, file, intparm, ptrparm ); + params = (SCSIAllocInstanceParams *)ptrparm; + SCSIBase( &SCSIClassCDROM, operation, (SCSIInstance *)file, intparm, (UINT8 *)ptrparm ); scsicd_alloc_instance( params->instance, params->diskregion ); return 0; case SCSIOP_DELETE_INSTANCE: - scsicd_delete_instance( file ); + scsicd_delete_instance( (SCSIInstance *)file ); break; case SCSIOP_GET_DEVICE: - scsicd_get_device( file, ptrparm ); + scsicd_get_device( (SCSIInstance *)file, (cdrom_file **)ptrparm ); return 0; case SCSIOP_SET_DEVICE: - scsicd_set_device( file, ptrparm ); + scsicd_set_device( (SCSIInstance *)file, (cdrom_file *)ptrparm ); return 0; } - return SCSIBase( &SCSIClassCDROM, operation, file, intparm, ptrparm ); + return SCSIBase( &SCSIClassCDROM, operation, (SCSIInstance *)file, intparm, (UINT8 *)ptrparm ); } const SCSIClass SCSIClassCDROM = diff --git a/src/emu/machine/scsidev.c b/src/emu/machine/scsidev.c index 2fbc07564ed..122650fdfee 100644 --- a/src/emu/machine/scsidev.c +++ b/src/emu/machine/scsidev.c @@ -17,7 +17,7 @@ static int scsidev_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) { UINT8 *command; int commandLength; -// SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); +// SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch( command[ 0 ] ) @@ -36,7 +36,7 @@ static void scsidev_read_data( SCSIInstance *scsiInstance, UINT8 *data, int data { UINT8 *command; int commandLength; -// SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); +// SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch( command[ 0 ] ) @@ -51,7 +51,7 @@ static void scsidev_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dat { UINT8 *command; int commandLength; -// SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); +// SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch( command[ 0 ] ) @@ -64,19 +64,19 @@ static void scsidev_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dat static void scsidev_set_phase( SCSIInstance *scsiInstance, int phase ) { - SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); + SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); our_this->phase = phase; } static int scsidev_get_phase( SCSIInstance *scsiInstance ) { - SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); + SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); return our_this->phase; } static void scsidev_set_command( SCSIInstance *scsiInstance, void *command, int commandLength ) { - SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); + SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); if( commandLength > sizeof( our_this->command ) ) { @@ -92,7 +92,7 @@ static void scsidev_set_command( SCSIInstance *scsiInstance, void *command, int static int scsidev_get_command( SCSIInstance *scsiInstance, void **command ) { - SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); + SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); *command = our_this->command; return our_this->commandLength; } @@ -100,7 +100,7 @@ static int scsidev_get_command( SCSIInstance *scsiInstance, void **command ) static void scsidev_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { running_machine *machine = scsiInstance->machine; - SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance ); + SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); state_save_register_item_array( machine, "scsidev", diskregion, 0, our_this->command ); state_save_register_item( machine, "scsidev", diskregion, 0, our_this->commandLength ); @@ -114,38 +114,38 @@ static int scsidev_dispatch( int operation, void *file, INT64 intparm, void *ptr switch( operation ) { case SCSIOP_EXEC_COMMAND: - return scsidev_exec_command( file, ptrparm ); + return scsidev_exec_command( (SCSIInstance *)file, (UINT8 *)ptrparm ); case SCSIOP_READ_DATA: - scsidev_read_data( file, ptrparm, intparm ); + scsidev_read_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); break; case SCSIOP_WRITE_DATA: - scsidev_write_data( file, ptrparm, intparm ); + scsidev_write_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); break; case SCSIOP_SET_PHASE: - scsidev_set_phase( file, intparm ); + scsidev_set_phase( (SCSIInstance *)file, intparm ); return 0; case SCSIOP_GET_PHASE: - return scsidev_get_phase( file ); + return scsidev_get_phase( (SCSIInstance *)file ); case SCSIOP_SET_COMMAND: - scsidev_set_command( file, ptrparm, intparm ); + scsidev_set_command( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_GET_COMMAND: - return scsidev_get_command( file, ptrparm ); + return scsidev_get_command( (SCSIInstance *)file, (void **)ptrparm ); case SCSIOP_ALLOC_INSTANCE: - params = ptrparm; - params->instance = SCSIMalloc( params->machine, file ); + params = (SCSIAllocInstanceParams *)ptrparm; + params->instance = SCSIMalloc( params->machine, (const SCSIClass *)file ); scsidev_alloc_instance( params->instance, params->diskregion ); return 0; case SCSIOP_DELETE_INSTANCE: - free( file ); + free( (SCSIInstance *)file ); return 0; } return 0; diff --git a/src/emu/machine/scsihd.c b/src/emu/machine/scsihd.c index 107c437bfcc..30744e91026 100644 --- a/src/emu/machine/scsihd.c +++ b/src/emu/machine/scsihd.c @@ -27,7 +27,7 @@ static int scsihd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) { UINT8 *command; int commandLength; - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch ( command[0] ) @@ -103,7 +103,7 @@ static void scsihd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL int i; UINT8 *command; int commandLength; - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch ( command[0] ) @@ -194,7 +194,7 @@ static void scsihd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int data { UINT8 *command; int commandLength; - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); SCSIGetCommand( scsiInstance, &command, &commandLength ); switch ( command[0] ) @@ -225,7 +225,7 @@ static void scsihd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int data static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { running_machine *machine = scsiInstance->machine; - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); our_this->lba = 0; our_this->blocks = 0; @@ -249,7 +249,7 @@ static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr static void scsihd_delete_instance( SCSIInstance *scsiInstance ) { #ifndef MESS - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); if( our_this->disk ) { @@ -260,13 +260,13 @@ static void scsihd_delete_instance( SCSIInstance *scsiInstance ) static void scsihd_get_device( SCSIInstance *scsiInstance, hard_disk_file **disk ) { - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); *disk = our_this->disk; } static void scsihd_set_device( SCSIInstance *scsiInstance, hard_disk_file *disk ) { - SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); + SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); our_this->disk = disk; } @@ -277,36 +277,36 @@ static int scsihd_dispatch(int operation, void *file, INT64 intparm, void *ptrpa switch (operation) { case SCSIOP_EXEC_COMMAND: - return scsihd_exec_command( file, ptrparm ); + return scsihd_exec_command( (SCSIInstance *)file, (UINT8 *)ptrparm ); case SCSIOP_READ_DATA: - scsihd_read_data( file, ptrparm, intparm ); + scsihd_read_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_WRITE_DATA: - scsihd_write_data( file, ptrparm, intparm ); + scsihd_write_data( (SCSIInstance *)file, (UINT8 *)ptrparm, intparm ); return 0; case SCSIOP_ALLOC_INSTANCE: - params = ptrparm; - SCSIBase( &SCSIClassHARDDISK, operation, file, intparm, ptrparm ); + params = (SCSIAllocInstanceParams *)ptrparm; + SCSIBase( &SCSIClassHARDDISK, operation, (SCSIInstance *)file, intparm, (UINT8 *)ptrparm ); scsihd_alloc_instance( params->instance, params->diskregion ); return 0; case SCSIOP_DELETE_INSTANCE: - scsihd_delete_instance( file ); + scsihd_delete_instance( (SCSIInstance *)file ); break; case SCSIOP_GET_DEVICE: - scsihd_get_device( file, ptrparm ); + scsihd_get_device( (SCSIInstance *)file, (hard_disk_file **)ptrparm ); return 0; case SCSIOP_SET_DEVICE: - scsihd_set_device( file, ptrparm ); + scsihd_set_device( (SCSIInstance *)file, (hard_disk_file *)ptrparm ); return 0; } - return SCSIBase( &SCSIClassHARDDISK, operation, file, intparm, ptrparm ); + return SCSIBase( &SCSIClassHARDDISK, operation, (SCSIInstance *)file, intparm, (UINT8 *)ptrparm ); } const SCSIClass SCSIClassHARDDISK = diff --git a/src/emu/machine/smc91c9x.c b/src/emu/machine/smc91c9x.c index 23fe843a811..bd79c994897 100644 --- a/src/emu/machine/smc91c9x.c +++ b/src/emu/machine/smc91c9x.c @@ -510,7 +510,7 @@ WRITE16_DEVICE_HANDLER( smc91c9x_w ) static DEVICE_START( smc91c9x ) { - const smc91c9x_config *config = device->inline_config; + const smc91c9x_config *config = (const smc91c9x_config *)device->inline_config; smc91c9x_state *smc = get_safe_token(device); /* validate some basic stuff */ diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index 96e0c675ec7..40c5b975a0f 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -308,7 +308,7 @@ static DEVICE_START(timekeeper) c->month = make_bcd( systime.local_time.month + 1 ); c->year = make_bcd( systime.local_time.year % 100 ); c->century = make_bcd( systime.local_time.year / 100 ); - c->data = auto_malloc( c->size ); + c->data = (UINT8 *)auto_malloc( c->size ); c->default_data = device->region; if (c->default_data != NULL) diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index ab5baca4684..df52db848e3 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -798,7 +798,7 @@ void wd33c93_init( running_machine *machine, const struct WD33C93interface *inte /* allocate a timer for commands */ scsi_data.cmd_timer = timer_alloc(machine, wd33c93_complete_cb, NULL); - scsi_data.temp_input = auto_malloc( TEMP_INPUT_LEN ); + scsi_data.temp_input = (UINT8 *)auto_malloc( TEMP_INPUT_LEN ); // state_save_register_item_array(machine, "wd33c93", NULL, 0, scsi_data); } diff --git a/src/emu/machine/x2212.c b/src/emu/machine/x2212.c index 5bdbac00dbf..d1949acbaac 100644 --- a/src/emu/machine/x2212.c +++ b/src/emu/machine/x2212.c @@ -88,12 +88,12 @@ static DEVICE_START(x2212) assert(device->machine != NULL); assert(device->machine->config != NULL); - c->sram = auto_malloc( SIZE_DATA ); - c->e2prom = auto_malloc( SIZE_DATA ); + c->sram = (UINT8 *)auto_malloc( SIZE_DATA ); + c->e2prom = (UINT8 *)auto_malloc( SIZE_DATA ); c->store = 1; c->array_recall = 1; - config = device->static_config; + config = (const x2212_config *)device->static_config; if( config != NULL && config->data != NULL ) { c->default_data = memory_region( device->machine, config->data ); diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index 2b0f34aa3d5..a4aa5f1e840 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -115,7 +115,7 @@ void x76f041_init( running_machine *machine, int chip, UINT8 *data ) if( data == NULL ) { - data = auto_malloc( + data = (UINT8 *)auto_malloc( SIZE_RESPONSE_TO_RESET + SIZE_READ_PASSWORD + SIZE_WRITE_PASSWORD + diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index 7357147196f..33d3089ce98 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -84,7 +84,7 @@ void x76f100_init( running_machine *machine, int chip, UINT8 *data ) if( data == NULL ) { - data = auto_malloc( + data = (UINT8 *)auto_malloc( SIZE_RESPONSE_TO_RESET + SIZE_READ_PASSWORD + SIZE_WRITE_PASSWORD + diff --git a/src/emu/machine/z80ctc.c b/src/emu/machine/z80ctc.c index 8d23ea097bf..2c5f964292a 100644 --- a/src/emu/machine/z80ctc.c +++ b/src/emu/machine/z80ctc.c @@ -138,7 +138,7 @@ static void interrupt_check(const device_config *device) static TIMER_CALLBACK( timercallback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; z80ctc *ctc = get_safe_token(device); ctc_channel *channel = &ctc->channel[param]; @@ -461,7 +461,7 @@ static void z80ctc_irq_reti(const device_config *device) static DEVICE_START( z80ctc ) { - const z80ctc_interface *intf = device->static_config; + const z80ctc_interface *intf = (const z80ctc_interface *)device->static_config; astring *tempstring = astring_alloc(); z80ctc *ctc = get_safe_token(device); int ch; diff --git a/src/emu/machine/z80dma.c b/src/emu/machine/z80dma.c index 4845343c599..535a1852abd 100644 --- a/src/emu/machine/z80dma.c +++ b/src/emu/machine/z80dma.c @@ -201,7 +201,7 @@ static int z80dma_do_write(const device_config *device) static TIMER_CALLBACK( z80dma_timerproc ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; z80dma_t *cntx = get_safe_token(device); int done; @@ -390,7 +390,7 @@ WRITE8_DEVICE_HANDLER( z80dma_w ) static TIMER_CALLBACK( z80dma_rdy_write_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; int state = param & 0x01; z80dma_t *cntx = get_safe_token(device); @@ -447,7 +447,7 @@ static DEVICE_START( z80dma ) assert(device != NULL); assert(device->tag != NULL); - z80dma->intf = device->static_config; + z80dma->intf = (const z80dma_interface *)device->static_config; z80dma->timer = timer_alloc(device->machine, z80dma_timerproc, (void *) device); diff --git a/src/emu/machine/z80pio.c b/src/emu/machine/z80pio.c index a3dd17b3146..213b7f97554 100644 --- a/src/emu/machine/z80pio.c +++ b/src/emu/machine/z80pio.c @@ -535,7 +535,7 @@ WRITE8_DEVICE_HANDLER(z80pio_w) static DEVICE_START( z80pio ) { - const z80pio_interface *intf = device->static_config; + const z80pio_interface *intf = (const z80pio_interface *)device->static_config; z80pio_t *z80pio = get_safe_token( device ); z80pio->intr = intf->intr; diff --git a/src/emu/machine/z80sio.c b/src/emu/machine/z80sio.c index 6193ad78af7..2ff705c36ae 100644 --- a/src/emu/machine/z80sio.c +++ b/src/emu/machine/z80sio.c @@ -524,7 +524,7 @@ READ8_DEVICE_HANDLER( z80sio_get_rts ) static TIMER_CALLBACK( change_input_line ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; z80sio *sio = get_safe_token(device); sio_channel *chan = &sio->chan[param & 1]; UINT8 line = (param >> 8) & 0xff; @@ -607,7 +607,7 @@ WRITE8_DEVICE_HANDLER( z80sio_receive_data ) static TIMER_CALLBACK( serial_callback ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; z80sio *sio = get_safe_token(device); sio_channel *chan = &sio->chan[param]; int ch = param; @@ -782,7 +782,7 @@ static void z80sio_irq_reti(const device_config *device) static DEVICE_START( z80sio ) { - const z80sio_interface *intf = device->static_config; + const z80sio_interface *intf = (const z80sio_interface *)device->static_config; astring *tempstring = astring_alloc(); z80sio *sio = get_safe_token(device); void *ptr = (void *)device; diff --git a/src/emu/mame.c b/src/emu/mame.c index 2699b0de3c4..3a7340e55d9 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -458,7 +458,7 @@ void add_frame_callback(running_machine *machine, void (*callback)(running_machi assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_frame_callback at init time!"); /* allocate memory */ - cb = malloc_or_die(sizeof(*cb)); + cb = (callback_item *)malloc_or_die(sizeof(*cb)); /* add us to the end of the list */ cb->func.frame = callback; @@ -481,7 +481,7 @@ void add_reset_callback(running_machine *machine, void (*callback)(running_machi assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_reset_callback at init time!"); /* allocate memory */ - cb = malloc_or_die(sizeof(*cb)); + cb = (callback_item *)malloc_or_die(sizeof(*cb)); /* add us to the end of the list */ cb->func.reset = callback; @@ -504,7 +504,7 @@ void add_pause_callback(running_machine *machine, void (*callback)(running_machi assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_pause_callback at init time!"); /* allocate memory */ - cb = malloc_or_die(sizeof(*cb)); + cb = (callback_item *)malloc_or_die(sizeof(*cb)); /* add us to the end of the list */ cb->func.pause = callback; @@ -527,7 +527,7 @@ void add_exit_callback(running_machine *machine, void (*callback)(running_machin assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_exit_callback at init time!"); /* allocate memory */ - cb = malloc_or_die(sizeof(*cb)); + cb = (callback_item *)malloc_or_die(sizeof(*cb)); /* add us to the head of the list */ cb->func.exit = callback; @@ -782,7 +782,7 @@ UINT8 *memory_region_alloc(running_machine *machine, const char *name, UINT32 le fatalerror("memory_region_alloc called with duplicate region name \"%s\"\n", name); /* allocate the region */ - info = malloc_or_die(sizeof(*info) + length); + info = (region_info *)malloc_or_die(sizeof(*info) + length); info->next = NULL; info->name = astring_dupc(name); info->length = length; @@ -1247,7 +1247,7 @@ void add_logerror_callback(running_machine *machine, void (*callback)(running_ma assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_logerror_callback at init time!"); - cb = auto_malloc(sizeof(*cb)); + cb = (callback_item *)auto_malloc(sizeof(*cb)); cb->func.log = callback; cb->next = NULL; @@ -1318,7 +1318,7 @@ void mame_parse_ini_files(core_options *options, const game_driver *driver) config = machine_config_alloc(driver->machine_config); for (device = video_screen_first(config); device != NULL; device = video_screen_next(device)) { - const screen_config *scrconfig = device->inline_config; + const screen_config *scrconfig = (const screen_config *)device->inline_config; if (scrconfig->type == SCREEN_TYPE_VECTOR) { parse_ini_file(options, "vector"); @@ -1387,13 +1387,13 @@ static running_machine *create_machine(const game_driver *driver) int cpunum; /* allocate memory for the machine */ - machine = malloc(sizeof(*machine)); + machine = (running_machine *)malloc(sizeof(*machine)); if (machine == NULL) goto error; memset(machine, 0, sizeof(*machine)); /* allocate memory for the internal mame_data */ - machine->mame_data = malloc(sizeof(*machine->mame_data)); + machine->mame_data = (mame_private *)malloc(sizeof(*machine->mame_data)); if (machine->mame_data == NULL) goto error; memset(machine->mame_data, 0, sizeof(*machine->mame_data)); diff --git a/src/emu/mamecore.h b/src/emu/mamecore.h index c05689a5921..1473ee7ee8c 100644 --- a/src/emu/mamecore.h +++ b/src/emu/mamecore.h @@ -174,6 +174,18 @@ enum COMMON MACROS ***************************************************************************/ +/* Macro for declaring enumerator operators for easier porting */ +#ifdef __cplusplus +#define DECLARE_ENUM_OPERATORS(type) \ +inline void operator++(type &value) { value = (type)((int)value + 1); } \ +inline void operator++(type &value, int) { value = (type)((int)value + 1); } \ +inline void operator--(type &value) { value = (type)((int)value - 1); } \ +inline void operator--(type &value, int) { value = (type)((int)value - 1); } +#else +#define DECLARE_ENUM_OPERATORS(type) +#endif + + /* Standard MAME assertion macros */ #undef assert #undef assert_always @@ -182,7 +194,7 @@ enum #define assert(x) do { if (!(x)) fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) #define assert_always(x, msg) do { if (!(x)) fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) #else -#define assert(x) +#define assert(x) do { } while (0) #define assert_always(x, msg) do { if (!(x)) fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0) #endif diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index f54878d11e9..4859725550e 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -69,7 +69,7 @@ machine_config *machine_config_alloc(const machine_config_token *tokens) machine_config *config; /* allocate a new configuration object */ - config = malloc_or_die(sizeof(*config)); + config = (machine_config *)malloc_or_die(sizeof(*config)); memset(config, 0, sizeof(*config)); /* parse tokens into the config */ @@ -318,7 +318,7 @@ static void machine_config_detokenize(machine_config *config, const machine_conf if (depth == 0) for (device = config->devicelist; device != NULL; device = device->next) { - tokens = device_get_info_ptr(device, DEVINFO_PTR_MACHINE_CONFIG); + tokens = (const machine_config_token *)device_get_info_ptr(device, DEVINFO_PTR_MACHINE_CONFIG); if (tokens != NULL) machine_config_detokenize(config, tokens, device, depth + 1); } diff --git a/src/emu/memory.c b/src/emu/memory.c index 7b7bf72416e..d72cfdaecb7 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -441,7 +441,7 @@ INLINE void add_bank_reference(bank_info *bank, const address_space *space) return; /* allocate a new entry and fill it */ - (*refptr) = malloc_or_die(sizeof(**refptr)); + (*refptr) = (bank_reference *)malloc_or_die(sizeof(**refptr)); (*refptr)->next = NULL; (*refptr)->space = space; } @@ -471,7 +471,7 @@ INLINE UINT8 read_byte_generic(const address_space *space, offs_t byteaddress) if (entry < STATIC_RAM) result = (*handler->bankbaseptr)[byteoffset]; else - result = (*handler->handler.read.shandler8)(handler->object, byteoffset); + result = (*handler->handler.read.shandler8)((const address_space *)handler->object, byteoffset); profiler_mark(PROFILER_END); return result; @@ -501,7 +501,7 @@ INLINE void write_byte_generic(const address_space *space, offs_t byteaddress, U if (entry < STATIC_RAM) (*handler->bankbaseptr)[byteoffset] = data; else - (*handler->handler.write.shandler8)(handler->object, byteoffset, data); + (*handler->handler.write.shandler8)((const address_space *)handler->object, byteoffset, data); profiler_mark(PROFILER_END); } @@ -531,7 +531,7 @@ INLINE UINT16 read_word_generic(const address_space *space, offs_t byteaddress, if (entry < STATIC_RAM) result = *(UINT16 *)&(*handler->bankbaseptr)[byteoffset & ~1]; else - result = (*handler->handler.read.shandler16)(handler->object, byteoffset >> 1, mem_mask); + result = (*handler->handler.read.shandler16)((const address_space *)handler->object, byteoffset >> 1, mem_mask); profiler_mark(PROFILER_END); return result; @@ -564,7 +564,7 @@ INLINE void write_word_generic(const address_space *space, offs_t byteaddress, U *dest = (*dest & ~mem_mask) | (data & mem_mask); } else - (*handler->handler.write.shandler16)(handler->object, byteoffset >> 1, data, mem_mask); + (*handler->handler.write.shandler16)((const address_space *)handler->object, byteoffset >> 1, data, mem_mask); profiler_mark(PROFILER_END); } @@ -594,7 +594,7 @@ INLINE UINT32 read_dword_generic(const address_space *space, offs_t byteaddress, if (entry < STATIC_RAM) result = *(UINT32 *)&(*handler->bankbaseptr)[byteoffset & ~3]; else - result = (*handler->handler.read.shandler32)(handler->object, byteoffset >> 2, mem_mask); + result = (*handler->handler.read.shandler32)((const address_space *)handler->object, byteoffset >> 2, mem_mask); profiler_mark(PROFILER_END); return result; @@ -627,7 +627,7 @@ INLINE void write_dword_generic(const address_space *space, offs_t byteaddress, *dest = (*dest & ~mem_mask) | (data & mem_mask); } else - (*handler->handler.write.shandler32)(handler->object, byteoffset >> 2, data, mem_mask); + (*handler->handler.write.shandler32)((const address_space *)handler->object, byteoffset >> 2, data, mem_mask); profiler_mark(PROFILER_END); } @@ -657,7 +657,7 @@ INLINE UINT64 read_qword_generic(const address_space *space, offs_t byteaddress, if (entry < STATIC_RAM) result = *(UINT64 *)&(*handler->bankbaseptr)[byteoffset & ~7]; else - result = (*handler->handler.read.shandler64)(handler->object, byteoffset >> 3, mem_mask); + result = (*handler->handler.read.shandler64)((const address_space *)handler->object, byteoffset >> 3, mem_mask); profiler_mark(PROFILER_END); return result; @@ -690,7 +690,7 @@ INLINE void write_qword_generic(const address_space *space, offs_t byteaddress, *dest = (*dest & ~mem_mask) | (data & mem_mask); } else - (*handler->handler.write.shandler64)(handler->object, offset >> 3, data, mem_mask); + (*handler->handler.write.shandler64)((const address_space *)handler->object, offset >> 3, data, mem_mask); profiler_mark(PROFILER_END); } @@ -712,7 +712,7 @@ void memory_init(running_machine *machine) add_exit_callback(machine, memory_exit); /* allocate our private data */ - memdata = machine->memory_data = auto_malloc(sizeof(*machine->memory_data)); + memdata = machine->memory_data = (memory_private *)auto_malloc(sizeof(*machine->memory_data)); memset(memdata, 0, sizeof(*memdata)); /* build up the cpudata array with info about all CPUs and address spaces */ @@ -765,11 +765,11 @@ const address_space *memory_find_address_space(const device_config *cpu, int spa address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum) { - const cpu_config *cpuconfig = device->inline_config; + const cpu_config *cpuconfig = (const cpu_config *)device->inline_config; const addrmap_token *internal_map; address_map *map; - map = malloc_or_die(sizeof(*map)); + map = (address_map *)malloc_or_die(sizeof(*map)); memset(map, 0, sizeof(*map)); /* append the internal CPU map (first so it takes priority) */ @@ -1027,7 +1027,7 @@ void memory_configure_bank(running_machine *machine, int banknum, int startentry /* if we have no bankptr yet, set it to the first entry */ if (memdata->bank_ptr[banknum] == NULL) - memdata->bank_ptr[banknum] = bank->entry[0]; + memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[0]; } @@ -1058,7 +1058,7 @@ void memory_configure_bank_decrypted(running_machine *machine, int banknum, int /* if we have no bankptr yet, set it to the first entry */ if (memdata->bankd_ptr[banknum] == NULL) - memdata->bankd_ptr[banknum] = bank->entryd[0]; + memdata->bankd_ptr[banknum] = (UINT8 *)bank->entryd[0]; } @@ -1085,8 +1085,8 @@ void memory_set_bank(running_machine *machine, int banknum, int entrynum) /* set the base */ bank->curentry = entrynum; - memdata->bank_ptr[banknum] = bank->entry[entrynum]; - memdata->bankd_ptr[banknum] = bank->entryd[entrynum]; + memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[entrynum]; + memdata->bankd_ptr[banknum] = (UINT8 *)bank->entryd[entrynum]; /* invalidate all the direct references to any referenced address spaces */ for (ref = bank->reflist; ref != NULL; ref = ref->next) @@ -1134,7 +1134,7 @@ void memory_set_bankptr(running_machine *machine, int banknum, void *base) validate_auto_malloc_memory(base, bank->byteend - bank->bytestart + 1); /* set the base */ - memdata->bank_ptr[banknum] = base; + memdata->bank_ptr[banknum] = (UINT8 *)base; /* invalidate all the direct references to any referenced address spaces */ for (ref = bank->reflist; ref != NULL; ref = ref->next) @@ -1181,7 +1181,7 @@ UINT8 *_memory_install_handler8(const address_space *space, offs_t addrstart, of if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT8 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1198,7 +1198,7 @@ UINT16 *_memory_install_handler16(const address_space *space, offs_t addrstart, if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT16 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1215,7 +1215,7 @@ UINT32 *_memory_install_handler32(const address_space *space, offs_t addrstart, if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT32 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1232,7 +1232,7 @@ UINT64 *_memory_install_handler64(const address_space *space, offs_t addrstart, if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT64 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1270,7 +1270,7 @@ UINT8 *_memory_install_device_handler8(const address_space *space, const device_ if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT8 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1287,7 +1287,7 @@ UINT16 *_memory_install_device_handler16(const address_space *space, const devic if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT16 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1304,7 +1304,7 @@ UINT32 *_memory_install_device_handler32(const address_space *space, const devic if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT32 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1321,7 +1321,7 @@ UINT64 *_memory_install_device_handler64(const address_space *space, const devic if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); - return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); + return (UINT64 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); } @@ -1494,7 +1494,7 @@ static void memory_init_spaces(running_machine *machine) int spacenum; /* create a global watchpoint-filled table */ - memdata->wptable = auto_malloc(1 << LEVEL1_BITS); + memdata->wptable = (UINT8 *)auto_malloc(1 << LEVEL1_BITS); memset(memdata->wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS); /* loop over CPUs */ @@ -1502,7 +1502,7 @@ static void memory_init_spaces(running_machine *machine) for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) if (cpu_get_addrbus_width(device, spacenum) > 0) { - address_space *space = malloc_or_die(sizeof(*space)); + address_space *space = (address_space *)malloc_or_die(sizeof(*space)); int logbits = cpu_get_logaddr_width(device, spacenum); int ashift = cpu_get_addrbus_shift(device, spacenum); int abits = cpu_get_addrbus_width(device, spacenum); @@ -1536,15 +1536,15 @@ static void memory_init_spaces(running_machine *machine) space->log_unmap = TRUE; /* allocate subtable information; we malloc this manually because it will be realloc'ed */ - space->read.subtable = auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT); + space->read.subtable = (subtable_data *)auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT); memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT); - space->write.subtable = auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT); + space->write.subtable = (subtable_data *)auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT); memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT); /* allocate the handler table */ - space->read.handlers[0] = auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers)); + space->read.handlers[0] = (handler_data *)auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers)); memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers)); - space->write.handlers[0] = auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers)); + space->write.handlers[0] = (handler_data *)auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers)); memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers)); for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++) { @@ -1568,8 +1568,8 @@ static void memory_init_spaces(running_machine *machine) space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0; /* allocate memory; these aren't auto-malloc'ed as we need to expand them */ - space->read.table = malloc_or_die(1 << LEVEL1_BITS); - space->write.table = malloc_or_die(1 << LEVEL1_BITS); + space->read.table = (UINT8 *)malloc_or_die(1 << LEVEL1_BITS); + space->write.table = (UINT8 *)malloc_or_die(1 << LEVEL1_BITS); /* initialize everything to unmapped */ memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS); @@ -1836,7 +1836,7 @@ static void memory_init_allocate(running_machine *machine) block = block_allocate(space, curbytestart, curbyteend, NULL); /* assign memory that intersected the new block */ - unassigned = block_assign_intersecting(space, curbytestart, curbyteend, block); + unassigned = block_assign_intersecting(space, curbytestart, curbyteend, (UINT8 *)block); } } } @@ -1888,7 +1888,7 @@ static void memory_init_locate(running_machine *machine) for (entry = ref->space->map->entrylist; entry != NULL; entry = entry->next) if (entry->bytestart == bank->bytestart) { - memdata->bank_ptr[banknum] = entry->memory; + memdata->bank_ptr[banknum] = (UINT8 *)entry->memory; foundit = TRUE; VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [%p]\n", banknum, entry->addrstart, entry->addrend, entry->memory)); break; @@ -1896,7 +1896,7 @@ static void memory_init_locate(running_machine *machine) /* if the entry was set ahead of time, override the automatically found pointer */ if (!bank->dynamic && bank->curentry != MAX_BANK_ENTRIES) - memdata->bank_ptr[banknum] = bank->entry[bank->curentry]; + memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[bank->curentry]; } } @@ -2059,7 +2059,7 @@ static void map_detokenize(address_map *map, const game_driver *driver, const ch /* start a new range */ case ADDRMAP_TOKEN_RANGE: - entry = *entryptr = malloc_or_die(sizeof(**entryptr)); + entry = *entryptr = (address_map_entry *)malloc_or_die(sizeof(**entryptr)); entryptr = &entry->next; memset(entry, 0, sizeof(*entry)); TOKEN_GET_UINT64_UNPACK2(tokens, entry->addrstart, 32, entry->addrend, 32); @@ -2200,7 +2200,7 @@ static void space_map_range_private(address_space *space, read_or_write readorwr /* assign a bank to the adjusted addresses */ handler = (genf *)bank_assign_dynamic(space, readorwrite, bytestart, byteend); if (memdata->bank_ptr[HANDLER_TO_BANK(handler)] == NULL) - memdata->bank_ptr[HANDLER_TO_BANK(handler)] = space_find_backing_memory(space, bytestart); + memdata->bank_ptr[HANDLER_TO_BANK(handler)] = (UINT8 *)space_find_backing_memory(space, bytestart); } /* then do a normal installation */ @@ -2433,7 +2433,7 @@ static STATE_POSTLOAD( bank_reattach ) { /* if this entry has a changed entry, set the appropriate pointer */ if (bank->curentry != MAX_BANK_ENTRIES) - memdata->bank_ptr[banknum] = bank->entry[bank->curentry]; + memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[bank->curentry]; } } } @@ -2816,7 +2816,7 @@ static UINT8 subtable_alloc(address_table *tabledata) if (subindex >= tabledata->subtable_alloc) { tabledata->subtable_alloc += SUBTABLE_ALLOC; - tabledata->table = realloc(tabledata->table, (1 << LEVEL1_BITS) + (tabledata->subtable_alloc << LEVEL2_BITS)); + tabledata->table = (UINT8 *)realloc(tabledata->table, (1 << LEVEL1_BITS) + (tabledata->subtable_alloc << LEVEL2_BITS)); if (!tabledata->table) fatalerror("error: ran out of memory allocating memory subtable"); } @@ -3030,7 +3030,7 @@ static direct_range *direct_range_find(address_space *space, offs_t byteaddress, if (range != NULL) space->direct.freerangelist = range->next; else - range = malloc_or_die(sizeof(*range)); + range = (direct_range *)malloc_or_die(sizeof(*range)); /* fill in the range */ table_derive_range(&space->read, byteaddress, &range->bytestart, &range->byteend); @@ -3102,7 +3102,7 @@ static void *block_allocate(const address_space *space, offs_t bytestart, offs_t bytestoalloc += byteend - bytestart + 1; /* allocate and clear the memory */ - block = malloc_or_die(bytestoalloc); + block = (memory_block *)malloc_or_die(bytestoalloc); memset(block, 0, bytestoalloc); if (allocatemem) memory = block + 1; @@ -3134,7 +3134,7 @@ static void *block_allocate(const address_space *space, offs_t bytestart, offs_t block->isallocated = allocatemem; block->bytestart = bytestart; block->byteend = byteend; - block->data = memory; + block->data = (UINT8 *)memory; /* attach us to the head of the list */ block->next = memdata->memory_block_list; @@ -3534,7 +3534,7 @@ static READ16_HANDLER( stub_read8_from_16 ) { int shift = *subshift++; if ((UINT8)(mem_mask >> shift) != 0) - result |= (*handler->subhandler.read.shandler8)(handler->subobject, offset) << shift; + result |= (*handler->subhandler.read.shandler8)((const address_space *)handler->subobject, offset) << shift; offset++; } return result; @@ -3558,7 +3558,7 @@ static READ32_HANDLER( stub_read8_from_32 ) { int shift = *subshift++; if ((UINT8)(mem_mask >> shift) != 0) - result |= (*handler->subhandler.read.shandler8)(handler->subobject, offset) << shift; + result |= (*handler->subhandler.read.shandler8)((const address_space *)handler->subobject, offset) << shift; offset++; } return result; @@ -3582,7 +3582,7 @@ static READ64_HANDLER( stub_read8_from_64 ) { int shift = *subshift++; if ((UINT8)(mem_mask >> shift) != 0) - result |= (UINT64)(*handler->subhandler.read.shandler8)(handler->subobject, offset) << shift; + result |= (UINT64)(*handler->subhandler.read.shandler8)((const address_space *)handler->subobject, offset) << shift; offset++; } return result; @@ -3606,7 +3606,7 @@ static READ32_HANDLER( stub_read16_from_32 ) { int shift = *subshift++; if ((UINT16)(mem_mask >> shift) != 0) - result |= (*handler->subhandler.read.shandler16)(handler->subobject, offset, mem_mask >> shift) << shift; + result |= (*handler->subhandler.read.shandler16)((const address_space *)handler->subobject, offset, mem_mask >> shift) << shift; offset++; } return result; @@ -3630,7 +3630,7 @@ static READ64_HANDLER( stub_read16_from_64 ) { int shift = *subshift++; if ((UINT16)(mem_mask >> shift) != 0) - result |= (UINT64)(*handler->subhandler.read.shandler16)(handler->subobject, offset, mem_mask >> shift) << shift; + result |= (UINT64)(*handler->subhandler.read.shandler16)((const address_space *)handler->subobject, offset, mem_mask >> shift) << shift; offset++; } return result; @@ -3654,7 +3654,7 @@ static READ64_HANDLER( stub_read32_from_64 ) { int shift = *subshift++; if ((UINT32)(mem_mask >> shift) != 0) - result |= (UINT64)(*handler->subhandler.read.shandler32)(handler->subobject, offset, mem_mask >> shift) << shift; + result |= (UINT64)(*handler->subhandler.read.shandler32)((const address_space *)handler->subobject, offset, mem_mask >> shift) << shift; offset++; } return result; @@ -3682,7 +3682,7 @@ static WRITE16_HANDLER( stub_write8_from_16 ) { int shift = *subshift++; if ((UINT8)(mem_mask >> shift) != 0) - (*handler->subhandler.write.shandler8)(handler->subobject, offset, data >> shift); + (*handler->subhandler.write.shandler8)((const address_space *)handler->subobject, offset, data >> shift); offset++; } } @@ -3704,7 +3704,7 @@ static WRITE32_HANDLER( stub_write8_from_32 ) { int shift = *subshift++; if ((UINT8)(mem_mask >> shift) != 0) - (*handler->subhandler.write.shandler8)(handler->subobject, offset, data >> shift); + (*handler->subhandler.write.shandler8)((const address_space *)handler->subobject, offset, data >> shift); offset++; } } @@ -3726,7 +3726,7 @@ static WRITE64_HANDLER( stub_write8_from_64 ) { int shift = *subshift++; if ((UINT8)(mem_mask >> shift) != 0) - (*handler->subhandler.write.shandler8)(handler->subobject, offset, data >> shift); + (*handler->subhandler.write.shandler8)((const address_space *)handler->subobject, offset, data >> shift); offset++; } } @@ -3748,7 +3748,7 @@ static WRITE32_HANDLER( stub_write16_from_32 ) { int shift = *subshift++; if ((UINT16)(mem_mask >> shift) != 0) - (*handler->subhandler.write.shandler16)(handler->subobject, offset, data >> shift, mem_mask >> shift); + (*handler->subhandler.write.shandler16)((const address_space *)handler->subobject, offset, data >> shift, mem_mask >> shift); offset++; } } @@ -3770,7 +3770,7 @@ static WRITE64_HANDLER( stub_write16_from_64 ) { int shift = *subshift++; if ((UINT16)(mem_mask >> shift) != 0) - (*handler->subhandler.write.shandler16)(handler->subobject, offset, data >> shift, mem_mask >> shift); + (*handler->subhandler.write.shandler16)((const address_space *)handler->subobject, offset, data >> shift, mem_mask >> shift); offset++; } } @@ -3792,7 +3792,7 @@ static WRITE64_HANDLER( stub_write32_from_64 ) { int shift = *subshift++; if ((UINT32)(mem_mask >> shift) != 0) - (*handler->subhandler.write.shandler32)(handler->subobject, offset, data >> shift, mem_mask >> shift); + (*handler->subhandler.write.shandler32)((const address_space *)handler->subobject, offset, data >> shift, mem_mask >> shift); offset++; } } diff --git a/src/emu/output.c b/src/emu/output.c index 795288441e7..beb3dde3c7b 100644 --- a/src/emu/output.c +++ b/src/emu/output.c @@ -78,7 +78,7 @@ static void output_exit(running_machine *machine); INLINE const char *copy_string(const char *string) { - char *newstring = malloc_or_die(strlen(string) + 1); + char *newstring = (char *)malloc_or_die(strlen(string) + 1); strcpy(newstring, string); return newstring; } @@ -118,7 +118,7 @@ INLINE output_item *find_item(const char *string) INLINE output_item *create_new_item(const char *outname, INT32 value) { - output_item *item = malloc_or_die(sizeof(*item)); + output_item *item = (output_item *)malloc_or_die(sizeof(*item)); UINT32 hash = get_hash(outname); /* fill in the data */ @@ -343,7 +343,7 @@ void output_set_notifier(const char *outname, output_notifier_func callback, voi /* find the end of the list and add to it */ while (*headptr != NULL) headptr = &(*headptr)->next; - *headptr = malloc_or_die(sizeof(**headptr)); + *headptr = (output_notify *)malloc_or_die(sizeof(**headptr)); /* fill in the new record */ (*headptr)->next = NULL; diff --git a/src/emu/render.c b/src/emu/render.c index ac94400e8a2..984e8f5e522 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -343,7 +343,7 @@ INLINE container_item *alloc_container_item(void) if (result != NULL) container_item_free_list = result->next; else - result = malloc_or_die(sizeof(*result)); + result = (container_item *)malloc_or_die(sizeof(*result)); memset(result, 0, sizeof(*result)); return result; @@ -375,7 +375,7 @@ INLINE render_primitive *alloc_render_primitive(int type) if (result != NULL) render_primitive_free_list = result->next; else - result = malloc_or_die(sizeof(*result)); + result = (render_primitive *)malloc_or_die(sizeof(*result)); /* clear to 0 */ memset(result, 0, sizeof(*result)); @@ -426,7 +426,7 @@ INLINE void add_render_ref(render_ref **list, void *refptr) if (ref != NULL) render_ref_free_list = ref->next; else - ref = malloc_or_die(sizeof(*ref)); + ref = (render_ref *)malloc_or_die(sizeof(*ref)); /* set the refptr and link us into the list */ ref->refptr = refptr; @@ -1073,7 +1073,7 @@ render_target *render_target_alloc(running_machine *machine, const char *layoutf int listnum; /* allocate memory for the target */ - target = malloc_or_die(sizeof(*target)); + target = (render_target *)malloc_or_die(sizeof(*target)); memset(target, 0, sizeof(*target)); /* add it to the end of the list */ @@ -1468,7 +1468,7 @@ void render_target_get_minimum_size(render_target *target, INT32 *minwidth, INT3 if (item->element == NULL) { const device_config *screen = device_list_find_by_index(target->machine->config->devicelist, VIDEO_SCREEN, item->index); - const screen_config *scrconfig = screen->inline_config; + const screen_config *scrconfig = (const screen_config *)screen->inline_config; const rectangle vectorvis = { 0, 639, 0, 479 }; const rectangle *visarea = NULL; render_container *container = get_screen_container_by_index(item->index); @@ -2433,7 +2433,7 @@ render_texture *render_texture_alloc(texture_scaler_func scaler, void *param) int texnum; /* allocate a new group */ - texture = malloc_or_die(sizeof(*texture) * TEXTURE_GROUP_SIZE); + texture = (render_texture *)malloc_or_die(sizeof(*texture) * TEXTURE_GROUP_SIZE); memset(texture, 0, sizeof(*texture) * TEXTURE_GROUP_SIZE); /* add them to the list */ @@ -2672,7 +2672,7 @@ static const rgb_t *texture_get_adjusted_palette(render_texture *texture, render numentries = palette_get_num_colors(texture->palette) * palette_get_num_groups(texture->palette); if (texture->bcglookup == NULL || texture->bcglookup_entries < numentries) { - texture->bcglookup = realloc(texture->bcglookup, numentries * sizeof(*texture->bcglookup)); + texture->bcglookup = (rgb_t *)realloc(texture->bcglookup, numentries * sizeof(*texture->bcglookup)); texture->bcglookup_entries = numentries; } for (index = 0; index < numentries; index++) @@ -2699,7 +2699,7 @@ static const rgb_t *texture_get_adjusted_palette(render_texture *texture, render adjusted = palette_entry_list_adjusted(texture->palette); if (texture->bcglookup == NULL || texture->bcglookup_entries < 4 * 32) { - texture->bcglookup = realloc(texture->bcglookup, 4 * 32 * sizeof(*texture->bcglookup)); + texture->bcglookup = (rgb_t *)realloc(texture->bcglookup, 4 * 32 * sizeof(*texture->bcglookup)); texture->bcglookup_entries = 4 * 32; } @@ -2731,7 +2731,7 @@ static const rgb_t *texture_get_adjusted_palette(render_texture *texture, render adjusted = palette_entry_list_adjusted(texture->palette); if (texture->bcglookup == NULL || texture->bcglookup_entries < 4 * 256) { - texture->bcglookup = realloc(texture->bcglookup, 4 * 256 * sizeof(*texture->bcglookup)); + texture->bcglookup = (rgb_t *)realloc(texture->bcglookup, 4 * 256 * sizeof(*texture->bcglookup)); texture->bcglookup_entries = 4 * 256; } @@ -2770,7 +2770,7 @@ static render_container *render_container_alloc(running_machine *machine) int color; /* allocate and clear memory */ - container = malloc_or_die(sizeof(*container)); + container = (render_container *)malloc_or_die(sizeof(*container)); memset(container, 0, sizeof(*container)); /* default values */ diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index e43b08f010a..eab3f5d572d 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -141,7 +141,7 @@ render_font *render_font_alloc(const char *filename) render_font *font; /* allocate and clear memory */ - font = malloc_or_die(sizeof(*font)); + font = (render_font *)malloc_or_die(sizeof(*font)); memset(font, 0, sizeof(*font)); /* attempt to load the cached version of the font first */ @@ -150,7 +150,7 @@ render_font *render_font_alloc(const char *filename) /* if we failed, clean up and realloc */ render_font_free(font); - font = malloc_or_die(sizeof(*font)); + font = (render_font *)malloc_or_die(sizeof(*font)); memset(font, 0, sizeof(*font)); /* load the raw data instead */ @@ -434,7 +434,7 @@ static int render_font_load_cached_bdf(render_font *font, const char *filename) /* determine the file size and allocate memory */ font->rawsize = mame_fsize(file); - data = malloc_or_die(font->rawsize + 1); + data = (char *)malloc_or_die(font->rawsize + 1); /* read and hash the first chunk */ bytes = mame_fread(file, data, MIN(CACHED_BDF_HASH_SIZE, font->rawsize)); @@ -584,7 +584,7 @@ static int render_font_load_bdf(render_font *font) /* if we don't have a subtable yet, make one */ if (font->chars[charnum / 256] == NULL) { - font->chars[charnum / 256] = malloc_or_die(256 * sizeof(font->chars[0][0])); + font->chars[charnum / 256] = (render_font_char *)malloc_or_die(256 * sizeof(font->chars[0][0])); memset(font->chars[charnum / 256], 0, 256 * sizeof(font->chars[0][0])); } @@ -642,7 +642,7 @@ static int render_font_load_cached(render_font *font, mame_file *file, UINT32 ha goto error; /* now read the rest of the data */ - data = malloc_or_die(filesize - CACHED_HEADER_SIZE); + data = (UINT8 *)malloc_or_die(filesize - CACHED_HEADER_SIZE); bytes_read = mame_fread(file, data, filesize - CACHED_HEADER_SIZE); if (bytes_read != filesize - CACHED_HEADER_SIZE) goto error; @@ -658,7 +658,7 @@ static int render_font_load_cached(render_font *font, mame_file *file, UINT32 ha /* if we don't have a subtable yet, make one */ if (font->chars[chnum / 256] == NULL) { - font->chars[chnum / 256] = malloc_or_die(256 * sizeof(font->chars[0][0])); + font->chars[chnum / 256] = (render_font_char *)malloc_or_die(256 * sizeof(font->chars[0][0])); memset(font->chars[chnum / 256], 0, 256 * sizeof(font->chars[0][0])); } @@ -728,11 +728,11 @@ static int render_font_save_cached(render_font *font, const char *filename, UINT } /* allocate an array to hold the character data */ - chartable = malloc_or_die(numchars * CACHED_CHAR_SIZE); + chartable = (UINT8 *)malloc_or_die(numchars * CACHED_CHAR_SIZE); memset(chartable, 0, numchars * CACHED_CHAR_SIZE); /* allocate a temp buffer to compress into */ - tempbuffer = malloc_or_die(65536); + tempbuffer = (UINT8 *)malloc_or_die(65536); /* write the header */ dest = tempbuffer; diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index bda3443ba3e..f11c5bf075e 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -217,7 +217,7 @@ INLINE void reduce_fraction(int *num, int *den) INLINE const char *copy_string(const char *string) { - char *newstring = malloc_or_die(strlen(string) + 1); + char *newstring = (char *)malloc_or_die(strlen(string) + 1); strcpy(newstring, string); return newstring; } @@ -348,7 +348,7 @@ void layout_view_recompute(layout_view *view, int layerconfig) static void layout_element_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param) { - element_texture *elemtex = param; + element_texture *elemtex = (element_texture *)param; element_component *component; /* iterate over components that are part of the current state */ @@ -1340,7 +1340,7 @@ static int get_variable_value(const machine_config *config, const char *string, for (device = video_screen_first(config); device != NULL; device = video_screen_next(device)) { int scrnum = device_list_index(config->devicelist, VIDEO_SCREEN, device->tag); - const screen_config *scrconfig = device->inline_config; + const screen_config *scrconfig = (const screen_config *)device->inline_config; /* native X aspect factor */ sprintf(temp, "~scr%dnativexaspect~", scrnum); @@ -1509,7 +1509,7 @@ layout_file *layout_file_load(const machine_config *config, const char *dirname, return NULL; /* allocate the layout group object first */ - file = malloc_or_die(sizeof(*file)); + file = (layout_file *)malloc_or_die(sizeof(*file)); memset(file, 0, sizeof(*file)); /* find the layout node */ @@ -1579,7 +1579,7 @@ static layout_element *load_layout_element(const machine_config *config, xml_dat int first; /* allocate a new element */ - element = malloc_or_die(sizeof(*element)); + element = (layout_element *)malloc_or_die(sizeof(*element)); memset(element, 0, sizeof(*element)); /* extract the name */ @@ -1642,7 +1642,7 @@ static layout_element *load_layout_element(const machine_config *config, xml_dat } /* allocate an array of element textures for the states */ - element->elemtex = malloc_or_die((element->maxstate + 1) * sizeof(element->elemtex[0])); + element->elemtex = (element_texture *)malloc_or_die((element->maxstate + 1) * sizeof(element->elemtex[0])); for (state = 0; state <= element->maxstate; state++) { element->elemtex[state].element = element; @@ -1668,7 +1668,7 @@ static element_component *load_element_component(const machine_config *config, x element_component *component; /* allocate memory for the component */ - component = malloc_or_die(sizeof(*component)); + component = (element_component *)malloc_or_die(sizeof(*component)); memset(component, 0, sizeof(*component)); /* fetch common data */ @@ -1699,7 +1699,7 @@ static element_component *load_element_component(const machine_config *config, x /* allocate a copy of the string */ component->type = COMPONENT_TYPE_TEXT; - string = malloc_or_die(strlen(text) + 1); + string = (char *)malloc_or_die(strlen(text) + 1); strcpy(string, text); component->string = string; } @@ -1756,7 +1756,7 @@ static layout_view *load_layout_view(const machine_config *config, xml_data_node int layer; /* first allocate memory */ - view = malloc_or_die(sizeof(*view)); + view = (layout_view *)malloc_or_die(sizeof(*view)); memset(view, 0, sizeof(*view)); /* allocate a copy of the name */ @@ -1810,7 +1810,7 @@ static view_item *load_view_item(const machine_config *config, xml_data_node *it const char *name; /* allocate a new item */ - item = malloc_or_die(sizeof(*item)); + item = (view_item *)malloc_or_die(sizeof(*item)); memset(item, 0, sizeof(*item)); /* allocate a copy of the output name */ diff --git a/src/emu/rendutil.c b/src/emu/rendutil.c index 7a96efc749b..cb7f5eabd68 100644 --- a/src/emu/rendutil.c +++ b/src/emu/rendutil.c @@ -83,9 +83,9 @@ void render_resample_argb_bitmap_hq(void *dest, UINT32 drowpixels, UINT32 dwidth /* if the source is higher res than the target, use full averaging */ if (dx > 0x1000 || dy > 0x1000) - resample_argb_bitmap_average(dest, drowpixels, dwidth, dheight, sbase, source->rowpixels, swidth, sheight, color, dx, dy); + resample_argb_bitmap_average((UINT32 *)dest, drowpixels, dwidth, dheight, sbase, source->rowpixels, swidth, sheight, color, dx, dy); else - resample_argb_bitmap_bilinear(dest, drowpixels, dwidth, dheight, sbase, source->rowpixels, swidth, sheight, color, dx, dy); + resample_argb_bitmap_bilinear((UINT32 *)dest, drowpixels, dwidth, dheight, sbase, source->rowpixels, swidth, sheight, color, dx, dy); } diff --git a/src/emu/restrack.c b/src/emu/restrack.c index 360438d5bbc..1f899cb5efb 100644 --- a/src/emu/restrack.c +++ b/src/emu/restrack.c @@ -20,13 +20,13 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef enum _memory_block_overlap memory_block_overlap; enum _memory_block_overlap { OVERLAP_NONE, OVERLAP_PARTIAL, OVERLAP_FULL }; +typedef enum _memory_block_overlap memory_block_overlap; @@ -260,7 +260,7 @@ char *auto_strdup_allow_null_file_line(const char *str, const char *file, int li astring *auto_astring_alloc_file_line(const char *file, int line) { - return restrack_register_object(OBJTYPE_ASTRING, astring_alloc(), 0, file, line); + return (astring *)restrack_register_object(OBJTYPE_ASTRING, astring_alloc(), 0, file, line); } @@ -271,7 +271,7 @@ astring *auto_astring_alloc_file_line(const char *file, int line) bitmap_t *auto_bitmap_alloc_file_line(int width, int height, bitmap_format format, const char *file, int line) { - return restrack_register_object(OBJTYPE_BITMAP, bitmap_alloc(width, height, format), width * height, file, line); + return (bitmap_t *)restrack_register_object(OBJTYPE_BITMAP, bitmap_alloc(width, height, format), width * height, file, line); } @@ -317,7 +317,7 @@ void validate_auto_malloc_memory(void *memory, size_t memory_size) static void astring_destructor(void *object, size_t size) { - astring_free(object); + astring_free((astring *)object); } @@ -328,7 +328,7 @@ static void astring_destructor(void *object, size_t size) static void bitmap_destructor(void *object, size_t size) { - bitmap_free(object); + bitmap_free((bitmap_t *)object); } @@ -341,7 +341,7 @@ static memory_block_overlap pool_contains_block(object_pool *pool, void *ptr, si { memory_block_overlap overlap = OVERLAP_NONE; object_pool_iterator *iter; - UINT8 *ptrstart = ptr; + UINT8 *ptrstart = (UINT8 *)ptr; UINT8 *ptrend = ptrstart + size - 1; void *blockptr = NULL; size_t blocksize = 0; diff --git a/src/emu/romload.c b/src/emu/romload.c index 5faec25cfe5..140190e4669 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -125,7 +125,7 @@ void set_disk_handle(const char *region, mame_file *file, chd_file *chdfile) chd.origfile = file; /* we're okay, add to the list of disks */ - *chd_list_tailptr = auto_malloc(sizeof(**chd_list_tailptr)); + *chd_list_tailptr = (open_chd *)auto_malloc(sizeof(**chd_list_tailptr)); **chd_list_tailptr = chd; chd_list_tailptr = &(*chd_list_tailptr)->next; } @@ -165,7 +165,7 @@ const rom_source *rom_first_source(const game_driver *drv, const machine_config if (config != NULL) for (device = config->devicelist; device != NULL; device = device->next) { - const rom_entry *devromp = device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); + const rom_entry *devromp = (const rom_entry *)device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); if (devromp != NULL) return (rom_source *)device; } @@ -191,7 +191,7 @@ const rom_source *rom_next_source(const game_driver *drv, const machine_config * /* look for further devices with ROM definitions */ for ( ; device != NULL; device = device->next) { - const rom_entry *devromp = device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); + const rom_entry *devromp = (const rom_entry *)device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION); if (devromp != NULL) return (rom_source *)device; } @@ -211,7 +211,7 @@ const rom_entry *rom_first_region(const game_driver *drv, const rom_source *sour if (source == NULL || rom_source_is_gamedrv(drv, source)) romp = drv->rom; else - romp = device_get_info_ptr((const device_config *)source, DEVINFO_PTR_ROM_REGION); + romp = (const rom_entry *)device_get_info_ptr((const device_config *)source, DEVINFO_PTR_ROM_REGION); return (romp != NULL && !ROMENTRY_ISEND(romp)) ? romp : NULL; } @@ -757,7 +757,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) /* use a temporary buffer for complex loads */ tempbufsize = MIN(TEMPBUFFER_MAX_SIZE, numbytes); - tempbuf = malloc_or_die(tempbufsize); + tempbuf = (UINT8 *)malloc_or_die(tempbufsize); /* chunky reads for complex loads */ skip += groupsize; @@ -1225,7 +1225,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, /* we're okay, add to the list of disks */ LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp))); - *chd_list_tailptr = auto_malloc(sizeof(**chd_list_tailptr)); + *chd_list_tailptr = (open_chd *)auto_malloc(sizeof(**chd_list_tailptr)); **chd_list_tailptr = chd; chd_list_tailptr = &(*chd_list_tailptr)->next; } diff --git a/src/emu/sound.c b/src/emu/sound.c index b8767876fae..be75b8f75b0 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -166,7 +166,7 @@ INLINE speaker_info *index_to_input(running_machine *machine, int index, int *in /* scan through the speakers until we find the indexed input */ for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) { - speaker_info *info = curspeak->token; + speaker_info *info = (speaker_info *)curspeak->token; if (index < count + info->inputs) { *input = index - count; @@ -202,9 +202,9 @@ void sound_init(running_machine *machine) VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config))); /* allocate memory for mix buffers */ - leftmix = auto_malloc(machine->sample_rate * sizeof(*leftmix)); - rightmix = auto_malloc(machine->sample_rate * sizeof(*rightmix)); - finalmix = auto_malloc(machine->sample_rate * sizeof(*finalmix)); + leftmix = (INT32 *)auto_malloc(machine->sample_rate * sizeof(*leftmix)); + rightmix = (INT32 *)auto_malloc(machine->sample_rate * sizeof(*rightmix)); + finalmix = (INT16 *)auto_malloc(machine->sample_rate * sizeof(*finalmix)); /* allocate a global timer for sound timing */ sound_update_timer = timer_alloc(machine, sound_update, NULL); @@ -270,7 +270,7 @@ static DEVICE_START( sound ) assert(device->machine->config != NULL); /* get pointers to our data */ - config = device->inline_config; + config = (const sound_config *)device->inline_config; classdata = get_class_data(device); /* get the chip's start function */ @@ -324,7 +324,7 @@ static DEVICE_START( sound ) static DEVICE_CUSTOM_CONFIG( sound ) { - sound_config *config = device->inline_config; + sound_config *config = (sound_config *)device->inline_config; switch (entrytype) { @@ -341,7 +341,7 @@ static DEVICE_CUSTOM_CONFIG( sound ) /* allocate a new route */ for (routeptr = &config->routelist; *routeptr != NULL; routeptr = &(*routeptr)->next) ; - *routeptr = malloc_or_die(sizeof(**routeptr)); + *routeptr = (sound_route *)malloc_or_die(sizeof(**routeptr)); (*routeptr)->next = NULL; (*routeptr)->output = output; (*routeptr)->input = input; @@ -372,7 +372,7 @@ static DEVICE_CUSTOM_CONFIG( sound ) DEVICE_GET_INFO( sound ) { - const sound_config *config = (device != NULL) ? device->inline_config : NULL; + const sound_config *config = (device != NULL) ? (const sound_config *)device->inline_config : NULL; switch (state) { @@ -425,7 +425,7 @@ static void route_sound(running_machine *machine) /* first count up the inputs for each speaker */ for (sound = sound_first(machine->config); sound != NULL; sound = sound_next(sound)) { - const sound_config *config = sound->inline_config; + const sound_config *config = (const sound_config *)sound->inline_config; int numoutputs = stream_get_device_outputs(sound); const sound_route *route; @@ -452,7 +452,7 @@ static void route_sound(running_machine *machine) { info->mixer_stream = stream_create(curspeak, info->inputs, 1, machine->sample_rate, info, mixer_update); state_save_register_postload(machine, mixer_postload, info->mixer_stream); - info->input = auto_malloc(info->inputs * sizeof(*info->input)); + info->input = (speaker_input *)auto_malloc(info->inputs * sizeof(*info->input)); info->inputs = 0; } else @@ -462,7 +462,7 @@ static void route_sound(running_machine *machine) /* iterate again over all the sound chips */ for (sound = sound_first(machine->config); sound != NULL; sound = sound_next(sound)) { - const sound_config *config = sound->inline_config; + const sound_config *config = (const sound_config *)sound->inline_config; int numoutputs = stream_get_device_outputs(sound); const sound_route *route; @@ -693,7 +693,7 @@ static TIMER_CALLBACK( sound_update ) /* force all the speaker streams to generate the proper number of samples */ for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) { - speaker_info *spk = curspeak->token; + speaker_info *spk = (speaker_info *)curspeak->token; const stream_sample_t *stream_buf; /* get the output buffer */ @@ -801,7 +801,7 @@ static TIMER_CALLBACK( sound_update ) static STREAM_UPDATE( mixer_update ) { - speaker_info *speaker = param; + speaker_info *speaker = (speaker_info *)param; int numinputs = speaker->inputs; int pos; @@ -828,7 +828,7 @@ static STREAM_UPDATE( mixer_update ) static STATE_POSTLOAD( mixer_postload ) { - sound_stream *stream = param; + sound_stream *stream = (sound_stream *)param; stream_set_sample_rate(stream, machine->sample_rate); } @@ -845,10 +845,10 @@ static STATE_POSTLOAD( mixer_postload ) static DEVICE_START( speaker_output ) { - speaker_info *info = device->token; + speaker_info *info = (speaker_info *)device->token; /* copy in all the relevant info */ - info->speaker = device->inline_config; + info->speaker = (const speaker_config *)device->inline_config; info->tag = device->tag; } @@ -937,7 +937,7 @@ int sound_get_user_gain_count(running_machine *machine) /* count up the number of speaker inputs */ for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) { - speaker_info *info = curspeak->token; + speaker_info *info = (speaker_info *)curspeak->token; count += info->inputs; } return count; diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index 947bc217445..1370586e443 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -157,7 +157,7 @@ static void update_prd_changed_timer(cdp1869_t *cdp1869) static TIMER_CALLBACK( prd_changed_tick ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; cdp1869_t *cdp1869 = get_safe_token(device); devcb_call_write_line(&cdp1869->out_prd_func, param); diff --git a/src/emu/sound/filter.c b/src/emu/sound/filter.c index 54cd712030b..f59a1e8082d 100644 --- a/src/emu/sound/filter.c +++ b/src/emu/sound/filter.c @@ -2,7 +2,7 @@ #include "filter.h" static filter* filter_alloc(void) { - filter* f = malloc_or_die(sizeof(filter)); + filter* f = (filter *)malloc_or_die(sizeof(filter)); return f; } @@ -20,7 +20,7 @@ void filter_state_reset(filter* f, filter_state* s) { filter_state* filter_state_alloc(void) { int i; - filter_state* s = malloc_or_die(sizeof(filter_state)); + filter_state* s = (filter_state *)malloc_or_die(sizeof(filter_state)); s->prev_mac = 0; for(i=0;ixprev[i] = 0; diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c index 0fb54399802..786347c73d9 100644 --- a/src/emu/sound/flt_rc.c +++ b/src/emu/sound/flt_rc.c @@ -28,7 +28,7 @@ static STREAM_UPDATE( filter_rc_update ) { stream_sample_t *src = inputs[0]; stream_sample_t *dst = outputs[0]; - filter_rc_state *info = param; + filter_rc_state *info = (filter_rc_state *)param; int memory = info->memory; switch (info->type) @@ -93,7 +93,7 @@ static void set_RC_info(filter_rc_state *info, int type, double R1, double R2, d static DEVICE_START( filter_rc ) { filter_rc_state *info = get_safe_token(device); - const flt_rc_config *conf = device->static_config; + const flt_rc_config *conf = (const flt_rc_config *)device->static_config; info->device = device; info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_rc_update); diff --git a/src/emu/sound/flt_vol.c b/src/emu/sound/flt_vol.c index c69ff8a19c6..9ba9aa4b746 100644 --- a/src/emu/sound/flt_vol.c +++ b/src/emu/sound/flt_vol.c @@ -25,7 +25,7 @@ static STREAM_UPDATE( filter_volume_update ) { stream_sample_t *src = inputs[0]; stream_sample_t *dst = outputs[0]; - filter_volume_state *info = param; + filter_volume_state *info = (filter_volume_state *)param; while (samples--) *dst++ = (*src++ * info->gain) >> 8; diff --git a/src/emu/sound/wavwrite.c b/src/emu/sound/wavwrite.c index 91de42ef3fc..53005fabf2d 100644 --- a/src/emu/sound/wavwrite.c +++ b/src/emu/sound/wavwrite.c @@ -126,7 +126,7 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift) if (!wav) return; /* allocate temp memory */ - temp = malloc(samples * sizeof(temp[0])); + temp = (INT16 *)malloc(samples * sizeof(temp[0])); if (!temp) return; @@ -154,7 +154,7 @@ void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples) if (!wav) return; /* allocate temp memory */ - temp = malloc(samples * 2 * sizeof(temp[0])); + temp = (INT16 *)malloc(samples * 2 * sizeof(temp[0])); if (!temp) return; @@ -179,7 +179,7 @@ void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, in if (!wav) return; /* allocate temp memory */ - temp = malloc(samples * 2 * sizeof(temp[0])); + temp = (INT16 *)malloc(samples * 2 * sizeof(temp[0])); if (!temp) return; diff --git a/src/emu/state.c b/src/emu/state.c index 1bd237f9e3a..cf7a82f07ed 100644 --- a/src/emu/state.c +++ b/src/emu/state.c @@ -133,19 +133,19 @@ INLINE void flip_data(state_entry *entry) switch (entry->typesize) { case 2: - data16 = entry->data; + data16 = (UINT16 *)entry->data; for (count = 0; count < entry->typecount; count++) data16[count] = FLIPENDIAN_INT16(data16[count]); break; case 4: - data32 = entry->data; + data32 = (UINT32 *)entry->data; for (count = 0; count < entry->typecount; count++) data32[count] = FLIPENDIAN_INT32(data32[count]); break; case 8: - data64 = entry->data; + data64 = (UINT64 *)entry->data; for (count = 0; count < entry->typecount; count++) data64[count] = FLIPENDIAN_INT64(data64[count]); break; @@ -165,7 +165,7 @@ INLINE void flip_data(state_entry *entry) void state_init(running_machine *machine) { - machine->state_data = auto_malloc(sizeof(*machine->state_data)); + machine->state_data = (state_private *)auto_malloc(sizeof(*machine->state_data)); memset(machine->state_data, 0, sizeof(*machine->state_data)); } @@ -264,7 +264,7 @@ void state_save_register_memory(running_machine *machine, const char *module, co /* didn't find one; allocate a new one */ next = *entryptr; - *entryptr = malloc_or_die(sizeof(**entryptr)); + *entryptr = (state_entry *)malloc_or_die(sizeof(**entryptr)); memset(*entryptr, 0, sizeof(**entryptr)); /* fill in the rest */ @@ -314,7 +314,7 @@ void state_save_register_presave(running_machine *machine, state_presave_func fu fatalerror("Duplicate save state function (%p, %p)", param, func); /* allocate a new entry */ - *cbptr = malloc_or_die(sizeof(state_callback)); + *cbptr = (state_callback *)malloc_or_die(sizeof(state_callback)); /* fill it in */ (*cbptr)->next = NULL; @@ -345,7 +345,7 @@ void state_save_register_postload(running_machine *machine, state_postload_func fatalerror("Duplicate save state function (%p, %p)", param, func); /* allocate a new entry */ - *cbptr = malloc_or_die(sizeof(state_callback)); + *cbptr = (state_callback *)malloc_or_die(sizeof(state_callback)); /* fill it in */ (*cbptr)->next = NULL; diff --git a/src/emu/state.h b/src/emu/state.h index 352af38780b..3b1df79fce7 100644 --- a/src/emu/state.h +++ b/src/emu/state.h @@ -52,7 +52,7 @@ typedef enum _state_save_error state_save_error; #define IS_COMPATIBLE_TYPE(_valtype, _checktype) \ - (sizeof(_valtype) == sizeof(_checktype) && TYPES_COMPATIBLE(typeof(_valtype), _checktype)) + (sizeof(_valtype) == sizeof(_checktype) && TYPES_COMPATIBLE(_valtype, _checktype)) #define IS_VALID_SAVE_TYPE(_valtype) \ (IS_COMPATIBLE_TYPE(_valtype, double) || IS_COMPATIBLE_TYPE(_valtype, float) || \ diff --git a/src/emu/streams.c b/src/emu/streams.c index 639586d8089..829cbed2a51 100644 --- a/src/emu/streams.c +++ b/src/emu/streams.c @@ -218,7 +218,7 @@ void streams_init(running_machine *machine) streams_private *strdata; /* allocate memory for our private data */ - strdata = auto_malloc(sizeof(*strdata)); + strdata = (streams_private *)auto_malloc(sizeof(*strdata)); memset(strdata, 0, sizeof(*strdata)); /* reset globals */ @@ -343,7 +343,7 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs char statetag[30]; /* allocate memory */ - stream = auto_malloc(sizeof(*stream)); + stream = (sound_stream *)auto_malloc(sizeof(*stream)); memset(stream, 0, sizeof(*stream)); VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream)); @@ -365,9 +365,9 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs /* allocate space for the inputs */ if (inputs > 0) { - stream->input = auto_malloc(inputs * sizeof(*stream->input)); + stream->input = (stream_input *)auto_malloc(inputs * sizeof(*stream->input)); memset(stream->input, 0, inputs * sizeof(*stream->input)); - stream->input_array = auto_malloc(inputs * sizeof(*stream->input_array)); + stream->input_array = (stream_sample_t **)auto_malloc(inputs * sizeof(*stream->input_array)); memset(stream->input_array, 0, inputs * sizeof(*stream->input_array)); } @@ -382,9 +382,9 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs /* allocate space for the outputs */ if (outputs > 0) { - stream->output = auto_malloc(outputs * sizeof(*stream->output)); + stream->output = (stream_output *)auto_malloc(outputs * sizeof(*stream->output)); memset(stream->output, 0, outputs * sizeof(*stream->output)); - stream->output_array = auto_malloc(outputs * sizeof(*stream->output_array)); + stream->output_array = (stream_sample_t **)auto_malloc(outputs * sizeof(*stream->output_array)); memset(stream->output_array, 0, outputs * sizeof(*stream->output_array)); } @@ -698,7 +698,7 @@ void stream_set_output_gain(sound_stream *stream, int output, float gain) static STATE_POSTLOAD( stream_postload ) { streams_private *strdata = machine->streams_data; - sound_stream *stream = param; + sound_stream *stream = (sound_stream *)param; int outputnum; /* recompute the same rate information */ @@ -737,7 +737,7 @@ static void allocate_resample_buffers(streams_private *strdata, sound_stream *st for (inputnum = 0; inputnum < stream->inputs; inputnum++) { stream_input *input = &stream->input[inputnum]; - input->resample = auto_realloc(input->resample, stream->resample_bufalloc * sizeof(input->resample[0])); + input->resample = (stream_sample_t *)auto_realloc(input->resample, stream->resample_bufalloc * sizeof(input->resample[0])); } } } @@ -767,7 +767,7 @@ static void allocate_output_buffers(streams_private *strdata, sound_stream *stre for (outputnum = 0; outputnum < stream->outputs; outputnum++) { stream_output *output = &stream->output[outputnum]; - output->buffer = auto_realloc(output->buffer, stream->output_bufalloc * sizeof(output->buffer[0])); + output->buffer = (stream_sample_t *)auto_realloc(output->buffer, stream->output_bufalloc * sizeof(output->buffer[0])); memset(&output->buffer[oldsize], 0, (stream->output_bufalloc - oldsize) * sizeof(output->buffer[0])); } } diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index b7d7f1fe583..f776e6b2501 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -324,7 +324,7 @@ tilemap *tilemap_create(running_machine *machine, tile_get_info_func tile_get_in int group; /* allocate the tilemap itself */ - tmap = malloc_or_die(sizeof(*tmap)); + tmap = (tilemap *)malloc_or_die(sizeof(*tmap)); memset(tmap, 0, sizeof(*tmap)); /* fill in the basic metrics */ @@ -354,18 +354,18 @@ tilemap *tilemap_create(running_machine *machine, tile_get_info_func tile_get_in /* initialize scroll information */ tmap->scrollrows = 1; tmap->scrollcols = 1; - tmap->rowscroll = malloc_or_die(tmap->height * sizeof(*tmap->rowscroll)); + tmap->rowscroll = (INT32 *)malloc_or_die(tmap->height * sizeof(*tmap->rowscroll)); memset(tmap->rowscroll, 0, tmap->height * sizeof(*tmap->rowscroll)); - tmap->colscroll = malloc_or_die(tmap->width * sizeof(*tmap->colscroll)); + tmap->colscroll = (INT32 *)malloc_or_die(tmap->width * sizeof(*tmap->colscroll)); memset(tmap->colscroll, 0, tmap->width * sizeof(*tmap->colscroll)); /* allocate the pixel data cache */ tmap->pixmap = bitmap_alloc(tmap->width, tmap->height, BITMAP_FORMAT_INDEXED16); /* allocate transparency mapping data */ - tmap->tileflags = malloc_or_die(tmap->max_logical_index); + tmap->tileflags = (UINT8 *)malloc_or_die(tmap->max_logical_index); tmap->flagsmap = bitmap_alloc(tmap->width, tmap->height, BITMAP_FORMAT_INDEXED8); - tmap->pen_to_flags = malloc_or_die(sizeof(tmap->pen_to_flags[0]) * MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); + tmap->pen_to_flags = (UINT8 *)malloc_or_die(sizeof(tmap->pen_to_flags[0]) * MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); memset(tmap->pen_to_flags, 0, sizeof(tmap->pen_to_flags[0]) * MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS); for (group = 0; group < TILEMAP_NUM_GROUPS; group++) tilemap_map_pens_to_layer(tmap, group, 0, 0, TILEMAP_PIXEL_LAYER0); @@ -1095,7 +1095,7 @@ static void tilemap_exit(running_machine *machine) static STATE_POSTLOAD( tilemap_postload ) { /* recompute the mappings for this tilemap */ - tilemap *tmap = param; + tilemap *tmap = (tilemap *)param; mappings_update(tmap); } @@ -1157,8 +1157,8 @@ static void mappings_create(tilemap *tmap) tmap->max_memory_index++; /* allocate the necessary mappings */ - tmap->memory_to_logical = malloc_or_die(tmap->max_memory_index * sizeof(*tmap->memory_to_logical)); - tmap->logical_to_memory = malloc_or_die(tmap->max_logical_index * sizeof(*tmap->logical_to_memory)); + tmap->memory_to_logical = (tilemap_logical_index *)malloc_or_die(tmap->max_memory_index * sizeof(*tmap->memory_to_logical)); + tmap->logical_to_memory = (tilemap_memory_index *)malloc_or_die(tmap->max_logical_index * sizeof(*tmap->logical_to_memory)); /* update the mappings */ mappings_update(tmap); @@ -1969,7 +1969,7 @@ static void scanline_draw_masked_null(void *dest, const UINT16 *source, const UI static void scanline_draw_opaque_ind16(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { - UINT16 *dest = _dest; + UINT16 *dest = (UINT16 *)_dest; int pal = pcode >> 16; int i; @@ -2012,7 +2012,7 @@ static void scanline_draw_opaque_ind16(void *_dest, const UINT16 *source, int co static void scanline_draw_masked_ind16(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { - UINT16 *dest = _dest; + UINT16 *dest = (UINT16 *)_dest; int pal = pcode >> 16; int i; @@ -2046,7 +2046,7 @@ static void scanline_draw_masked_ind16(void *_dest, const UINT16 *source, const static void scanline_draw_opaque_rgb16(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT16 *dest = _dest; + UINT16 *dest = (UINT16 *)_dest; int i; /* priority case */ @@ -2076,7 +2076,7 @@ static void scanline_draw_opaque_rgb16(void *_dest, const UINT16 *source, int co static void scanline_draw_masked_rgb16(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT16 *dest = _dest; + UINT16 *dest = (UINT16 *)_dest; int i; /* priority case */ @@ -2108,7 +2108,7 @@ static void scanline_draw_masked_rgb16(void *_dest, const UINT16 *source, const static void scanline_draw_opaque_rgb16_alpha(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT16 *dest = _dest; + UINT16 *dest = (UINT16 *)_dest; int i; /* priority case */ @@ -2139,7 +2139,7 @@ static void scanline_draw_opaque_rgb16_alpha(void *_dest, const UINT16 *source, static void scanline_draw_masked_rgb16_alpha(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT16 *dest = _dest; + UINT16 *dest = (UINT16 *)_dest; int i; /* priority case */ @@ -2171,7 +2171,7 @@ static void scanline_draw_masked_rgb16_alpha(void *_dest, const UINT16 *source, static void scanline_draw_opaque_rgb32(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT32 *dest = _dest; + UINT32 *dest = (UINT32 *)_dest; int i; /* priority case */ @@ -2201,7 +2201,7 @@ static void scanline_draw_opaque_rgb32(void *_dest, const UINT16 *source, int co static void scanline_draw_masked_rgb32(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT32 *dest = _dest; + UINT32 *dest = (UINT32 *)_dest; int i; /* priority case */ @@ -2233,7 +2233,7 @@ static void scanline_draw_masked_rgb32(void *_dest, const UINT16 *source, const static void scanline_draw_opaque_rgb32_alpha(void *_dest, const UINT16 *source, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT32 *dest = _dest; + UINT32 *dest = (UINT32 *)_dest; int i; /* priority case */ @@ -2264,7 +2264,7 @@ static void scanline_draw_opaque_rgb32_alpha(void *_dest, const UINT16 *source, static void scanline_draw_masked_rgb32_alpha(void *_dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, const pen_t *pens, UINT8 *pri, UINT32 pcode, UINT8 alpha) { const pen_t *clut = &pens[pcode >> 16]; - UINT32 *dest = _dest; + UINT32 *dest = (UINT32 *)_dest; int i; /* priority case */ diff --git a/src/emu/timer.c b/src/emu/timer.c index e6e7ae3b935..0c5ddcb951b 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -300,7 +300,7 @@ void timer_init(running_machine *machine) int i; /* allocate global data */ - global = machine->timer_data = auto_malloc(sizeof(*global)); + global = machine->timer_data = (timer_private *)auto_malloc(sizeof(*global)); memset(global, 0, sizeof(*global)); /* we need to wait until the first call to timer_cyclestorun before using real CPU times */ @@ -339,7 +339,7 @@ void timer_init(running_machine *machine) void timer_destructor(void *ptr, size_t size) { - timer_remove(ptr); + timer_remove((emu_timer *)ptr); } @@ -1056,9 +1056,9 @@ attotime timer_device_firetime(const device_config *timer) static TIMER_CALLBACK( periodic_timer_device_timer_callback ) { - const device_config *timer = ptr; + const device_config *timer = (const device_config *)ptr; timer_state *state = get_safe_token(timer); - timer_config *config = timer->inline_config; + timer_config *config = (timer_config *)timer->inline_config; /* call the real callback */ config->callback(timer, state->ptr, state->param); @@ -1074,9 +1074,9 @@ static TIMER_CALLBACK( periodic_timer_device_timer_callback ) static TIMER_CALLBACK( scanline_timer_device_timer_callback ) { int next_vpos; - const device_config *timer = ptr; + const device_config *timer = (const device_config *)ptr; timer_state *state = get_safe_token(timer); - timer_config *config = timer->inline_config; + timer_config *config = (timer_config *)timer->inline_config; /* get the screen device and verify it */ const device_config *screen = devtag_get_device(timer->machine, config->screen); @@ -1173,7 +1173,7 @@ static DEVICE_START( timer ) assert(device->machine->config != NULL); /* get and validate the configuration */ - config = device->inline_config; + config = (timer_config *)device->inline_config; assert(config->type == TIMER_TYPE_PERIODIC || config->type == TIMER_TYPE_SCANLINE || config->type == TIMER_TYPE_GENERIC); assert(config->callback != NULL); diff --git a/src/emu/ui.c b/src/emu/ui.c index 11a6977c2e1..efa8c8032b3 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1059,7 +1059,7 @@ astring *game_info_astring(running_machine *machine, astring *string) for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) { - const screen_config *scrconfig = screen->inline_config; + const screen_config *scrconfig = (const screen_config *)screen->inline_config; if (scrcount > 1) { @@ -1414,7 +1414,7 @@ const slider_state *ui_get_slider_list(void) static slider_state *slider_alloc(const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg) { int size = sizeof(slider_state) + strlen(title); - slider_state *state = auto_malloc(size); + slider_state *state = (slider_state *)auto_malloc(size); memset(state, 0, size); state->minval = minval; @@ -1488,7 +1488,7 @@ static slider_state *slider_init(running_machine *machine) /* add screen parameters */ for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) { - const screen_config *scrconfig = device->inline_config; + const screen_config *scrconfig = (const screen_config *)device->inline_config; int defxscale = floor(scrconfig->xscale * 1000.0f + 0.5f); int defyscale = floor(scrconfig->yscale * 1000.0f + 0.5f); int defxoffset = floor(scrconfig->xoffset * 1000.0f + 0.5f); @@ -1531,7 +1531,7 @@ static slider_state *slider_init(running_machine *machine) for (device = device_list_first(machine->config->devicelist, LASERDISC); device != NULL; device = device_list_next(device, LASERDISC)) { - const laserdisc_config *config = device->inline_config; + const laserdisc_config *config = (const laserdisc_config *)device->inline_config; if (config->overupdate != NULL) { int defxscale = floor(config->overscalex * 1000.0f + 0.5f); @@ -1558,7 +1558,7 @@ static slider_state *slider_init(running_machine *machine) for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) { - const screen_config *scrconfig = device->inline_config; + const screen_config *scrconfig = (const screen_config *)device->inline_config; if (scrconfig->type == SCREEN_TYPE_VECTOR) { /* add flicker control */ @@ -1628,7 +1628,7 @@ static INT32 slider_mixervol(running_machine *machine, void *arg, astring *strin static INT32 slider_adjuster(running_machine *machine, void *arg, astring *string, INT32 newval) { - const input_field_config *field = arg; + const input_field_config *field = (const input_field_config *)arg; input_field_user_settings settings; input_field_get_user_settings(field, &settings); @@ -1665,8 +1665,8 @@ static INT32 slider_overclock(running_machine *machine, void *arg, astring *stri static INT32 slider_refresh(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; - const screen_config *scrconfig = screen->inline_config; + const device_config *screen = (const device_config *)arg; + const screen_config *scrconfig = (const screen_config *)screen->inline_config; double defrefresh = ATTOSECONDS_TO_HZ(scrconfig->refresh); double refresh; @@ -1692,7 +1692,7 @@ static INT32 slider_refresh(running_machine *machine, void *arg, astring *string static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1715,7 +1715,7 @@ static INT32 slider_brightness(running_machine *machine, void *arg, astring *str static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1737,7 +1737,7 @@ static INT32 slider_contrast(running_machine *machine, void *arg, astring *strin static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1760,7 +1760,7 @@ static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1783,7 +1783,7 @@ static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1806,7 +1806,7 @@ static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1829,7 +1829,7 @@ static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *screen = arg; + const device_config *screen = (const device_config *)arg; render_container *container = render_container_get_screen(screen); render_container_user_settings settings; @@ -1852,7 +1852,7 @@ static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string static INT32 slider_overxscale(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *laserdisc = arg; + const device_config *laserdisc = (const device_config *)arg; laserdisc_config settings; laserdisc_get_config(laserdisc, &settings); @@ -1874,7 +1874,7 @@ static INT32 slider_overxscale(running_machine *machine, void *arg, astring *str static INT32 slider_overyscale(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *laserdisc = arg; + const device_config *laserdisc = (const device_config *)arg; laserdisc_config settings; laserdisc_get_config(laserdisc, &settings); @@ -1896,7 +1896,7 @@ static INT32 slider_overyscale(running_machine *machine, void *arg, astring *str static INT32 slider_overxoffset(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *laserdisc = arg; + const device_config *laserdisc = (const device_config *)arg; laserdisc_config settings; laserdisc_get_config(laserdisc, &settings); @@ -1918,7 +1918,7 @@ static INT32 slider_overxoffset(running_machine *machine, void *arg, astring *st static INT32 slider_overyoffset(running_machine *machine, void *arg, astring *string, INT32 newval) { - const device_config *laserdisc = arg; + const device_config *laserdisc = (const device_config *)arg; laserdisc_config settings; laserdisc_get_config(laserdisc, &settings); diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c index d9be2dca061..7c9e7bccf5e 100644 --- a/src/emu/uigfx.c +++ b/src/emu/uigfx.c @@ -379,8 +379,8 @@ static void palette_handle_keys(running_machine *machine, ui_gfx_state *state) /* clamp within range */ if (state->palette.which < 0) state->palette.which = 1; - if (state->palette.which > (machine->colortable != NULL)) - state->palette.which = (machine->colortable != NULL); + if (state->palette.which > (int)(machine->colortable != NULL)) + state->palette.which = (int)(machine->colortable != NULL); /* cache some info in locals */ total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->config->total_colors; diff --git a/src/emu/uiinput.c b/src/emu/uiinput.c index bb7f4199ac2..bc6d42d2595 100644 --- a/src/emu/uiinput.c +++ b/src/emu/uiinput.c @@ -76,7 +76,7 @@ static void ui_input_frame_update(running_machine *machine); void ui_input_init(running_machine *machine) { /* create the private data */ - machine->ui_input_data = auto_malloc(sizeof(*machine->ui_input_data)); + machine->ui_input_data = (ui_input_private *)auto_malloc(sizeof(*machine->ui_input_data)); memset(machine->ui_input_data, 0, sizeof(*machine->ui_input_data)); machine->ui_input_data->current_mouse_x = -1; machine->ui_input_data->current_mouse_y = -1; diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index af03a9d31fd..fa887449495 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -140,7 +140,7 @@ struct _input_item_data { input_item_data * next; /* pointer to next item in the list */ const void * ref; /* reference to type description for global inputs or field for game inputs */ - int seqtype; /* sequence type */ + input_seq_type seqtype; /* sequence type */ input_seq seq; /* copy of the live sequence */ const input_seq * defseq; /* pointer to the default sequence */ const char * name; /* pointer to the base name of the item */ @@ -304,7 +304,7 @@ static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, to the default sequence for the given field -------------------------------------------------*/ -INLINE const input_seq *get_field_default_seq(const input_field_config *field, int seqtype) +INLINE const input_seq *get_field_default_seq(const input_field_config *field, input_seq_type seqtype) { if (input_seq_get_1(&field->seq[seqtype]) == SEQCODE_DEFAULT) return input_type_seq(field->port->machine, field->type, field->player, seqtype); @@ -425,7 +425,7 @@ ui_menu *ui_menu_alloc(running_machine *machine, ui_menu_handler_func handler, v ui_menu *menu; /* allocate and clear memory for the menu and the state */ - menu = malloc_or_die(sizeof(*menu)); + menu = (ui_menu *)malloc_or_die(sizeof(*menu)); memset(menu, 0, sizeof(*menu)); /* initialize the state */ @@ -537,7 +537,7 @@ void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, U if (menu->numitems >= menu->allocitems) { menu->allocitems += UI_MENU_ALLOC_ITEMS; - menu->item = realloc(menu->item, menu->allocitems * sizeof(*item)); + menu->item = (ui_menu_item *)realloc(menu->item, menu->allocitems * sizeof(*item)); } index = menu->numitems++; @@ -658,7 +658,7 @@ void *ui_menu_pool_alloc(ui_menu *menu, size_t size) } /* allocate a new pool */ - pool = malloc_or_die(sizeof(*pool) + UI_MENU_POOL_SIZE); + pool = (ui_menu_pool *)malloc_or_die(sizeof(*pool) + UI_MENU_POOL_SIZE); memset(pool, 0, sizeof(*pool)); /* wire it up */ @@ -677,7 +677,7 @@ void *ui_menu_pool_alloc(ui_menu *menu, size_t size) const char *ui_menu_pool_strdup(ui_menu *menu, const char *string) { - return strcpy(ui_menu_pool_alloc(menu, strlen(string) + 1), string); + return strcpy((char *)ui_menu_pool_alloc(menu, strlen(string) + 1), string); } @@ -1425,7 +1425,7 @@ static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, /* process the menu */ event = ui_menu_process(machine, menu, 0); if (event != NULL && event->iptkey == IPT_UI_SELECT) - ui_menu_stack_push(ui_menu_alloc(machine, event->itemref, NULL)); + ui_menu_stack_push(ui_menu_alloc(machine, (ui_menu_handler_func)event->itemref, NULL)); } @@ -1457,26 +1457,26 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st } /* add input menu items */ - ui_menu_item_append(menu, "Input (general)", NULL, 0, menu_input_groups); - ui_menu_item_append(menu, "Input (this " CAPSTARTGAMENOUN ")", NULL, 0, menu_input_specific); + ui_menu_item_append(menu, "Input (general)", NULL, 0, (void *)menu_input_groups); + ui_menu_item_append(menu, "Input (this " CAPSTARTGAMENOUN ")", NULL, 0, (void *)menu_input_specific); /* add optional input-related menus */ if (has_dips) - ui_menu_item_append(menu, "Dip Switches", NULL, 0, menu_settings_dip_switches); + ui_menu_item_append(menu, "Dip Switches", NULL, 0, (void *)menu_settings_dip_switches); if (has_configs) - ui_menu_item_append(menu, "Driver Configuration", NULL, 0, menu_settings_driver_config); + ui_menu_item_append(menu, "Driver Configuration", NULL, 0, (void *)menu_settings_driver_config); if (has_categories) - ui_menu_item_append(menu, "Categories", NULL, 0, menu_settings_categories); + ui_menu_item_append(menu, "Categories", NULL, 0, (void *)menu_settings_categories); if (has_analog) - ui_menu_item_append(menu, "Analog Controls", NULL, 0, menu_analog); + ui_menu_item_append(menu, "Analog Controls", NULL, 0, (void *)menu_analog); #ifndef MESS /* add bookkeeping menu */ - ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, menu_bookkeeping); + ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, (void *)menu_bookkeeping); #endif /* add game info menu */ - ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, menu_game_info); + ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info); #ifdef MESS /* add MESS-specific menus */ @@ -1484,21 +1484,21 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st #endif /* MESS */ /* add sliders menu */ - ui_menu_item_append(menu, "Slider Controls", NULL, 0, menu_sliders); + ui_menu_item_append(menu, "Slider Controls", NULL, 0, (void *)menu_sliders); /* add video options menu */ - ui_menu_item_append(menu, "Video Options", NULL, 0, (render_target_get_indexed(1) != NULL) ? menu_video_targets : menu_video_options); + ui_menu_item_append(menu, "Video Options", NULL, 0, (render_target_get_indexed(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options); /* add cheat menu */ if (options_get_bool(mame_options(), OPTION_CHEAT) && cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL) != NULL) - ui_menu_item_append(menu, "Cheat", NULL, 0, menu_cheat); + ui_menu_item_append(menu, "Cheat", NULL, 0, (void *)menu_cheat); /* add memory card menu */ if (machine->config->memcard_handler != NULL) - ui_menu_item_append(menu, "Memory Card", NULL, 0, menu_memory_card); + ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card); /* add reset and exit menus */ - ui_menu_item_append(menu, "Select New " CAPSTARTGAMENOUN, NULL, 0, menu_select_game); + ui_menu_item_append(menu, "Select New " CAPSTARTGAMENOUN, NULL, 0, (void *)menu_select_game); } @@ -1586,7 +1586,7 @@ static void menu_input_general_populate(running_machine *machine, ui_menu *menu, for (seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; seqtype++) { /* build an entry for the standard sequence */ - input_item_data *item = ui_menu_pool_alloc(menu, sizeof(*item)); + input_item_data *item = (input_item_data *)ui_menu_pool_alloc(menu, sizeof(*item)); memset(item, 0, sizeof(*item)); item->ref = typedesc; item->seqtype = seqtype; @@ -1665,7 +1665,7 @@ static void menu_input_specific_populate(running_machine *machine, ui_menu *menu for (seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; seqtype++) { /* build an entry for the standard sequence */ - input_item_data *item = ui_menu_pool_alloc(menu, sizeof(*item)); + input_item_data *item = (input_item_data *)ui_menu_pool_alloc(menu, sizeof(*item)); memset(item, 0, sizeof(*item)); item->ref = field; item->seqtype = seqtype; @@ -1704,7 +1704,7 @@ static void menu_input_common(running_machine *machine, ui_menu *menu, void *par /* if no state, allocate now */ if (state == NULL) state = ui_menu_alloc_state(menu, sizeof(*menustate), NULL); - menustate = state; + menustate = (input_menu_state *)state; /* if the menu isn't built, populate now */ if (!ui_menu_populated(menu)) @@ -1746,7 +1746,7 @@ static void menu_input_common(running_machine *machine, ui_menu *menu, void *par /* otherwise, handle the events */ else if (event != NULL && event->itemref != NULL) { - input_item_data *item = event->itemref; + input_item_data *item = (input_item_data *)event->itemref; switch (event->iptkey) { /* an item was selected: begin polling */ @@ -1778,7 +1778,7 @@ static void menu_input_common(running_machine *machine, ui_menu *menu, void *par /* update a general input */ if (parameter != NULL) { - const input_type_desc *typedesc = seqchangeditem->ref; + const input_type_desc *typedesc = (const input_type_desc *)seqchangeditem->ref; input_type_set_seq(machine, typedesc->type, typedesc->player, seqchangeditem->seqtype, &seqchangeditem->seq); } @@ -1787,9 +1787,9 @@ static void menu_input_common(running_machine *machine, ui_menu *menu, void *par { input_field_user_settings settings; - input_field_get_user_settings(seqchangeditem->ref, &settings); + input_field_get_user_settings((const input_field_config *)seqchangeditem->ref, &settings); settings.seq[seqchangeditem->seqtype] = seqchangeditem->seq; - input_field_set_user_settings(seqchangeditem->ref, &settings); + input_field_set_user_settings((const input_field_config *)seqchangeditem->ref, &settings); } /* invalidate the menu to force an update */ @@ -1814,8 +1814,8 @@ static void menu_input_common(running_machine *machine, ui_menu *menu, void *par static int menu_input_compare_items(const void *i1, const void *i2) { - const input_item_data * const *data1 = i1; - const input_item_data * const *data2 = i2; + const input_item_data * const *data1 = (const input_item_data * const *)i1; + const input_item_data * const *data2 = (const input_item_data * const *)i2; if ((*data1)->sortorder < (*data2)->sortorder) return -1; if ((*data1)->sortorder > (*data2)->sortorder) @@ -1849,7 +1849,7 @@ static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlis numitems++; /* now allocate an array of items and fill it up */ - itemarray = ui_menu_pool_alloc(menu, sizeof(*itemarray) * numitems); + itemarray = (input_item_data **)ui_menu_pool_alloc(menu, sizeof(*itemarray) * numitems); for (item = itemlist, curitem = 0; item != NULL; item = item->next) itemarray[curitem++] = item; @@ -1936,7 +1936,7 @@ static void menu_settings_common(running_machine *machine, ui_menu *menu, void * /* if no state, allocate now */ if (state == NULL) state = ui_menu_alloc_state(menu, sizeof(*menustate), NULL); - menustate = state; + menustate = (settings_menu_state *)state; /* if the menu isn't built, populate now */ if (!ui_menu_populated(menu)) @@ -1948,7 +1948,7 @@ static void menu_settings_common(running_machine *machine, ui_menu *menu, void * /* handle events */ if (event != NULL && event->itemref != NULL) { - const input_field_config *field = event->itemref; + const input_field_config *field = (const input_field_config *)event->itemref; input_field_user_settings settings; int changed = FALSE; @@ -2038,7 +2038,7 @@ static void menu_settings_populate(running_machine *machine, ui_menu *menu, sett /* allocate new if none */ if (dip == NULL) { - dip = ui_menu_pool_alloc(menu, sizeof(*dip)); + dip = (dip_descriptor *)ui_menu_pool_alloc(menu, sizeof(*dip)); dip->next = NULL; dip->name = diploc->swname; dip->mask = dip->state = 0; @@ -2071,8 +2071,8 @@ static void menu_settings_populate(running_machine *machine, ui_menu *menu, sett static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) { - const input_field_config *field = selectedref; - settings_menu_state *menustate = state; + const input_field_config *field = (const input_field_config *)selectedref; + settings_menu_state *menustate = (settings_menu_state *)state; dip_descriptor *dip; /* add borders */ @@ -2189,7 +2189,7 @@ static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter /* handle events */ if (event != NULL && event->itemref != NULL) { - analog_item_data *data = event->itemref; + analog_item_data *data = (analog_item_data *)event->itemref; int newval = data->cur; switch (event->iptkey) @@ -2291,7 +2291,7 @@ static void menu_analog_populate(running_machine *machine, ui_menu *menu) UINT32 flags = 0; /* allocate a data item for tracking what this menu item refers to */ - data = ui_menu_pool_alloc(menu, sizeof(*data)); + data = (analog_item_data *)ui_menu_pool_alloc(menu, sizeof(*data)); data->field = field; data->type = type; @@ -2363,7 +2363,7 @@ static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *para /* if no state, allocate some */ if (state == NULL) state = ui_menu_alloc_state(menu, sizeof(*prevtime), NULL); - prevtime = state; + prevtime = (attotime *)state; /* if the time has rolled over another second, regenerate */ curtime = timer_get_time(machine); @@ -2551,7 +2551,7 @@ static void menu_memory_card(running_machine *machine, ui_menu *menu, void *para /* if no state, allocate some */ if (state == NULL) state = ui_menu_alloc_state(menu, sizeof(*cardnum), NULL); - cardnum = state; + cardnum = (int *)state; /* if the menu isn't built, populate now */ if (!ui_menu_populated(menu)) @@ -2653,11 +2653,11 @@ static void menu_sliders(running_machine *machine, ui_menu *menu, void *paramete { int menuless_mode = (parameter != NULL); const ui_menu_event *event; - UINT8 *hidden = state; + UINT8 *hidden = (UINT8 *)state; /* if no state, allocate some */ if (hidden == NULL) - hidden = ui_menu_alloc_state(menu, sizeof(*hidden), NULL); + hidden = (UINT8 *)ui_menu_alloc_state(menu, sizeof(*hidden), NULL); if (menuless_mode) *hidden = TRUE; @@ -2672,7 +2672,7 @@ static void menu_sliders(running_machine *machine, ui_menu *menu, void *paramete /* handle keys if there is a valid item selected */ if (event->itemref != NULL) { - const slider_state *slider = event->itemref; + const slider_state *slider = (const slider_state *)event->itemref; INT32 curvalue = (*slider->update)(machine, slider->arg, NULL, SLIDER_NOCHANGE); INT32 increment = 0; @@ -2791,7 +2791,7 @@ static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int m static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) { - const slider_state *curslider = selectedref; + const slider_state *curslider = (const slider_state *)selectedref; if (curslider != NULL) { float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x; @@ -2911,7 +2911,7 @@ static void menu_video_targets_populate(running_machine *machine, ui_menu *menu) static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state) { - render_target *target = (parameter != NULL) ? parameter : render_target_get_indexed(0); + render_target *target = (parameter != NULL) ? (render_target *)parameter : render_target_get_indexed(0); const ui_menu_event *event; int changed = FALSE; @@ -3059,9 +3059,9 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para { state = ui_menu_alloc_state(menu, sizeof(*menustate) + sizeof(menustate->driverlist) * driver_list_get_count(drivers), NULL); if (parameter != NULL) - strcpy(((select_game_state *)state)->search, parameter); + strcpy(((select_game_state *)state)->search, (const char *)parameter); } - menustate = state; + menustate = (select_game_state *)state; /* if the menu isn't built, populate now */ if (!ui_menu_populated(menu)) @@ -3243,7 +3243,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state qsort((void *)menustate->driverlist, driver_count, sizeof(menustate->driverlist[0]), menu_select_game_driver_compare); /* allocate a temporary array to track which ones we found */ - found = ui_menu_pool_alloc(menu, (driver_count + 7) / 8); + found = (UINT8 *)ui_menu_pool_alloc(menu, (driver_count + 7) / 8); memset(found, 0, (driver_count + 7) / 8); /* open a path to the ROMs and find them in the array */ @@ -3270,7 +3270,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state /* find it in the array */ tempdriver.name = drivername; tempdriver_ptr = &tempdriver; - found_driver = bsearch(&tempdriver_ptr, menustate->driverlist, driver_count, sizeof(*menustate->driverlist), menu_select_game_driver_compare); + found_driver = (const game_driver **)bsearch(&tempdriver_ptr, menustate->driverlist, driver_count, sizeof(*menustate->driverlist), menu_select_game_driver_compare); /* if found, mark the corresponding entry in the array */ if (found_driver != NULL) @@ -3299,7 +3299,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { - select_game_state *menustate = state; + select_game_state *menustate = (select_game_state *)state; const game_driver *driver; float width, maxwidth; float x1, y1, x2, y2; @@ -3339,7 +3339,7 @@ static void menu_select_game_custom_render(running_machine *machine, ui_menu *me DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL); /* determine the text to render below */ - driver = ((FPTR)selectedref > 1) ? selectedref : NULL; + driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : NULL; if ((FPTR)driver > 1) { const char *gfxstat, *soundstat; diff --git a/src/emu/validity.c b/src/emu/validity.c index dc3414b1148..49f0f09052b 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -233,7 +233,7 @@ static quark_table *quark_table_alloc(UINT32 entries, UINT32 hashsize) /* determine how many total bytes we need */ total_bytes = sizeof(*table) + entries * sizeof(table->entry[0]) + hashsize * sizeof(table->hash[0]); - table = auto_malloc(total_bytes); + table = (quark_table *)auto_malloc(total_bytes); /* fill in the details */ table->entries = entries; @@ -726,7 +726,7 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p /* loop over all the CPUs */ for (device = cpu_first(config); device != NULL; device = cpu_next(device)) { - const cpu_config *cpuconfig = device->inline_config; + const cpu_config *cpuconfig = (const cpu_config *)device->inline_config; int spacenum; /* check the CPU for incompleteness */ @@ -925,7 +925,7 @@ static int validate_display(int drivnum, const machine_config *config) /* loop over screens */ for (device = video_screen_first(config); device != NULL; device = video_screen_next(device)) { - const screen_config *scrconfig = device->inline_config; + const screen_config *scrconfig = (const screen_config *)device->inline_config; /* sanity check dimensions */ if ((scrconfig->width <= 0) || (scrconfig->height <= 0)) @@ -1497,7 +1497,7 @@ static int validate_sound(int drivnum, const machine_config *config) /* make sure the sounds are wired to the speakers correctly */ for (cursound = sound_first(config); cursound != NULL; cursound = sound_next(cursound)) { - const sound_config *curconfig = cursound->inline_config; + const sound_config *curconfig = (const sound_config *)cursound->inline_config; const sound_route *route; /* loop over all the routes */ diff --git a/src/emu/video.c b/src/emu/video.c index 31c3f8f30b2..954f0ba4f01 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -61,7 +61,7 @@ struct _screen_state bitmap_t * bitmap[2]; /* 2x bitmaps for rendering */ UINT8 curbitmap; /* current bitmap index */ UINT8 curtexture; /* current texture index */ - bitmap_format texture_format; /* texture format of bitmap for this screen */ + INT32 texture_format; /* texture format of bitmap for this screen */ UINT8 changed; /* has this bitmap changed? */ INT32 last_partial_scan; /* scanline of last partial update */ @@ -131,8 +131,8 @@ struct _video_global INT32 snap_height; /* height of snapshots (0 == auto) */ /* movie recording */ - mame_file * mng_file; /* handle to the open movie file */ - avi_file * avi_file; /* handle to the open movie file */ + mame_file * mngfile; /* handle to the open movie file */ + avi_file * avifile; /* handle to the open movie file */ attotime movie_frame_period; /* period of a single movie frame */ attotime movie_next_frame_time; /* time of next frame */ UINT32 movie_frame; /* current movie frame number */ @@ -434,7 +434,7 @@ static void init_buffered_spriteram(running_machine *machine) assert_always(spriteram_size != 0, "Video buffers spriteram but spriteram_size is 0"); /* allocate memory for the back buffer */ - buffered_spriteram = auto_malloc(spriteram_size); + buffered_spriteram = (UINT8 *)auto_malloc(spriteram_size); /* register for saving it */ state_save_register_global_pointer(machine, buffered_spriteram, spriteram_size); @@ -443,7 +443,7 @@ static void init_buffered_spriteram(running_machine *machine) if (spriteram_2_size) { /* allocate memory */ - buffered_spriteram_2 = auto_malloc(spriteram_2_size); + buffered_spriteram_2 = (UINT8 *)auto_malloc(spriteram_2_size); /* register for saving it */ state_save_register_global_pointer(machine, buffered_spriteram_2, spriteram_2_size); @@ -651,7 +651,7 @@ static void decode_graphics(running_machine *machine, const gfx_decode_entry *gf void video_screen_configure(const device_config *screen, int width, int height, const rectangle *visarea, attoseconds_t frame_period) { screen_state *state = get_safe_token(screen); - screen_config *config = screen->inline_config; + screen_config *config = (screen_config *)screen->inline_config; /* validate arguments */ assert(width > 0); @@ -706,7 +706,7 @@ void video_screen_configure(const device_config *screen, int width, int height, static void realloc_screen_bitmaps(const device_config *screen) { screen_state *state = get_safe_token(screen); - screen_config *config = screen->inline_config; + screen_config *config = (screen_config *)screen->inline_config; if (config->type != SCREEN_TYPE_VECTOR) { int curwidth = 0, curheight = 0; @@ -1202,7 +1202,7 @@ static DEVICE_START( video_screen ) assert(container != NULL); /* get and validate the configuration */ - config = screen->inline_config; + config = (screen_config *)screen->inline_config; assert(config->width > 0); assert(config->height > 0); assert(config->refresh > 0); @@ -1274,7 +1274,7 @@ static DEVICE_START( video_screen ) static STATE_POSTLOAD( video_screen_postload ) { - const device_config *screen = param; + const device_config *screen = (const device_config *)param; realloc_screen_bitmaps(screen); global.movie_next_frame_time = timer_get_time(machine); } @@ -1358,7 +1358,7 @@ DEVICE_GET_INFO( video_screen ) static TIMER_CALLBACK( vblank_begin_callback ) { int i; - device_config *screen = ptr; + device_config *screen = (device_config *)ptr; screen_state *state = get_safe_token(screen); /* reset the starting VBLANK time */ @@ -1392,7 +1392,7 @@ static TIMER_CALLBACK( vblank_begin_callback ) static TIMER_CALLBACK( vblank_end_callback ) { int i; - const device_config *screen = ptr; + const device_config *screen = (const device_config *)ptr; screen_state *state = get_safe_token(screen); /* call the screen specific callbacks */ @@ -1427,7 +1427,7 @@ static TIMER_CALLBACK( screenless_update_callback ) static TIMER_CALLBACK( scanline0_callback ) { - const device_config *screen = ptr; + const device_config *screen = (const device_config *)ptr; screen_state *state = get_safe_token(screen); /* reset partial updates */ @@ -1445,7 +1445,7 @@ static TIMER_CALLBACK( scanline0_callback ) static TIMER_CALLBACK( scanline_update_callback ) { - const device_config *screen = ptr; + const device_config *screen = (const device_config *)ptr; screen_state *state = get_safe_token(screen); int scanline = param; @@ -1557,7 +1557,7 @@ static int finish_screen_updates(running_machine *machine) /* only update if live */ if (render_is_live_screen(screen)) { - const screen_config *config = screen->inline_config; + const screen_config *config = (const screen_config *)screen->inline_config; /* only update if empty and not a vector game; otherwise assume the driver did it directly */ if (config->type != SCREEN_TYPE_VECTOR && (machine->config->video_attributes & VIDEO_SELF_RENDER) == 0) @@ -2376,7 +2376,7 @@ static file_error mame_fopen_next(running_machine *machine, const char *pathopti int video_mng_is_movie_active(running_machine *machine) { - return (global.mng_file != NULL); + return (global.mngfile != NULL); } @@ -2393,7 +2393,7 @@ void video_mng_begin_recording(running_machine *machine, const char *name) int rate; /* close any existing movie file */ - if (global.mng_file != NULL) + if (global.mngfile != NULL) video_mng_end_recording(machine); /* look up the primary screen */ @@ -2405,13 +2405,13 @@ void video_mng_begin_recording(running_machine *machine, const char *name) /* create a new movie file and start recording */ if (name != NULL) - filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &global.mng_file); + filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &global.mngfile); else - filerr = mame_fopen_next(machine, SEARCHPATH_MOVIE, "mng", &global.mng_file); + filerr = mame_fopen_next(machine, SEARCHPATH_MOVIE, "mng", &global.mngfile); /* start the capture */ rate = (state != NULL) ? ATTOSECONDS_TO_HZ(state->frame_period) : DEFAULT_FRAME_RATE; - pngerr = mng_capture_start(mame_core_file(global.mng_file), global.snap_bitmap, rate); + pngerr = mng_capture_start(mame_core_file(global.mngfile), global.snap_bitmap, rate); if (pngerr != PNGERR_NONE) { video_mng_end_recording(machine); @@ -2433,11 +2433,11 @@ void video_mng_begin_recording(running_machine *machine, const char *name) void video_mng_end_recording(running_machine *machine) { /* close the file if it exists */ - if (global.mng_file != NULL) + if (global.mngfile != NULL) { - mng_capture_stop(mame_core_file(global.mng_file)); - mame_fclose(global.mng_file); - global.mng_file = NULL; + mng_capture_stop(mame_core_file(global.mngfile)); + mame_fclose(global.mngfile); + global.mngfile = NULL; global.movie_frame = 0; } } @@ -2451,7 +2451,7 @@ void video_mng_end_recording(running_machine *machine) static void video_mng_record_frame(running_machine *machine) { /* only record if we have a file */ - if (global.mng_file != NULL) + if (global.mngfile != NULL) { attotime curtime = timer_get_time(machine); png_info pnginfo = { 0 }; @@ -2480,7 +2480,7 @@ static void video_mng_record_frame(running_machine *machine) /* write the next frame */ palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL; - error = mng_capture_frame(mame_core_file(global.mng_file), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette); + error = mng_capture_frame(mame_core_file(global.mngfile), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette); png_free(&pnginfo); if (error != PNGERR_NONE) { @@ -2517,7 +2517,7 @@ void video_avi_begin_recording(running_machine *machine, const char *name) avi_error avierr; /* close any existing movie file */ - if (global.avi_file != NULL) + if (global.avifile != NULL) video_avi_end_recording(machine); /* look up the primary screen */ @@ -2562,7 +2562,7 @@ void video_avi_begin_recording(running_machine *machine, const char *name) mame_fclose(tempfile); /* create the file and free the string */ - avierr = avi_create(astring_c(fullname), &info, &global.avi_file); + avierr = avi_create(astring_c(fullname), &info, &global.avifile); astring_free(fullname); } } @@ -2576,10 +2576,10 @@ void video_avi_begin_recording(running_machine *machine, const char *name) void video_avi_end_recording(running_machine *machine) { /* close the file if it exists */ - if (global.avi_file != NULL) + if (global.avifile != NULL) { - avi_close(global.avi_file); - global.avi_file = NULL; + avi_close(global.avifile); + global.avifile = NULL; global.movie_frame = 0; } } @@ -2593,7 +2593,7 @@ void video_avi_end_recording(running_machine *machine) static void video_avi_record_frame(running_machine *machine) { /* only record if we have a file */ - if (global.avi_file != NULL) + if (global.avifile != NULL) { attotime curtime = timer_get_time(machine); avi_error avierr; @@ -2607,7 +2607,7 @@ static void video_avi_record_frame(running_machine *machine) while (attotime_compare(global.movie_next_frame_time, curtime) <= 0) { /* write the next frame */ - avierr = avi_append_video_frame_rgb32(global.avi_file, global.snap_bitmap); + avierr = avi_append_video_frame_rgb32(global.avifile, global.snap_bitmap); if (avierr != AVIERR_NONE) { video_avi_end_recording(machine); @@ -2632,16 +2632,16 @@ static void video_avi_record_frame(running_machine *machine) void video_avi_add_sound(running_machine *machine, const INT16 *sound, int numsamples) { /* only record if we have a file */ - if (global.avi_file != NULL) + if (global.avifile != NULL) { avi_error avierr; profiler_mark(PROFILER_MOVIE_REC); /* write the next frame */ - avierr = avi_append_sound_samples(global.avi_file, 0, sound + 0, numsamples, 1); + avierr = avi_append_sound_samples(global.avifile, 0, sound + 0, numsamples, 1); if (avierr == AVIERR_NONE) - avierr = avi_append_sound_samples(global.avi_file, 1, sound + 1, numsamples, 1); + avierr = avi_append_sound_samples(global.avifile, 1, sound + 1, numsamples, 1); if (avierr != AVIERR_NONE) video_avi_end_recording(machine); diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index 429e91161db..142b1c3a8e6 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -148,13 +148,13 @@ INLINE mc6845_t *get_safe_token(const device_config *device) static STATE_POSTLOAD( mc6845_state_save_postload ) { - recompute_parameters(param, TRUE); + recompute_parameters((mc6845_t *)param, TRUE); } static TIMER_CALLBACK( on_update_address_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); int addr = (param >> 8); int strobe = (param & 0xff); @@ -463,7 +463,7 @@ static void update_vsync_changed_timers(mc6845_t *mc6845) static TIMER_CALLBACK( de_changed_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); /* call the callback function -- we know it exists */ @@ -475,7 +475,7 @@ static TIMER_CALLBACK( de_changed_timer_cb ) static TIMER_CALLBACK( vsync_on_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); /* call the callback function -- we know it exists */ @@ -485,7 +485,7 @@ static TIMER_CALLBACK( vsync_on_timer_cb ) static TIMER_CALLBACK( vsync_off_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); /* call the callback function -- we know it exists */ @@ -497,7 +497,7 @@ static TIMER_CALLBACK( vsync_off_timer_cb ) static TIMER_CALLBACK( hsync_on_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); /* call the callback function -- we know it exists */ @@ -507,7 +507,7 @@ static TIMER_CALLBACK( hsync_on_timer_cb ) static TIMER_CALLBACK( hsync_off_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); /* call the callback function -- we know it exists */ @@ -572,7 +572,7 @@ UINT8 mc6845_get_ra(const device_config *device) static TIMER_CALLBACK( light_pen_latch_timer_cb ) { - const device_config *device = ptr; + const device_config *device = (const device_config *)ptr; mc6845_t *mc6845 = get_safe_token(device); mc6845->light_pen_addr = mc6845_get_ma(device); @@ -746,7 +746,7 @@ static void common_start(const device_config *device, int device_type) assert(device != NULL); assert(device->tag != NULL); - mc6845->intf = device->static_config; + mc6845->intf = (const mc6845_interface *)device->static_config; mc6845->device_type = device_type; if (mc6845->intf != NULL) diff --git a/src/emu/video/poly.c b/src/emu/video/poly.c index a11f4db3f23..d78279762cc 100644 --- a/src/emu/video/poly.c +++ b/src/emu/video/poly.c @@ -333,7 +333,7 @@ poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_d poly_manager *poly; /* allocate the manager itself */ - poly = malloc_or_die(sizeof(*poly)); + poly = (poly_manager *)malloc_or_die(sizeof(*poly)); memset(poly, 0, sizeof(*poly)); poly->flags = flags; @@ -1314,7 +1314,7 @@ static void **allocate_array(size_t *itemsize, UINT32 itemcount) *itemsize = ((*itemsize + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE) * CACHE_LINE_SIZE; /* allocate the array */ - ptrarray = malloc_or_die(sizeof(*ptrarray) * itemcount); + ptrarray = (void **)malloc_or_die(sizeof(*ptrarray) * itemcount); memset(ptrarray, 0, sizeof(*ptrarray) * itemcount); /* allocate the actual items */ @@ -1352,7 +1352,7 @@ static void *poly_item_callback(void *param, int threadid) { while (1) { - work_unit *unit = param; + work_unit *unit = (work_unit *)param; polygon_info *polygon = unit->shared.polygon; int count = unit->shared.count_next & 0xffff; UINT32 orig_count_next; @@ -1422,6 +1422,6 @@ static void *poly_item_callback(void *param, int threadid) static STATE_PRESAVE( poly_state_presave ) { - poly_manager *poly = param; + poly_manager *poly = (poly_manager *)param; poly_wait(poly, "pre-save"); } diff --git a/src/emu/video/resnet.c b/src/emu/video/resnet.c index 387b12d37f7..2acba3d1d46 100644 --- a/src/emu/video/resnet.c +++ b/src/emu/video/resnet.c @@ -260,8 +260,8 @@ double compute_resistor_net_outputs( /* parse input parameters */ - o = malloc_or_die( sizeof(double) * (1<end - rdi->start + 1)*sizeof(rgb_t)); + rgb = (rgb_t *)malloc_or_die((rdi->end - rdi->start + 1)*sizeof(rgb_t)); for (i=rdi->start; i<=rdi->end; i++) { UINT8 t[3] = {0,0,0}; diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c index 893fe7a3394..f52f172f951 100644 --- a/src/emu/video/s2636.c +++ b/src/emu/video/s2636.c @@ -122,7 +122,7 @@ s2636_t *s2636_config(UINT8 *work_ram, int screen_height, int screen_width, int s2636_t *s2636; /* allocate the object that holds the state */ - s2636 = auto_malloc(sizeof(*s2636)); + s2636 = (s2636_t *)auto_malloc(sizeof(*s2636)); s2636->work_ram = work_ram; s2636->y_offset = y_offset; diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index 0edc524fd33..f94edb7fec3 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -84,13 +84,13 @@ void tms34061_start(running_machine *machine, const struct tms34061_interface *i tms34061.vrammask = tms34061.intf.vramsize - 1; /* allocate memory for VRAM */ - tms34061.vram = auto_malloc(tms34061.intf.vramsize + 256 * 2); + tms34061.vram = (UINT8 *)auto_malloc(tms34061.intf.vramsize + 256 * 2); memset(tms34061.vram, 0, tms34061.intf.vramsize + 256 * 2); /* not really a save state, just there for debugging purposes */ state_save_register_global_pointer(machine, tms34061.vram, tms34061.intf.vramsize); /* allocate memory for latch RAM */ - tms34061.latchram = auto_malloc(tms34061.intf.vramsize + 256 * 2); + tms34061.latchram = (UINT8 *)auto_malloc(tms34061.intf.vramsize + 256 * 2); memset(tms34061.latchram, 0, tms34061.intf.vramsize + 256 * 2); /* add some buffer space for VRAM and latch RAM */ diff --git a/src/emu/video/v9938.c b/src/emu/video/v9938.c index ec929c44337..70072ae1eb5 100644 --- a/src/emu/video/v9938.c +++ b/src/emu/video/v9938.c @@ -164,7 +164,7 @@ PALETTE_INIT( v9958 ) PALETTE_INIT_CALL(v9938); /* set up YJK table */ - pal_indYJK = auto_malloc(0x20000 * sizeof(UINT16)); + pal_indYJK = (UINT16 *)auto_malloc(0x20000 * sizeof(UINT16)); LOG(("Building YJK table for V9958 screens, may take a while ... \n")); i = 0; @@ -494,7 +494,7 @@ void v9938_init (running_machine *machine, int which, const device_config *scree vdp->size_old = -1; /* allocate VRAM */ - vdp->vram = auto_malloc (0x20000); + vdp->vram = (UINT8 *)auto_malloc (0x20000); memset (vdp->vram, 0, 0x20000); if (vdp->vram_size < 0x20000) { @@ -505,7 +505,7 @@ void v9938_init (running_machine *machine, int which, const device_config *scree /* do we have expanded memory? */ if (vdp->vram_size > 0x20000) { - vdp->vram_exp = auto_malloc (0x10000); + vdp->vram_exp = (UINT8 *)auto_malloc (0x10000); memset (vdp->vram_exp, 0, 0x10000); } else diff --git a/src/emu/video/vector.c b/src/emu/video/vector.c index 311167dd220..3ab6f36a703 100644 --- a/src/emu/video/vector.c +++ b/src/emu/video/vector.c @@ -184,7 +184,7 @@ VIDEO_START( vector ) vector_index = 0; /* allocate memory for tables */ - vector_list = auto_malloc (MAX_POINTS * sizeof (vector_list[0])); + vector_list = (point *)auto_malloc (MAX_POINTS * sizeof (vector_list[0])); } diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 89048353d04..3854c5e3d78 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -460,7 +460,7 @@ static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem) int pen; /* allocate frame buffer RAM and set pointers */ - f->ram = memory; + f->ram = (UINT8 *)memory; f->mask = fbmem - 1; f->rgboffs[0] = f->rgboffs[1] = f->rgboffs[2] = 0; f->auxoffs = ~0; @@ -546,7 +546,7 @@ static void init_tmu_shared(tmu_shared_state *s) static void init_tmu(voodoo_state *v, tmu_state *t, voodoo_reg *reg, void *memory, int tmem) { /* allocate texture RAM */ - t->ram = memory; + t->ram = (UINT8 *)memory; t->mask = tmem - 1; t->reg = reg; t->regdirty = TRUE; @@ -597,7 +597,7 @@ static void init_tmu(voodoo_state *v, tmu_state *t, voodoo_reg *reg, void *memor static STATE_POSTLOAD( voodoo_postload ) { - voodoo_state *v = param; + voodoo_state *v = (voodoo_state *)param; int index, subindex; v->fbi.clut_dirty = TRUE; @@ -955,7 +955,7 @@ static void adjust_vblank_timer(voodoo_state *v) static TIMER_CALLBACK( vblank_off_callback ) { - voodoo_state *v = ptr; + voodoo_state *v = (voodoo_state *)ptr; if (LOG_VBLANK_SWAP) logerror("--- vblank end\n"); @@ -971,7 +971,7 @@ static TIMER_CALLBACK( vblank_off_callback ) static TIMER_CALLBACK( vblank_callback ) { - voodoo_state *v = ptr; + voodoo_state *v = (voodoo_state *)ptr; if (LOG_VBLANK_SWAP) logerror("--- vblank start\n"); @@ -1986,7 +1986,7 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da static TIMER_CALLBACK( stall_cpu_callback ) { - check_stalled_cpu(ptr, timer_get_time(machine)); + check_stalled_cpu((voodoo_state *)ptr, timer_get_time(machine)); } @@ -4441,7 +4441,7 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) static DEVICE_START( voodoo ) { - const voodoo_config *config = device->inline_config; + const voodoo_config *config = (const voodoo_config *)device->inline_config; voodoo_state *v = get_safe_token(device); const raster_info *info; void *fbmem, *tmumem[2]; @@ -4471,7 +4471,7 @@ static DEVICE_START( voodoo ) /* create a multiprocessor work queue */ v->poly = poly_alloc(device->machine, 64, sizeof(poly_extra_data), 0); - v->thread_stats = auto_malloc(sizeof(v->thread_stats[0]) * WORK_MAX_THREADS); + v->thread_stats = (stats_block *)auto_malloc(sizeof(v->thread_stats[0]) * WORK_MAX_THREADS); /* create a table of precomputed 1/n and log2(n) values */ /* n ranges from 1.0000 to 2.0000 */ @@ -4661,7 +4661,7 @@ static DEVICE_SET_INFO( voodoo ) DEVICE_GET_INFO( voodoo ) { - const voodoo_config *config = (device != NULL) ? device->inline_config : NULL; + const voodoo_config *config = (device != NULL) ? (const voodoo_config *)device->inline_config : NULL; switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ @@ -4765,7 +4765,7 @@ static INT32 fastfill(voodoo_state *v) /* iterate over blocks of extents */ for (y = sy; y < ey; y += ARRAY_LENGTH(extents)) { - poly_extra_data *extra = poly_get_extra_data(v->poly); + poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(v->poly); int count = MIN(ey - y, ARRAY_LENGTH(extents)); extra->state = v; @@ -5106,7 +5106,7 @@ static INT32 setup_and_draw_triangle(voodoo_state *v) static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount) { - poly_extra_data *extra = poly_get_extra_data(v->poly); + poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(v->poly); raster_info *info = find_rasterizer(v, texcount); poly_vertex vert[3]; @@ -5335,7 +5335,7 @@ static void dump_rasterizer_stats(voodoo_state *v) static void raster_fastfill(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid) { - const poly_extra_data *extra = extradata; + const poly_extra_data *extra = (const poly_extra_data *)extradata; voodoo_state *v = extra->state; stats_block *stats = &v->thread_stats[threadid]; INT32 startx = extent->startx; diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c index 60682c6e2a7..de752353ad4 100644 --- a/src/lib/util/chd.c +++ b/src/lib/util/chd.c @@ -2549,7 +2549,7 @@ static chd_error metadata_compute_hash(chd_file *chd, const UINT8 *rawsha1, UINT continue; /* allocate memory */ - tempbuffer = malloc(metalength); + tempbuffer = (UINT8 *)malloc(metalength); if (tempbuffer == NULL) { err = CHDERR_OUT_OF_MEMORY; @@ -2576,7 +2576,7 @@ static chd_error metadata_compute_hash(chd_file *chd, const UINT8 *rawsha1, UINT if (hashindex >= hashalloc) { hashalloc += 256; - hasharray = realloc(hasharray, hashalloc * sizeof(hasharray[0])); + hasharray = (metadata_hash *)realloc(hasharray, hashalloc * sizeof(hasharray[0])); if (hasharray == NULL) { err = CHDERR_OUT_OF_MEMORY; @@ -2596,7 +2596,7 @@ static chd_error metadata_compute_hash(chd_file *chd, const UINT8 *rawsha1, UINT /* compute the SHA1 of the raw plus the various metadata */ sha1_init(&sha1); sha1_update(&sha1, CHD_SHA1_BYTES, rawsha1); - sha1_update(&sha1, hashindex * sizeof(hasharray[0]), (void *)hasharray); + sha1_update(&sha1, hashindex * sizeof(hasharray[0]), (const UINT8 *)hasharray); sha1_final(&sha1); sha1_digest(&sha1, SHA1_DIGEST_SIZE, finalsha1); diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index 5a06603081b..f446a4d6ffc 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -54,7 +54,7 @@ #define RESTRICT __restrict__ #define SETJMP_GNUC_PROTECT() (void)__builtin_return_address(1) #ifndef TYPES_COMPATIBLE -#define TYPES_COMPATIBLE(a,b) __builtin_types_compatible_p(a, b) +#define TYPES_COMPATIBLE(a,b) __builtin_types_compatible_p(typeof(a), b) #endif #else #define ATTR_UNUSED diff --git a/src/osd/windows/main.c b/src/osd/windows/main.c index ff054f21ef4..2350d31b615 100644 --- a/src/osd/windows/main.c +++ b/src/osd/windows/main.c @@ -15,7 +15,7 @@ // MAMEOS headers #include "strconv.h" -extern int utf8_main(int argc, char **argv); +extern int utf8_main(int argc, char *argv[]); diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index 6270d54db5e..22010f19be1 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -132,7 +132,7 @@ CCOMFLAGS += /wd4267 endif # disable function pointer warnings in C++ which are evil to work around -CPPONLYFLAGS += /wd4191 +CPPONLYFLAGS += /wd4191 /wd4060 /wd4065 # explicitly set the entry point for UNICODE builds ifdef UNICODE