Fixes for variable shadowing [Oliver Stöneberg]

This commit is contained in:
R. Belmont 2011-07-21 13:19:08 +00:00
parent 4a61b7baea
commit 6ca8f8a8c3
24 changed files with 48 additions and 50 deletions

View File

@ -346,7 +346,7 @@ static int recurse_dir(int srcrootlen, const astring *srcdir)
if (core_filename_ends_with(astring_c(curlist->name), ".c")) if (core_filename_ends_with(astring_c(curlist->name), ".c"))
{ {
tagmap *depend_map = tagmap_alloc(); tagmap *depend_map = tagmap_alloc();
tagmap_entry *entry; tagmap_entry *map_entry;
file_entry *file; file_entry *file;
astring *target; astring *target;
int taghash; int taghash;
@ -363,8 +363,8 @@ static int recurse_dir(int srcrootlen, const astring *srcdir)
/* iterate over the hashed dependencies and output them as well */ /* iterate over the hashed dependencies and output them as well */
for (taghash = 0; taghash < TAGMAP_HASH_SIZE; taghash++) for (taghash = 0; taghash < TAGMAP_HASH_SIZE; taghash++)
for (entry = depend_map->table[taghash]; entry != NULL; entry = entry->next) for (map_entry = depend_map->table[taghash]; map_entry != NULL; map_entry = map_entry->next)
printf("\t%s \\\n", astring_c((astring *)entry->object)); printf("\t%s \\\n", astring_c((astring *)map_entry->object));
astring_free(target); astring_free(target);
tagmap_free(depend_map); tagmap_free(depend_map);
@ -517,9 +517,9 @@ static astring *find_include_file(int srcrootlen, const astring *srcfile, const
/* handle .. by removing a chunk from the incpath */ /* handle .. by removing a chunk from the incpath */
if (astring_cmpc(pathpart, "..") == 0) if (astring_cmpc(pathpart, "..") == 0)
{ {
int sepindex = astring_rchr(srcincpath, 0, PATH_SEPARATOR[0]); int sepindex_part = astring_rchr(srcincpath, 0, PATH_SEPARATOR[0]);
if (sepindex != -1) if (sepindex_part != -1)
astring_substr(srcincpath, 0, sepindex); astring_substr(srcincpath, 0, sepindex_part);
} }
/* otherwise, append a path separator and the pathpart */ /* otherwise, append a path separator and the pathpart */

View File

@ -1061,12 +1061,12 @@ void cli_frontend::listsoftware(const char *gamename)
if ( part->featurelist ) if ( part->featurelist )
{ {
feature_list *list = part->featurelist; feature_list *flist = part->featurelist;
while( list ) while( flist )
{ {
fprintf( out, "\t\t\t\t<feature name=\"%s\" value=\"%s\" />\n", list->name, list->value ); fprintf( out, "\t\t\t\t<feature name=\"%s\" value=\"%s\" />\n", flist->name, flist->value );
list = list->next; flist = flist->next;
} }
} }

View File

@ -3115,7 +3115,7 @@ static void I386OP(group0F01_16)(i386_state *cpustate) // Opcode 0x0f 01
STORE_RM16(modrm, cpustate->cr[0]); STORE_RM16(modrm, cpustate->cr[0]);
CYCLES(cpustate,CYCLES_SMSW_REG); CYCLES(cpustate,CYCLES_SMSW_REG);
} else { } else {
UINT32 ea = GetEA(cpustate,modrm); ea = GetEA(cpustate,modrm);
WRITE16(cpustate,ea, cpustate->cr[0]); WRITE16(cpustate,ea, cpustate->cr[0]);
CYCLES(cpustate,CYCLES_SMSW_MEM); CYCLES(cpustate,CYCLES_SMSW_MEM);
} }

View File

@ -269,7 +269,7 @@ static void I486OP(group0F01_16)(i386_state *cpustate) // Opcode 0x0f 01
STORE_RM16(modrm, cpustate->cr[0]); STORE_RM16(modrm, cpustate->cr[0]);
CYCLES(cpustate,CYCLES_SMSW_REG); CYCLES(cpustate,CYCLES_SMSW_REG);
} else { } else {
UINT32 ea = GetEA(cpustate,modrm); ea = GetEA(cpustate,modrm);
WRITE16(cpustate,ea, cpustate->cr[0]); WRITE16(cpustate,ea, cpustate->cr[0]);
CYCLES(cpustate,CYCLES_SMSW_MEM); CYCLES(cpustate,CYCLES_SMSW_MEM);
} }

View File

