summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emu/cheat.c14
-rw-r--r--src/emu/clifront.c6
-rw-r--r--src/emu/debug/debugcmd.c16
-rw-r--r--src/emu/debug/debugcpu.c8
-rw-r--r--src/emu/debug/express.c2
-rw-r--r--src/emu/device.h2
-rw-r--r--src/emu/diimage.c8
-rw-r--r--src/emu/diimage.h10
-rw-r--r--src/emu/emuopts.c4
-rw-r--r--src/emu/fileio.c2
-rw-r--r--src/emu/input.c4
-rw-r--r--src/emu/ioport.c4
-rw-r--r--src/emu/machine.c2
-rw-r--r--src/emu/machine.h2
-rw-r--r--src/emu/machine/ram.c2
-rw-r--r--src/emu/rendlay.c4
-rw-r--r--src/emu/rendlay.h2
-rw-r--r--src/emu/save.c4
-rw-r--r--src/emu/ui/filemngr.c2
-rw-r--r--src/emu/ui/miscmenu.c4
-rw-r--r--src/emu/ui/slotopt.c2
-rw-r--r--src/emu/ui/ui.c2
-rw-r--r--src/emu/validity.c2
-rw-r--r--src/lib/util/astring.h5
-rw-r--r--src/lib/util/chdcd.c4
-rw-r--r--src/lib/util/options.c4
-rw-r--r--src/lib/util/options.h4
-rw-r--r--src/osd/modules/debugger/debugint.c2
-rw-r--r--src/osd/windows/winmain.c4
-rw-r--r--src/tools/chdman.c2
-rw-r--r--src/tools/split.c2
-rw-r--r--src/tools/src2html.c4
32 files changed, 70 insertions, 69 deletions
diff --git a/src/emu/cheat.c b/src/emu/cheat.c
index 44d6693ac13..39cd2074073 100644
--- a/src/emu/cheat.c
+++ b/src/emu/cheat.c
@@ -498,7 +498,7 @@ void cheat_script::script_entry::execute(cheat_manager &manager, UINT64 &arginde
}
// if there is a string to display, compute it
- if (m_format)
+ if (!m_format.empty())
{
// iterate over arguments and evaluate them
UINT64 params[MAX_ARGUMENTS];
@@ -529,7 +529,7 @@ void cheat_script::script_entry::save(emu_file &cheatfile) const
astring tempstring;
// output an action
- if (!m_format)
+ if (m_format.empty())
{
cheatfile.printf("\t\t\t<action");
if (!m_condition.is_empty())
@@ -785,14 +785,14 @@ void cheat_entry::save(emu_file &cheatfile) const
cheatfile.printf("\t<cheat desc=\"%s\"", m_description.c_str());
if (m_numtemp != DEFAULT_TEMP_VARIABLES)
cheatfile.printf(" tempvariables=\"%d\"", m_numtemp);
- if (!m_comment && m_parameter == NULL && !has_scripts)
+ if (m_comment.empty() && m_parameter == NULL && !has_scripts)
cheatfile.printf(" />\n");
else
{
cheatfile.printf(">\n");
// save the comment
- if (m_comment)
+ if (!m_comment.empty())
cheatfile.printf("\t\t<comment><![CDATA[\n%s\n\t\t]]></comment>\n", m_comment.c_str());
// output the parameter, if present
@@ -961,10 +961,10 @@ void cheat_entry::menu_text(astring &description, astring &state, UINT32 &flags)
// some cheat entries are just text for display
if (is_text_only())
{
- if (description)
+ if (!description.empty())
{
description.trimspace();
- if (!description)
+ if (description.empty())
description.cpy(MENU_SEPARATOR_ITEM);
}
flags = MENU_FLAG_DISABLE;
@@ -1218,7 +1218,7 @@ void cheat_manager::render_text(render_container &container)
{
// render any text and free it along the way
for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++)
- if (m_output[linenum])
+ if (!m_output[linenum].empty())
{
// output the text
machine().ui().draw_text_full(&container, m_output[linenum].c_str(),
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index da44830a67c..4c5f11a4585 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -186,7 +186,7 @@ int cli_frontend::execute(int argc, char **argv)
// otherwise, error on the options
throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", option_errors.trimspace().c_str());
}
- if (option_errors)
+ if (!option_errors.empty())
osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str());
// determine the base name of the EXE
@@ -207,7 +207,7 @@ int cli_frontend::execute(int argc, char **argv)
m_options.revert(OPTION_PRIORITY_INI);
m_options.parse_standard_inis(option_errors);
}
- if (option_errors)
+ if (!option_errors.empty())
osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str());
// if we can't find it, give an appropriate error
@@ -1555,7 +1555,7 @@ void cli_frontend::execute_commands(const char *exename)
// other commands need the INIs parsed
astring option_errors;
m_options.parse_standard_inis(option_errors);
- if (option_errors)
+ if (!option_errors.empty())
osd_printf_error("%s\n", option_errors.c_str());
// createconfig?
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index 37383915e4c..8e1c485046c 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -1035,14 +1035,14 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
/* build up a comma-separated list */
if (!exec->device().debug()->observing())
{
- if (!buffer)
+ if (buffer.empty())
buffer.printf("Currently ignoring device '%s'", exec->device().tag());
else
buffer.catprintf(", '%s'", exec->device().tag());
}
/* special message for none */
- if (!buffer)
+ if (buffer.empty())
buffer.printf("Not currently ignoring any devices");
debug_console_printf(machine, "%s\n", buffer.c_str());
}
@@ -1100,14 +1100,14 @@ static void execute_observe(running_machine &machine, int ref, int params, const
/* build up a comma-separated list */
if (exec->device().debug()->observing())
{
- if (!buffer)
+ if (buffer.empty())
buffer.printf("Currently observing CPU '%s'", exec->device().tag());
else
buffer.catprintf(", '%s'", exec->device().tag());
}
/* special message for none */
- if (!buffer)
+ if (buffer.empty())
buffer.printf("Not currently observing any devices");
debug_console_printf(machine, "%s\n", buffer.c_str());
}
@@ -1328,9 +1328,9 @@ static void execute_bplist(running_machine &machine, int ref, int params, const
for (device_debug::breakpoint *bp = device->debug()->breakpoint_first(); bp != NULL; bp = bp->next())
{
buffer.printf("%c%4X @ %s", bp->enabled() ? ' ' : 'D', bp->index(), core_i64_hex_format(bp->address(), device->debug()->logaddrchars()));
- if (astring(bp->condition()) != astring("1"))
+ if (astring(bp->condition()).cmp("1")!=0)
buffer.catprintf(" if %s", bp->condition());
- if (astring(bp->action()) != astring(""))
+ if (astring(bp->action()).cmp("")!=0)
buffer.catprintf(" do %s", bp->action());
debug_console_printf(machine, "%s\n", buffer.c_str());
printed++;
@@ -1498,9 +1498,9 @@ static void execute_wplist(running_machine &machine, int ref, int params, const
core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()),
core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()),
types[wp->type() & 3]);
- if (astring(wp->condition()) != astring("1"))
+ if (astring(wp->condition()).cmp("1")!=0)
buffer.catprintf(" if %s", wp->condition());
- if (astring(wp->action()) != astring(""))
+ if (astring(wp->action()).cmp("")!=0)
buffer.catprintf(" do %s", wp->action());
debug_console_printf(machine, "%s\n", buffer.c_str());
printed++;
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index 29a4d759552..02b939716cb 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -2908,7 +2908,7 @@ void device_debug::breakpoint_check(offs_t pc)
global->execution_state = EXECUTION_STATE_STOPPED;
// if we hit, evaluate the action
- if (bp->m_action)
+ if (!bp->m_action.empty())
debug_console_execute_command(m_device.machine(), bp->m_action.c_str(), 0);
// print a notification, unless the action made us go again
@@ -2927,7 +2927,7 @@ void device_debug::breakpoint_check(offs_t pc)
global->execution_state = EXECUTION_STATE_STOPPED;
// if we hit, evaluate the action
- if (rp->m_action)
+ if (!rp->m_action.empty())
{
debug_console_execute_command(m_device.machine(), rp->m_action.c_str(), 0);
}
@@ -3037,7 +3037,7 @@ void device_debug::watchpoint_check(address_space &space, int type, offs_t addre
global->execution_state = EXECUTION_STATE_STOPPED;
// if we hit, evaluate the action
- if (wp->m_action)
+ if (!wp->m_action.empty())
debug_console_execute_command(space.machine(), wp->m_action.c_str(), 0);
// print a notification, unless the action made us go again
@@ -3480,7 +3480,7 @@ void device_debug::tracer::update(offs_t pc)
m_loops = 0;
// execute any trace actions first
- if (m_action)
+ if (!m_action.empty())
debug_console_execute_command(m_debug.m_device.machine(), m_action.c_str(), 0);
// print the address
diff --git a/src/emu/debug/express.c b/src/emu/debug/express.c
index 6269a25aa3a..46a4ff22efc 100644
--- a/src/emu/debug/express.c
+++ b/src/emu/debug/express.c
@@ -599,7 +599,7 @@ void parsed_expression::copy(const parsed_expression &src)
{
m_symtable = src.m_symtable;
m_original_string.cpy(src.m_original_string);
- if (m_original_string)
+ if (!m_original_string.empty())
parse_string_into_tokens();
}
diff --git a/src/emu/device.h b/src/emu/device.h
index ce9b2df0181..565a8a278ef 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -166,7 +166,7 @@ public:
static void static_set_clock(device_t &device, UINT32 clock);
static void static_set_static_config(device_t &device, const void *config) { device.m_static_config = config; }
static void static_set_input_default(device_t &device, const input_device_default *config) { device.m_input_defaults = config; }
- static void static_set_default_bios_tag(device_t &device, const char *tag) { astring default_bios_tag(tag); device.m_default_bios_tag = default_bios_tag; }
+ static void static_set_default_bios_tag(device_t &device, const char *tag) { std::string default_bios_tag(tag); device.m_default_bios_tag = default_bios_tag; }
// state helpers
void config_complete();
diff --git a/src/emu/diimage.c b/src/emu/diimage.c
index fb890c08dac..290b92c32ad 100644
--- a/src/emu/diimage.c
+++ b/src/emu/diimage.c
@@ -210,7 +210,7 @@ const image_device_format *device_image_interface::device_get_named_creatable_fo
void device_image_interface::clear_error()
{
m_err = IMAGE_ERROR_SUCCESS;
- if (m_err_message)
+ if (!m_err_message.empty())
{
m_err_message.reset();
}
@@ -236,7 +236,7 @@ static const char *const messages[] =
const char *device_image_interface::error()
{
- return (m_err_message) ? m_err_message.c_str() : messages[m_err];
+ return (!m_err_message.empty()) ? m_err_message.c_str() : messages[m_err];
}
@@ -351,7 +351,7 @@ void device_image_interface::setup_working_directory()
const char * device_image_interface::working_directory()
{
/* check to see if we've never initialized the working directory */
- if (!m_working_directory)
+ if (m_working_directory.empty())
setup_working_directory();
return m_working_directory.c_str();
@@ -900,7 +900,7 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int
// if we had launched from softlist with a specified part, e.g. "shortname:part"
// we would have recorded the wrong name, so record it again based on software_info
- if (m_software_info_ptr && m_full_software_name)
+ if (m_software_info_ptr && !m_full_software_name.empty())
m_err = set_image_filename(m_full_software_name.c_str());
// check if image should be read-only
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index 459bcacac4b..7d90142e478 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -170,11 +170,11 @@ public:
void seterror(image_error_t err, const char *message);
void message(const char *format, ...) ATTR_PRINTF(2,3);
- bool exists() { return m_image_name; }
- const char *filename() { if (!m_image_name) return NULL; else return m_image_name.c_str(); }
- const char *basename() { if (!m_basename) return NULL; else return m_basename.c_str(); }
- const char *basename_noext() { if (!m_basename_noext) return NULL; else return m_basename_noext.c_str(); }
- const char *filetype() { if (!m_filetype) return NULL; else return m_filetype.c_str(); }
+ bool exists() { return !m_image_name.empty(); }
+ const char *filename() { if (m_image_name.empty()) return NULL; else return m_image_name.c_str(); }
+ const char *basename() { if (m_basename.empty()) return NULL; else return m_basename.c_str(); }
+ const char *basename_noext() { if (m_basename_noext.empty()) return NULL; else return m_basename_noext.c_str(); }
+ const char *filetype() { if (m_filetype.empty()) return NULL; else return m_filetype.c_str(); }
core_file *image_core_file() { return m_file; }
UINT64 length() { check_for_file(); return core_fsize(m_file); }
bool is_readonly() { return m_readonly; }
diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c
index 74a452d00af..5ac2d8780d4 100644
--- a/src/emu/emuopts.c
+++ b/src/emu/emuopts.c
@@ -492,7 +492,7 @@ void emu_options::set_system_name(const char *name)
// first set the new name
astring error;
set_value(OPTION_SYSTEMNAME, name, OPTION_PRIORITY_CMDLINE, error);
- assert(!error);
+ assert(error.empty());
// remove any existing device options and then add them afresh
remove_device_options();
@@ -531,7 +531,7 @@ bool emu_options::parse_one_ini(const char *basename, int priority, astring *err
bool result = parse_ini_file(file, priority, OPTION_PRIORITY_DRIVER_INI, error);
// append errors if requested
- if (error && error_string != NULL)
+ if (!error.empty() && error_string != NULL)
error_string->catprintf("While parsing %s:\n%s\n", file.fullpath(), error.c_str());
return result;
diff --git a/src/emu/fileio.c b/src/emu/fileio.c
index a19368d7065..ddc225e67f3 100644
--- a/src/emu/fileio.c
+++ b/src/emu/fileio.c
@@ -229,7 +229,7 @@ hash_collection &emu_file::hashes(const char *types)
needed.cat(*scan);
// if we need nothing, skip it
- if (!needed)
+ if (needed.empty())
return m_hashes;
// load the ZIP file if needed
diff --git a/src/emu/input.c b/src/emu/input.c
index 0beb4b9e4ef..f62ed6889c7 100644
--- a/src/emu/input.c
+++ b/src/emu/input.c
@@ -1502,7 +1502,7 @@ const char *input_manager::code_name(astring &str, input_code code) const
// concatenate the strings
str.cpy(devclass);
- if (devindex)
+ if (!devindex.empty())
str.cat(" ").cat(devindex);
if (devcode[0] != 0)
str.cat(" ").cat(devcode);
@@ -1543,7 +1543,7 @@ const char *input_manager::code_to_token(astring &str, input_code code) const
// concatenate the strings
str.cpy(devclass);
- if (devindex)
+ if (!devindex.empty())
str.cat("_").cat(devindex);
if (devcode[0] != 0)
str.cat("_").cat(devcode);
diff --git a/src/emu/ioport.c b/src/emu/ioport.c
index 3b4410e551c..92d39a90eac 100644
--- a/src/emu/ioport.c
+++ b/src/emu/ioport.c
@@ -1519,7 +1519,7 @@ ioport_field::~ioport_field()
const char *ioport_field::name() const
{
// if we have a non-default name, use that
- if (m_live != NULL && m_live->name)
+ if (m_live != NULL && !m_live->name.empty())
return m_live->name.c_str();
if (m_name != NULL)
return m_name;
@@ -2481,7 +2481,7 @@ time_t ioport_manager::initialize()
{
astring errors;
m_portlist.append(*device, errors);
- if (errors)
+ if (!errors.empty())
osd_printf_error("Input port errors:\n%s", errors.c_str());
}
diff --git a/src/emu/machine.c b/src/emu/machine.c
index e85f39d03cd..fd397757baf 100644
--- a/src/emu/machine.c
+++ b/src/emu/machine.c
@@ -892,7 +892,7 @@ void running_machine::handle_saveload()
// if no name, bail
emu_file file(m_saveload_searchpath, openflags);
- if (!m_saveload_pending_file)
+ if (m_saveload_pending_file.empty())
goto cancel;
// if there are anonymous timers, we can't save just yet, and we can't load yet either
diff --git a/src/emu/machine.h b/src/emu/machine.h
index 9fb264f9963..b045d37700a 100644
--- a/src/emu/machine.h
+++ b/src/emu/machine.h
@@ -182,7 +182,7 @@ public:
bool ui_active() const { return m_ui_active; }
const char *basename() const { return m_basename.c_str(); }
int sample_rate() const { return m_sample_rate; }
- bool save_or_load_pending() const { return m_saveload_pending_file; }
+ bool save_or_load_pending() const { return !m_saveload_pending_file.empty(); }
screen_device *first_screen() const { return primary_screen; }
// additional helpers
diff --git a/src/emu/machine/ram.c b/src/emu/machine/ram.c
index 47d53a48082..d777ab9d064 100644
--- a/src/emu/machine/ram.c
+++ b/src/emu/machine/ram.c
@@ -168,7 +168,7 @@ void ram_device::device_validity_check(validity_checker &valid) const
osd_printf_warning("Setting value to default %s\n",m_default_size);
astring error;
mconfig().options().set_value(OPTION_RAMSIZE, m_default_size, OPTION_PRIORITY_CMDLINE, error);
- assert(!error);
+ assert(error.empty());
}
}
diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c
index 9ac68126fa3..397e7a704ec 100644
--- a/src/emu/rendlay.c
+++ b/src/emu/rendlay.c
@@ -1313,7 +1313,7 @@ void layout_element::component::load_bitmap()
m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname.c_str(), m_imagefile[0].c_str());
// load the alpha bitmap if specified
- if (m_bitmap[0].valid() && m_alphafile[0])
+ if (m_bitmap[0].valid() && !m_alphafile[0].empty())
render_load_png(m_bitmap[0], *m_file[0], m_dirname.c_str(), m_alphafile[0].c_str(), true);
// if we can't load the bitmap, allocate a dummy one and report an error
@@ -1327,7 +1327,7 @@ void layout_element::component::load_bitmap()
m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff);
// log an error
- if (!m_alphafile[0])
+ if (m_alphafile[0].empty())
osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].c_str());
else
osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].c_str(), m_alphafile[0].c_str());
diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h
index 5d59be7e08e..bcfbdcaf6d1 100644
--- a/src/emu/rendlay.h
+++ b/src/emu/rendlay.h
@@ -207,7 +207,7 @@ public:
const render_color &color() const { return m_color; }
int orientation() const { return m_orientation; }
render_container *screen_container(running_machine &machine) const;
- bool has_input() const { return bool(m_input_tag); }
+ bool has_input() const { return !m_input_tag.empty(); }
const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag.c_str(); }
// fetch state based on configured source
diff --git a/src/emu/save.c b/src/emu/save.c
index c4a93a0cefd..03f0859ef6a 100644
--- a/src/emu/save.c
+++ b/src/emu/save.c
@@ -173,12 +173,12 @@ void save_manager::save_memory(device_t *device, const char *module, const char
for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
{
// stop when we find an entry whose name is after ours
- if (entry->m_name > totalname)
+ if (entry->m_name.cmp(totalname)>0)
break;
insert_after = entry;
// error if we are equal
- if (entry->m_name == totalname)
+ if (entry->m_name.cmp(totalname)==0)
fatalerror("Duplicate save state registration entry (%s)\n", totalname.c_str());
}
diff --git a/src/emu/ui/filemngr.c b/src/emu/ui/filemngr.c
index 38e4a55a9c7..55da5ba86bf 100644
--- a/src/emu/ui/filemngr.c
+++ b/src/emu/ui/filemngr.c
@@ -104,7 +104,7 @@ void ui_menu_file_manager::populate()
bool first_entry = true;
astring prev_owner;
- if (m_warnings)
+ if (!m_warnings.empty())
{
item_append(m_warnings.c_str(), NULL, MENU_FLAG_DISABLE, NULL);
item_append("", NULL, MENU_FLAG_DISABLE, NULL);
diff --git a/src/emu/ui/miscmenu.c b/src/emu/ui/miscmenu.c
index a3f55b31cd7..431261cee78 100644
--- a/src/emu/ui/miscmenu.c
+++ b/src/emu/ui/miscmenu.c
@@ -122,14 +122,14 @@ void ui_menu_bios_selection::handle()
if (strcmp(dev->tag(),":")==0) {
astring error;
machine().options().set_value("bios", val-1, OPTION_PRIORITY_CMDLINE, error);
- assert(!error);
+ assert(error.empty());
} else {
astring error;
astring value;
astring temp;
value.printf("%s,bios=%d",machine().options().main_value(temp,dev->owner()->tag()+1),val-1);
machine().options().set_value(dev->owner()->tag()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error);
- assert(!error);
+ assert(error.empty());
}
reset(UI_MENU_RESET_REMEMBER_REF);
}
diff --git a/src/emu/ui/slotopt.c b/src/emu/ui/slotopt.c
index ff1d7a54482..99fa9b32699 100644
--- a/src/emu/ui/slotopt.c
+++ b/src/emu/ui/slotopt.c
@@ -136,7 +136,7 @@ void ui_menu_slot_devices::set_slot_device(device_slot_interface *slot, const ch
{
astring error;
machine().options().set_value(slot->device().tag()+1, val, OPTION_PRIORITY_CMDLINE, error);
- assert(!error);
+ assert(error.empty());
}
/*-------------------------------------------------
diff --git a/src/emu/ui/ui.c b/src/emu/ui/ui.c
index c3041a7d885..7daee1fe5d1 100644
--- a/src/emu/ui/ui.c
+++ b/src/emu/ui/ui.c
@@ -2422,5 +2422,5 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard)
m_use_natural_keyboard = use_natural_keyboard;
astring error;
machine().options().set_value(OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE, error);
- assert(!error);
+ assert(error.empty());
}
diff --git a/src/emu/validity.c b/src/emu/validity.c
index 722e6c555fd..887dd76e123 100644
--- a/src/emu/validity.c
+++ b/src/emu/validity.c
@@ -882,7 +882,7 @@ void validity_checker::validate_inputs()
portlist.append(*device, errorbuf);
// report any errors during construction
- if (errorbuf)
+ if (!errorbuf.empty())
osd_printf_error("I/O port error during construction:\n%s\n", errorbuf.c_str());
// do a first pass over ports to add their names and find duplicates
diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h
index b17ae17076d..1988f73840d 100644
--- a/src/lib/util/astring.h
+++ b/src/lib/util/astring.h
@@ -65,8 +65,8 @@ public:
char operator[](int index) const { return (index < len()) ? m_text[index] : 0; }
// implicit boolean conversion operators
- operator bool() { return m_text[0] != 0; }
- operator bool() const { return m_text[0] != 0; }
+ //operator bool() { return m_text[0] != 0; }
+ //operator bool() const { return m_text[0] != 0; }
// C string conversion operators and helpers
const char *c_str() const { return m_text; }
@@ -77,6 +77,7 @@ public:
// length query
int len() const { return m_len; }
+ bool empty() const { return m_len==0; }
// copy helpers
astring &cpy(const char *src, int count);
diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c
index 0720a6b9aa0..bd2cf2a3837 100644
--- a/src/lib/util/chdcd.c
+++ b/src/lib/util/chdcd.c
@@ -925,7 +925,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
if (trknum == (outtoc.numtrks-1))
{
/* if we have the same filename as the last track, do it that way */
- if (trknum != 0 && outinfo.track[trknum].fname == outinfo.track[trknum-1].fname)
+ if (trknum != 0 && (outinfo.track[trknum].fname.cmp(outinfo.track[trknum-1].fname)==0))
{
tlen = get_file_size(outinfo.track[trknum].fname.c_str());
if (tlen == 0)
@@ -952,7 +952,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
else
{
/* if we have the same filename as the next track, do it that way */
- if (outinfo.track[trknum].fname == outinfo.track[trknum+1].fname)
+ if (outinfo.track[trknum].fname.cmp(outinfo.track[trknum+1].fname)==0)
{
outtoc.tracks[trknum].frames = outinfo.track[trknum+1].idx0offs - outinfo.track[trknum].idx0offs;
diff --git a/src/lib/util/options.c b/src/lib/util/options.c
index f5beddf1d71..3ba8956eb3f 100644
--- a/src/lib/util/options.c
+++ b/src/lib/util/options.c
@@ -362,7 +362,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri
if (curentry->type() == OPTION_COMMAND)
{
// can only have one command
- if (m_command)
+ if (!m_command.empty())
{
error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg);
return false;
@@ -701,7 +701,7 @@ void core_options::remove_entry(core_options::entry &delentry)
{
// remove all names from the map
for (int name = 0; name < ARRAY_LENGTH(delentry.m_name); name++)
- if (delentry.m_name[name])
+ if (!delentry.m_name[name].empty())
m_entrymap.remove(delentry.m_name[name].c_str());
// remove the entry from the list
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 1b9528ff433..dafd2214dab 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -75,7 +75,7 @@ public:
public:
// getters
entry *next() const { return m_next; }
- const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && m_name[index]) ? m_name[index].c_str() : NULL; }
+ const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && !m_name[index].empty()) ? m_name[index].c_str() : NULL; }
const char *description() const { return m_description; }
const char *value() const { return m_data.c_str(); }
const char *default_value() const { return m_defdata.c_str(); }
@@ -87,7 +87,7 @@ public:
bool is_header() const { return type() == OPTION_HEADER; }
bool is_command() const { return type() == OPTION_COMMAND; }
bool is_internal() const { return m_flags & OPTION_FLAG_INTERNAL; }
- bool has_range() const { return (m_minimum && m_maximum); }
+ bool has_range() const { return (!m_minimum.empty() && !m_maximum.empty()); }
int priority() const { return m_priority; }
// setters
diff --git a/src/osd/modules/debugger/debugint.c b/src/osd/modules/debugger/debugint.c
index 9e2c988deff..cbb7a627466 100644
--- a/src/osd/modules/debugger/debugint.c
+++ b/src/osd/modules/debugger/debugint.c
@@ -481,7 +481,7 @@ static void dview_draw_title(DView *dv)
dview_draw_outlined_box(dv, RECT_DVIEW_TITLE, 0, 0, dv->bounds.width(), TITLE_HEIGHT, col);
- if (!dv->title)
+ if (dv->title.empty())
return;
for (i = 0; i<strlen(dv->title.c_str()); i++)
diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c
index c9360a648c4..7cd0fb6bfcb 100644
--- a/src/osd/windows/winmain.c
+++ b/src/osd/windows/winmain.c
@@ -551,7 +551,7 @@ void windows_osd_interface::init(running_machine &machine)
options.set_value(OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM, error_string);
- assert(!error_string);
+ assert(error_string.empty());
}
// determine if we are profiling, and adjust options appropriately
@@ -561,7 +561,7 @@ void windows_osd_interface::init(running_machine &machine)
options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM, error_string);
- assert(!error_string);
+ assert(error_string.empty());
}
// thread priority
diff --git a/src/tools/chdman.c b/src/tools/chdman.c
index a416772729d..4e73fc5f9f8 100644
--- a/src/tools/chdman.c
+++ b/src/tools/chdman.c
@@ -320,7 +320,7 @@ public:
if (offset >= startoffs && offset < endoffs)
{
// if we don't already have this file open, open it now
- if (m_file == NULL || m_lastfile != m_info.track[tracknum].fname)
+ if (m_file == NULL || m_lastfile.cmp(m_info.track[tracknum].fname)!=0)
{
if (m_file != NULL)
core_fclose(m_file);
diff --git a/src/tools/split.c b/src/tools/split.c
index 4e3d93c8bb8..8f598064ffd 100644
--- a/src/tools/split.c
+++ b/src/tools/split.c
@@ -318,7 +318,7 @@ static int join_file(const char *filename, const char *outname, int write_output
compute_hash_as_string(computedhash, splitbuffer, length);
// compare
- if (computedhash != expectedhash)
+ if (computedhash.cmp(expectedhash)!=0)
{
printf("\n");
fprintf(stderr, "Fatal error: file '%s' has incorrect hash\n Expected: %s\n Computed: %s\n", infilename.c_str(), expectedhash.c_str(), computedhash.c_str());
diff --git a/src/tools/src2html.c b/src/tools/src2html.c
index 7d0c55fa6c0..57bdbd9ba9b 100644
--- a/src/tools/src2html.c
+++ b/src/tools/src2html.c
@@ -423,7 +423,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring
dstfile.printf("%s%c%s.html", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str());
if (indexfile != NULL)
core_fprintf(indexfile, "\t<li><a href=\"%s.html\">%s</a></li>\n", curlist->name.c_str(), curlist->name.c_str());
- result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir == dstdir, tempheader, tempfooter);
+ result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir.cmp(dstdir)==0, tempheader, tempfooter);
}
}
@@ -879,7 +879,7 @@ static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootle
astring tempinc(srcincpath, 0, sepindex);
// if we don't match, stop
- if (tempfile != tempinc)
+ if (tempfile.cmp(tempinc)!=0)
break;
lastsepindex = sepindex + 1;
}