More cleanups (nw)

This commit is contained in:
Miodrag Milanovic 2015-11-11 18:07:13 +01:00
parent a89530313f
commit 19ff46c113
13 changed files with 35 additions and 29 deletions

View File

@ -685,7 +685,7 @@ int floppy_image_device::find_index(UINT32 position, const std::vector<UINT32> &
{ {
int spos = (buf.size() >> 1)-1; int spos = (buf.size() >> 1)-1;
int step; int step;
for(step=1; step<buf.size()+1; step<<=1); for(step=1; step<buf.size()+1; step<<=1) { }
step >>= 1; step >>= 1;
for(;;) { for(;;) {

View File

@ -20,17 +20,23 @@ const device_type SNAPSHOT = &device_creator<snapshot_image_device>;
snapshot_image_device::snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) snapshot_image_device::snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SNAPSHOT, "Snapshot", tag, owner, clock, "snapshot_image", __FILE__), : device_t(mconfig, SNAPSHOT, "Snapshot", tag, owner, clock, "snapshot_image", __FILE__),
device_image_interface(mconfig, *this), device_image_interface(mconfig, *this),
m_interface(NULL), m_file_extensions(NULL),
m_delay_attoseconds(0) m_interface(NULL),
m_delay_seconds(0),
m_delay_attoseconds(0),
m_timer(NULL)
{ {
} }
snapshot_image_device::snapshot_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : snapshot_image_device::snapshot_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_image_interface(mconfig, *this), device_image_interface(mconfig, *this),
m_interface(NULL), m_file_extensions(NULL),
m_delay_attoseconds(0) m_interface(NULL),
m_delay_seconds(0),
m_delay_attoseconds(0),
m_timer(NULL)
{ {
} }
//------------------------------------------------- //-------------------------------------------------

View File

@ -86,7 +86,7 @@ void config_register(running_machine &machine, const char *nodename, config_save
newtype->save = save; newtype->save = save;
/* add us to the end */ /* add us to the end */
for (ptype = &typelist; *ptype; ptype = &(*ptype)->next) ; for (ptype = &typelist; *ptype; ptype = &(*ptype)->next) { }
*ptype = newtype; *ptype = newtype;
} }

View File

@ -441,7 +441,7 @@ void debug_view_manager::flush_osd_updates()
debug_view *debug_view_manager::append(debug_view *view) debug_view *debug_view_manager::append(debug_view *view)
{ {
debug_view **viewptr; debug_view **viewptr;
for (viewptr = &m_viewlist; *viewptr != NULL; viewptr = &(*viewptr)->m_next) ; for (viewptr = &m_viewlist; *viewptr != NULL; viewptr = &(*viewptr)->m_next) { }
*viewptr = view; *viewptr = view;
return view; return view;
} }

View File

@ -853,7 +853,7 @@ device_interface::device_interface(device_t &device, const char *type)
m_type(type) m_type(type)
{ {
device_interface **tailptr; device_interface **tailptr;
for (tailptr = &device.m_interface_list; *tailptr != NULL; tailptr = &(*tailptr)->m_interface_next) ; for (tailptr = &device.m_interface_list; *tailptr != NULL; tailptr = &(*tailptr)->m_interface_next) { }
*tailptr = this; *tailptr = this;
} }

View File

@ -290,7 +290,7 @@ void emu_options::update_slot_options()
} }
} }
} }
while (add_slot_options(false)); while (add_slot_options(false)) { }
add_device_options(false); add_device_options(false);
} }
@ -359,13 +359,15 @@ void emu_options::remove_device_options()
bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value) bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value)
{ {
// an initial parse to capture the initial set of values // an initial parse to capture the initial set of values
bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); bool result;
core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
// keep adding slot options until we stop seeing new stuff // keep adding slot options until we stop seeing new stuff
bool isfirstpass = true; bool isfirstpass = true;
while (add_slot_options(isfirstpass)) while (add_slot_options(isfirstpass))
{ {
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
isfirstpass = false; isfirstpass = false;
} }
@ -373,9 +375,9 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_
add_device_options(true); add_device_options(true);
if (name != NULL && exists(name)) if (name != NULL && exists(name))
set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string); set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string);
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
int num = 0; int num;
do { do {
num = options_count(); num = options_count();
update_slot_options(); update_slot_options();
@ -528,7 +530,7 @@ void emu_options::set_system_name(const char *name)
// then add the options // then add the options
add_device_options(true); add_device_options(true);
int num = 0; int num;
do { do {
num = options_count(); num = options_count();
update_slot_options(); update_slot_options();

View File

@ -292,8 +292,6 @@ bool hash_collection::from_internal_string(const char *string)
// non-hex alpha values specify a hash type // non-hex alpha values specify a hash type
if (uc >= 'G' && uc <= 'Z') if (uc >= 'G' && uc <= 'Z')
{ {
if (skip_digits != 0)
errors = true;
skip_digits = 0; skip_digits = 0;
if (uc == HASH_CRC) if (uc == HASH_CRC)
{ {

View File

@ -539,7 +539,7 @@ const char *extra_info = NULL;
bool read_hash_config(device_image_interface &image, const char *sysname, std::string &result) bool read_hash_config(device_image_interface &image, const char *sysname, std::string &result)
{ {
hash_file *hashfile = NULL; hash_file *hashfile;
const hash_info *info; const hash_info *info;
/* open the hash file */ /* open the hash file */

View File

@ -510,7 +510,7 @@ bool render_font::load_bdf()
else if (strncmp(ptr, "BITMAP", 6) == 0) else if (strncmp(ptr, "BITMAP", 6) == 0)
{ {
// stash the raw pointer and scan for the end of the character // stash the raw pointer and scan for the end of the character
for (rawdata = ptr = next_line(ptr); ptr != NULL && strncmp(ptr, "ENDCHAR", 7) != 0; ptr = next_line(ptr)) ; for (rawdata = ptr = next_line(ptr); ptr != NULL && strncmp(ptr, "ENDCHAR", 7) != 0; ptr = next_line(ptr)) { }
break; break;
} }
} }

View File

@ -271,7 +271,7 @@ void ui_menu_file_create::populate()
item_append("New Image Name:", new_image_name, 0, ITEMREF_NEW_IMAGE_NAME); item_append("New Image Name:", new_image_name, 0, ITEMREF_NEW_IMAGE_NAME);
// do we support multiple formats? // do we support multiple formats?
format = m_image->formatlist(); if (ENABLE_FORMATS) format = m_image->formatlist();
if (ENABLE_FORMATS && (format != NULL)) if (ENABLE_FORMATS && (format != NULL))
{ {
item_append("Image Format:", m_current_format->description(), 0, ITEMREF_FORMAT); item_append("Image Format:", m_current_format->description(), 0, ITEMREF_FORMAT);

View File

@ -369,7 +369,7 @@ void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer)
// clear the input memory // clear the input memory
machine().input().reset_polling(); machine().input().reset_polling();
while (machine().input().poll_switches() != INPUT_CODE_INVALID) ; while (machine().input().poll_switches() != INPUT_CODE_INVALID) { }
// loop while we have a handler // loop while we have a handler
while (m_handler_callback != handler_ingame && !machine().scheduled_event_pending() && !ui_menu::stack_has_special_main_menu()) while (m_handler_callback != handler_ingame && !machine().scheduled_event_pending() && !ui_menu::stack_has_special_main_menu())

View File

@ -192,7 +192,7 @@ static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS; i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS;
i++, interface = gfx_iter.next()) i++, interface = gfx_iter.next())
{ {
for (count = 0; count < MAX_GFX_ELEMENTS && interface->gfx(count) != NULL; count++); for (count = 0; count < MAX_GFX_ELEMENTS && interface->gfx(count) != NULL; count++) { }
// count = index of first NULL // count = index of first NULL
if (count > 0) if (count > 0)
@ -1006,8 +1006,8 @@ static void tilemap_handler(running_machine &machine, render_container *containe
pixelscale = state.tilemap.zoom; pixelscale = state.tilemap.zoom;
if (pixelscale == 0) if (pixelscale == 0)
{ {
for (maxxscale = 1; mapwidth * (maxxscale + 1) < mapboxwidth; maxxscale++) ; for (maxxscale = 1; mapwidth * (maxxscale + 1) < mapboxwidth; maxxscale++) { }
for (maxyscale = 1; mapheight * (maxyscale + 1) < mapboxheight; maxyscale++) ; for (maxyscale = 1; mapheight * (maxyscale + 1) < mapboxheight; maxyscale++) { }
pixelscale = MIN(maxxscale, maxyscale); pixelscale = MIN(maxxscale, maxyscale);
} }

View File

@ -719,11 +719,11 @@ void validity_checker::validate_analog_input_field(ioport_field &field)
if (field.type() == IPT_POSITIONAL || field.type() == IPT_POSITIONAL_V) if (field.type() == IPT_POSITIONAL || field.type() == IPT_POSITIONAL_V)
{ {
int shift; int shift;
for (shift = 0; shift <= 31 && (~field.mask() & (1 << shift)) != 0; shift++) ; for (shift = 0; shift <= 31 && (~field.mask() & (1 << shift)) != 0; shift++) { }
// convert the positional max value to be in the bitmask for testing // convert the positional max value to be in the bitmask for testing
INT32 analog_max = field.maxval(); //INT32 analog_max = field.maxval();
analog_max = (analog_max - 1) << shift; //analog_max = (analog_max - 1) << shift;
// positional port size must fit in bits used // positional port size must fit in bits used
if ((field.mask() >> shift) + 1 < field.maxval()) if ((field.mask() >> shift) + 1 < field.maxval())