@ -666,7 +666,6 @@ static void PREFIX286(_0fpre)(i8086_state *cpustate)
cpustate->regs.w[DX] = ReadWord(0x830); cpustate->regs.w[DX] = ReadWord(0x830);
cpustate->regs.w[CX] = ReadWord(0x832); cpustate->regs.w[CX] = ReadWord(0x832);
cpustate->regs.w[AX] = ReadWord(0x834); cpustate->regs.w[AX] = ReadWord(0x834);
UINT16 desc[3];
// loadall uses base-rights-limit order // loadall uses base-rights-limit order
#define LOADDESC(addr, sreg) { desc[1] = ReadWord(addr); desc[2] = ReadWord(addr+2); desc[0] = ReadWord(addr+4); \ #define LOADDESC(addr, sreg) { desc[1] = ReadWord(addr); desc[2] = ReadWord(addr+2); desc[0] = ReadWord(addr+4); \
cpustate->base[sreg] = BASE(desc); cpustate->rights[sreg] = RIGHTS(desc); \ cpustate->base[sreg] = BASE(desc); cpustate->rights[sreg] = RIGHTS(desc); \

View File

@ -118,7 +118,6 @@ static void flop_12d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn)
{ {
const char *const suffix[4] = { "ss", "sd", "ds", "dd" }; const char *const suffix[4] = { "ss", "sd", "ds", "dd" };
const char *prefix_d, *prefix_p; const char *prefix_d, *prefix_p;
int s = (insn & 0x180) >> 7;
prefix_p = (insn & 0x400) ? "p" : ""; prefix_p = (insn & 0x400) ? "p" : "";
prefix_d = (insn & 0x200) ? "d." : ""; prefix_d = (insn & 0x200) ? "d." : "";
@ -159,8 +158,11 @@ static void flop_12d(char *buf, char *mnemonic, UINT32 pc, UINT32 insn)
suffix[s], get_fsrc1 (insn), get_fsrc2 (insn), get_fdest (insn)); suffix[s], get_fsrc1 (insn), get_fsrc2 (insn), get_fdest (insn));
} }
else else
{
int s = (insn & 0x180) >> 7;
sprintf(buf, "%s%s%s%s\t%%f%d,%%f%d,%%f%d", prefix_d, prefix_p, mnemonic, sprintf(buf, "%s%s%s%s\t%%f%d,%%f%d,%%f%d", prefix_d, prefix_p, mnemonic,
suffix[s], get_fsrc1 (insn), get_fsrc2 (insn), get_fdest (insn)); suffix[s], get_fsrc1 (insn), get_fsrc2 (insn), get_fdest (insn));
}
} }

View File

@ -436,7 +436,7 @@ static void v25_init(legacy_cpu_device *device, device_irq_callback irqcallback)
nec_state->config = config; nec_state->config = config;
for (int i = 0; i < 4; i++) for (i = 0; i < 4; i++)
nec_state->timers[i] = device->machine().scheduler().timer_alloc(FUNC(v25_timer_callback), nec_state); nec_state->timers[i] = device->machine().scheduler().timer_alloc(FUNC(v25_timer_callback), nec_state);
device->save_item(NAME(nec_state->ram.w)); device->save_item(NAME(nec_state->ram.w));

View File

@ -788,17 +788,17 @@ void psxcpu_device::log_bioscall()
( address == 0xb0 && operation == 0x35 ) ) ( address == 0xb0 && operation == 0x35 ) )
{ {
int fd = log_bioscall_parameter( 0 ); int fd = log_bioscall_parameter( 0 );
int buf = log_bioscall_parameter( 1 ); int buffer = log_bioscall_parameter( 1 );
int nbytes = log_bioscall_parameter( 2 ); int nbytes = log_bioscall_parameter( 2 );
if( fd == 1 ) if( fd == 1 )
{ {
while( nbytes > 0 ) while( nbytes > 0 )
{ {
UINT8 c = readbyte( buf ); UINT8 c = readbyte( buffer );
putchar( c ); putchar( c );
nbytes--; nbytes--;
buf++; buffer++;
} }
} }
} }

View File

@ -375,10 +375,10 @@ static void execute_one(scmp_state *cpustate, int opcode)
case 0x3c: case 0x3d :case 0x3e: case 0x3f: case 0x3c: case 0x3d :case 0x3e: case 0x3f:
// XPPC // XPPC
{ {
UINT16 tmp = ADD12(cpustate->PC.w.l,-1); // Since PC is incremented we need to fix it UINT16 tmp16 = ADD12(cpustate->PC.w.l,-1); // Since PC is incremented we need to fix it
cpustate->icount -= 7; cpustate->icount -= 7;
cpustate->PC.w.l = GET_PTR_REG(cpustate,ptr)->w.l; cpustate->PC.w.l = GET_PTR_REG(cpustate,ptr)->w.l;
GET_PTR_REG(cpustate,ptr)->w.l = tmp; GET_PTR_REG(cpustate,ptr)->w.l = tmp16;
// After exchange CPU increment PC // After exchange CPU increment PC
cpustate->PC.w.l = ADD12(cpustate->PC.w.l,1); cpustate->PC.w.l = ADD12(cpustate->PC.w.l,1);
} }

View File

@ -223,10 +223,10 @@ INLINE void superfx_pixelcache_flush(superfx_state *cpustate, INT32 line)
{ {
UINT32 byte = ((n >> 1) << 4) + (n & 1); // = [n]{ 0, 1, 16, 17, 32, 33, 48, 49 }; UINT32 byte = ((n >> 1) << 4) + (n & 1); // = [n]{ 0, 1, 16, 17, 32, 33, 48, 49 };
UINT8 data = 0x00; UINT8 data = 0x00;
UINT32 x = 0; UINT32 x32 = 0;
for(x = 0; x < 8; x++) for(x32 = 0; x32 < 8; x32++)
{ {
data |= ((cpustate->pixelcache[line].data[x] >> n) & 1) << x; data |= ((cpustate->pixelcache[line].data[x32] >> n) & 1) << x32;
} }
if(cpustate->pixelcache[line].bitpend != 0xff) if(cpustate->pixelcache[line].bitpend != 0xff)
{ {

View File

@ -172,7 +172,7 @@ static void load(const char *fname)
} }
} else { } else {
char *name=0, *cat=0, *id=0, *cyc=0, *rep=0, *type=0; char *name=0, *cat=0, *id=0, *cyc=0, *rep=0, *type=0;
char *p = buf; p = buf;
int pid, limit; int pid, limit;
instr *bi; instr *bi;
unsigned int flags; unsigned int flags;

View File

@ -313,8 +313,8 @@ bool device_memory_interface::interface_validity_check(emu_options &options, con
for (const rom_source *source = rom_first_source(device().mconfig()); source != NULL && !found; source = rom_next_source(*source)) for (const rom_source *source = rom_first_source(device().mconfig()); source != NULL && !found; source = rom_next_source(*source))
for (const rom_entry *romp = rom_first_region(*source); !ROMENTRY_ISEND(romp) && !found; romp++) for (const rom_entry *romp = rom_first_region(*source); !ROMENTRY_ISEND(romp) && !found; romp++)
{ {
const char *regiontag = ROMREGION_GETTAG(romp); const char *regiontag_c = ROMREGION_GETTAG(romp);
if (regiontag != NULL) if (regiontag_c != NULL)
{ {
astring fulltag; astring fulltag;
astring regiontag; astring regiontag;

View File

@ -3205,7 +3205,7 @@ static void load_config_callback(running_machine &machine, int config_type, xml_
/* what we will diff against */ /* what we will diff against */
if (config_type == CONFIG_TYPE_CONTROLLER) if (config_type == CONFIG_TYPE_CONTROLLER)
for (input_type_entry *entry = portdata->typelist.first(); entry != NULL; entry = entry->next()) for (input_type_entry *entry = portdata->typelist.first(); entry != NULL; entry = entry->next())
for (int seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++) for (seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
entry->defseq[seqtype] = entry->seq[seqtype]; entry->defseq[seqtype] = entry->seq[seqtype];
} }
@ -3455,7 +3455,7 @@ static void save_default_inputs(running_machine &machine, xml_data_node *parentn
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, entry->type, entry->player)); xml_set_attribute(portnode, "type", input_field_type_to_token(machine, entry->type, entry->player));
/* add only the sequences that have changed from the defaults */ /* add only the sequences that have changed from the defaults */
for (int seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++) for (seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
if (entry->seq[seqtype] != entry->defseq[seqtype]) if (entry->seq[seqtype] != entry->defseq[seqtype])
save_sequence(machine, portnode, seqtype, entry->type, entry->seq[seqtype]); save_sequence(machine, portnode, seqtype, entry->type, entry->seq[seqtype]);
} }

View File

@ -1036,7 +1036,7 @@ static STREAM_UPDATE( custom_stream_callback )
/* clear out the rest of the buffer */ /* clear out the rest of the buffer */
if (samples > 0) if (samples > 0)
{ {
int sampout = (ldcore->audiobufout == 0) ? ldcore->audiobufsize - 1 : ldcore->audiobufout - 1; sampout = (ldcore->audiobufout == 0) ? ldcore->audiobufsize - 1 : ldcore->audiobufout - 1;
stream_sample_t fill0 = buffer0[sampout] & leftand; stream_sample_t fill0 = buffer0[sampout] & leftand;
stream_sample_t fill1 = buffer1[sampout] & rightand; stream_sample_t fill1 = buffer1[sampout] & rightand;

View File

@ -696,10 +696,10 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
try try
{ {
// allocate an array to hold the character data // allocate an array to hold the character data
UINT8 *chartable = auto_alloc_array_clear(m_manager.machine(), UINT8, numchars * CACHED_CHAR_SIZE); chartable = auto_alloc_array_clear(m_manager.machine(), UINT8, numchars * CACHED_CHAR_SIZE);
// allocate a temp buffer to compress into // allocate a temp buffer to compress into
UINT8 *tempbuffer = auto_alloc_array(m_manager.machine(), UINT8, 65536); tempbuffer = auto_alloc_array(m_manager.machine(), UINT8, 65536);
// write the header // write the header
UINT8 *dest = tempbuffer; UINT8 *dest = tempbuffer;

View File

@ -1798,11 +1798,11 @@ static DEVICE_VALIDITY_CHECK( software_list )
if (data->_name && data->_hashdata) if (data->_name && data->_hashdata)
{ {
const char *s; const char *str;
/* make sure it's all lowercase */ /* make sure it's all lowercase */
for (s = data->_name; *s; s++) for (str = data->_name; *str; str++)
if (tolower((UINT8)*s) != *s) if (tolower((UINT8)*str) != *str)
{ {
mame_printf_error("%s: %s has upper case ROM name %s\n", swlist->list_name[i], swinfo->shortname, data->_name); mame_printf_error("%s: %s has upper case ROM name %s\n", swlist->list_name[i], swinfo->shortname, data->_name);
error = TRUE; error = TRUE;

View File

@ -776,7 +776,7 @@ bool spu_device::sample_cache::try_update(spu_device *spu)
#endif #endif
signed short *dp=data+(((invalid_start-start)>>4)*28); signed short *dp=data+(((invalid_start-start)>>4)*28);
adpcm_packet *ap=(adpcm_packet *)(spu->spu_ram+invalid_start); ap=(adpcm_packet *)(spu->spu_ram+invalid_start);
for (a=invalid_start; a<invalid_end; a+=16, ap++) for (a=invalid_start; a<invalid_end; a+=16, ap++)
dp=update_decoder.decode_packet(ap,dp); dp=update_decoder.decode_packet(ap,dp);
@ -794,8 +794,8 @@ bool spu_device::sample_cache::try_update(spu_device *spu)
if (invalid_start==lc->loopstart) if (invalid_start==lc->loopstart)
{ {
adpcm_decoder tmp=decoder; adpcm_decoder tmp=decoder;
signed short *dp=lc->data, dp=lc->data;
*dpend=dp+lc->len; signed short *dpend=dp+lc->len;
unsigned int adr=lc->loopstart; unsigned int adr=lc->loopstart;
for (unsigned int i=0; ((i<num_loop_cache_packets) && (dp<dpend)); i++, adr+=16) for (unsigned int i=0; ((i<num_loop_cache_packets) && (dp<dpend)); i++, adr+=16)
dp=tmp.decode_packet((adpcm_packet *)(spu->spu_ram+adr),dp); dp=tmp.decode_packet((adpcm_packet *)(spu->spu_ram+adr),dp);
@ -806,7 +806,7 @@ bool spu_device::sample_cache::try_update(spu_device *spu)
invalid_start=0xffffffff; invalid_start=0xffffffff;
valid=true; valid=true;
for (unsigned int a=start; a<end; a+=16, ap++) for (a=start; a<end; a+=16, ap++)
{ {
spu->cache[a>>4]=this; spu->cache[a>>4]=this;
} }

View File

@ -1236,7 +1236,7 @@ static void mappings_update(tilemap_t *tmap)
{ {
UINT32 logical_col = logindex % tmap->cols; UINT32 logical_col = logindex % tmap->cols;
UINT32 logical_row = logindex / tmap->cols; UINT32 logical_row = logindex / tmap->cols;
tilemap_memory_index memindex = (*tmap->mapper)(logical_col, logical_row, tmap->cols, tmap->rows); memindex = (*tmap->mapper)(logical_col, logical_row, tmap->cols, tmap->rows);
UINT32 flipped_logindex; UINT32 flipped_logindex;
/* apply tilemap flip to get the final location to store */ /* apply tilemap flip to get the final location to store */

View File

@ -1020,7 +1020,7 @@ astring &game_info_astring(running_machine &machine, astring &string)
/* count how many identical CPUs we have */ /* count how many identical CPUs we have */
int count = 1; int count = 1;
device_execute_interface *scan = NULL; device_execute_interface *scan = NULL;
for (bool gotone = exec->next(scan); gotone; gotone = scan->next(scan)) for (bool gotanother = exec->next(scan); gotanother; gotanother = scan->next(scan))
{ {
if (exec->device().type() != scan->device().type() || exec->device().clock() != scan->device().clock()) if (exec->device().type() != scan->device().type() || exec->device().clock() != scan->device().clock())
break; break;

View File

@ -857,7 +857,7 @@ static void ui_menu_draw(running_machine &machine, ui_menu *menu, int customonly
for (linenum = 0; linenum < visible_lines; linenum++) for (linenum = 0; linenum < visible_lines; linenum++)
{ {
float line_y = visible_top + (float)linenum * line_height; float line_y = visible_top + (float)linenum * line_height;
int itemnum = top_line + linenum; itemnum = top_line + linenum;
const ui_menu_item *item = &menu->item[itemnum]; const ui_menu_item *item = &menu->item[itemnum];
const char *itemtext = item->text; const char *itemtext = item->text;
rgb_t fgcolor = UI_TEXT_COLOR; rgb_t fgcolor = UI_TEXT_COLOR;
@ -992,7 +992,7 @@ static void ui_menu_draw(running_machine &machine, ui_menu *menu, int customonly
{ {
const ui_menu_item *item = &menu->item[menu->selected]; const ui_menu_item *item = &menu->item[menu->selected];
int subitem_invert = item->flags & MENU_FLAG_INVERT; int subitem_invert = item->flags & MENU_FLAG_INVERT;
int linenum = menu->selected - top_line; linenum = menu->selected - top_line;
float line_y = visible_top + (float)linenum * line_height; float line_y = visible_top + (float)linenum * line_height;
float target_width, target_height; float target_width, target_height;
float target_x, target_y; float target_x, target_y;
@ -3883,7 +3883,7 @@ static void menu_select_game_custom_render(running_machine &machine, ui_menu *me
else else
{ {
const char *s = COPYRIGHT; const char *s = COPYRIGHT;
int line = 0; line = 0;
int col = 0; int col = 0;
/* first line is version string */ /* first line is version string */

View File

@ -89,7 +89,6 @@ static DEVICE_STOP( akiko )
akiko_state *state = get_safe_token(device); akiko_state *state = get_safe_token(device);
if (!state->m_cdrom_is_device) if (!state->m_cdrom_is_device)
{ {
akiko_state *state = get_safe_token(device);
if( state->m_cdrom ) if( state->m_cdrom )
{ {
cdrom_close(state->m_cdrom); cdrom_close(state->m_cdrom);

View File

@ -1682,7 +1682,6 @@ static int pif_channel_handle_command(running_machine &machine, int channel, int
case 0x03: case 0x03:
{ {
UINT32 address; UINT32 address;
int i;
/*mame_printf_debug("Write to mempack, rlength = %d, slength = %d\n", rlength, slength); /*mame_printf_debug("Write to mempack, rlength = %d, slength = %d\n", rlength, slength);
for (i=0; i < slength; i++) for (i=0; i < slength; i++)
{ {

View File

@ -1567,7 +1567,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -1590,7 +1590,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }
@ -1614,7 +1614,7 @@ void hlsl_info::render_quad(d3d_poly_info *poly, int vertnum)
{ {
(*d3dintf->effect.begin_pass)(curr_effect, pass); (*d3dintf->effect.begin_pass)(curr_effect, pass);
// add the primitives // add the primitives
HRESULT result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count); result = (*d3dintf->device.draw_primitive)(d3d->device, poly->type, vertnum, poly->count);
if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result); if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device draw_primitive call\n", (int)result);
(*d3dintf->effect.end_pass)(curr_effect); (*d3dintf->effect.end_pass)(curr_effect);
} }

View File

@ -112,8 +112,7 @@ char *osd_get_clipboard_text(void)
char *result = NULL; char *result = NULL;
// try to access unicode text // try to access unicode text
if (result == NULL) result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide);
result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide);
// try to access ANSI text // try to access ANSI text
if (result == NULL) if (result == NULL)