mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Swap: (astring.len() != 0) -> astring
Swap: (astring.len() == 0) -> !astring
This commit is contained in:
parent
0e09afc1a8
commit
4d1fc8fafa
@ -998,14 +998,14 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
|
|||||||
/* build up a comma-separated list */
|
/* build up a comma-separated list */
|
||||||
if (!exec->device().debug()->observing())
|
if (!exec->device().debug()->observing())
|
||||||
{
|
{
|
||||||
if (buffer.len() == 0)
|
if (!buffer)
|
||||||
buffer.printf("Currently ignoring device '%s'", exec->device().tag());
|
buffer.printf("Currently ignoring device '%s'", exec->device().tag());
|
||||||
else
|
else
|
||||||
buffer.catprintf(", '%s'", exec->device().tag());
|
buffer.catprintf(", '%s'", exec->device().tag());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special message for none */
|
/* special message for none */
|
||||||
if (buffer.len() == 0)
|
if (!buffer)
|
||||||
buffer.printf("Not currently ignoring any devices");
|
buffer.printf("Not currently ignoring any devices");
|
||||||
debug_console_printf(machine, "%s\n", buffer.cstr());
|
debug_console_printf(machine, "%s\n", buffer.cstr());
|
||||||
}
|
}
|
||||||
@ -1060,14 +1060,14 @@ static void execute_observe(running_machine *machine, int ref, int params, const
|
|||||||
/* build up a comma-separated list */
|
/* build up a comma-separated list */
|
||||||
if (exec->device().debug()->observing())
|
if (exec->device().debug()->observing())
|
||||||
{
|
{
|
||||||
if (buffer.len() == 0)
|
if (!buffer)
|
||||||
buffer.printf("Currently observing CPU '%s'", exec->device().tag());
|
buffer.printf("Currently observing CPU '%s'", exec->device().tag());
|
||||||
else
|
else
|
||||||
buffer.catprintf(", '%s'", exec->device().tag());
|
buffer.catprintf(", '%s'", exec->device().tag());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special message for none */
|
/* special message for none */
|
||||||
if (buffer.len() == 0)
|
if (!buffer)
|
||||||
buffer.printf("Not currently observing any devices");
|
buffer.printf("Not currently observing any devices");
|
||||||
debug_console_printf(machine, "%s\n", buffer.cstr());
|
debug_console_printf(machine, "%s\n", buffer.cstr());
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ const image_device_format *device_image_interface::device_get_named_creatable_fo
|
|||||||
void device_image_interface::clear_error()
|
void device_image_interface::clear_error()
|
||||||
{
|
{
|
||||||
m_err = IMAGE_ERROR_SUCCESS;
|
m_err = IMAGE_ERROR_SUCCESS;
|
||||||
if (m_err_message.len()!=0)
|
if (m_err_message)
|
||||||
{
|
{
|
||||||
m_err_message.reset();
|
m_err_message.reset();
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ static const char *const messages[] =
|
|||||||
|
|
||||||
const char *device_image_interface::error()
|
const char *device_image_interface::error()
|
||||||
{
|
{
|
||||||
return (m_err_message.len()!=0) ? m_err_message.cstr() : messages[m_err];
|
return (m_err_message) ? m_err_message.cstr() : messages[m_err];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ void device_image_interface::setup_working_directory()
|
|||||||
const char * device_image_interface::working_directory()
|
const char * device_image_interface::working_directory()
|
||||||
{
|
{
|
||||||
/* check to see if we've never initialized the working directory */
|
/* check to see if we've never initialized the working directory */
|
||||||
if (m_working_directory.len() == 0)
|
if (!m_working_directory)
|
||||||
setup_working_directory();
|
setup_working_directory();
|
||||||
|
|
||||||
return m_working_directory;
|
return m_working_directory;
|
||||||
@ -593,7 +593,7 @@ void device_image_interface::image_checkhash()
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* only calculate CRC if it hasn't been calculated, and the open_mode is read only */
|
/* only calculate CRC if it hasn't been calculated, and the open_mode is read only */
|
||||||
if (m_hash.len()==0 && !m_writeable && !m_created)
|
if (!m_hash && !m_writeable && !m_created)
|
||||||
{
|
{
|
||||||
/* do not cause a linear read of 600 megs please */
|
/* do not cause a linear read of 600 megs please */
|
||||||
/* TODO: use SHA/MD5 in the CHD header as the hash */
|
/* TODO: use SHA/MD5 in the CHD header as the hash */
|
||||||
@ -628,7 +628,7 @@ UINT32 device_image_interface::crc()
|
|||||||
UINT32 crc = 0;
|
UINT32 crc = 0;
|
||||||
|
|
||||||
image_checkhash();
|
image_checkhash();
|
||||||
if (m_hash.len()!= 0)
|
if (m_hash)
|
||||||
crc = hash_data_extract_crc32(m_hash.cstr());
|
crc = hash_data_extract_crc32(m_hash.cstr());
|
||||||
|
|
||||||
return crc;
|
return crc;
|
||||||
|
@ -222,11 +222,11 @@ public:
|
|||||||
void seterror(image_error_t err, const char *message);
|
void seterror(image_error_t err, const char *message);
|
||||||
void message(const char *format, ...);
|
void message(const char *format, ...);
|
||||||
|
|
||||||
bool exists() { return m_name.len() != 0; }
|
bool exists() { return m_name; }
|
||||||
const char *filename() { if (m_name.len()==0) return NULL; else return m_name; }
|
const char *filename() { if (!m_name) return NULL; else return m_name; }
|
||||||
const char *basename() { if (m_basename.len()==0) return NULL; else return m_basename; }
|
const char *basename() { if (!m_basename) return NULL; else return m_basename; }
|
||||||
const char *basename_noext() { if (m_basename_noext.len()==0) return NULL; else return m_basename_noext; }
|
const char *basename_noext() { if (!m_basename_noext) return NULL; else return m_basename_noext; }
|
||||||
const char *filetype() { if (m_filetype.len()==0) return NULL; else return m_filetype; }
|
const char *filetype() { if (!m_filetype) return NULL; else return m_filetype; }
|
||||||
core_file *image_core_file() { return m_file; }
|
core_file *image_core_file() { return m_file; }
|
||||||
UINT64 length() { check_for_file(); return core_fsize(m_file); }
|
UINT64 length() { check_for_file(); return core_fsize(m_file); }
|
||||||
bool is_writable() { return m_writeable; }
|
bool is_writable() { return m_writeable; }
|
||||||
|
@ -1353,7 +1353,7 @@ astring &input_code_to_token(running_machine *machine, astring &string, input_co
|
|||||||
devindex[0] = 0;
|
devindex[0] = 0;
|
||||||
|
|
||||||
/* determine the itemid part; look up in the table if we don't have a token */
|
/* determine the itemid part; look up in the table if we don't have a token */
|
||||||
if (item != NULL && item->token.len() != 0)
|
if (item != NULL && item->token)
|
||||||
devcode = item->token;
|
devcode = item->token;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -418,7 +418,7 @@ astring &input_seq_name(running_machine *machine, astring &string, const input_s
|
|||||||
input_code code = seq->code[codenum];
|
input_code code = seq->code[codenum];
|
||||||
|
|
||||||
/* if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs */
|
/* if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs */
|
||||||
if (!INPUT_CODE_IS_INTERNAL(code) && input_code_name(machine, codestr, code).len() == 0)
|
if (!INPUT_CODE_IS_INTERNAL(code) && !input_code_name(machine, codestr, code))
|
||||||
{
|
{
|
||||||
while (copycodenum > 0 && INPUT_CODE_IS_INTERNAL(seqcopy.code[copycodenum - 1]))
|
while (copycodenum > 0 && INPUT_CODE_IS_INTERNAL(seqcopy.code[copycodenum - 1]))
|
||||||
copycodenum--;
|
copycodenum--;
|
||||||
|
@ -789,7 +789,7 @@ void running_machine::handle_saveload()
|
|||||||
file_error filerr = FILERR_NONE;
|
file_error filerr = FILERR_NONE;
|
||||||
|
|
||||||
// if no name, bail
|
// if no name, bail
|
||||||
if (m_saveload_pending_file.len() == 0)
|
if (!m_saveload_pending_file)
|
||||||
goto cancel;
|
goto cancel;
|
||||||
|
|
||||||
// if there are anonymous timers, we can't save just yet, and we can't load yet either
|
// if there are anonymous timers, we can't save just yet, and we can't load yet either
|
||||||
|
@ -298,7 +298,7 @@ public:
|
|||||||
machine_phase phase() const { return m_current_phase; }
|
machine_phase phase() const { return m_current_phase; }
|
||||||
bool paused() const { return m_paused || (m_current_phase != MACHINE_PHASE_RUNNING); }
|
bool paused() const { return m_paused || (m_current_phase != MACHINE_PHASE_RUNNING); }
|
||||||
bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; }
|
bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; }
|
||||||
bool save_or_load_pending() const { return (m_saveload_pending_file.len() != 0); }
|
bool save_or_load_pending() const { return (m_saveload_pending_file); }
|
||||||
bool exit_pending() const { return m_exit_pending; }
|
bool exit_pending() const { return m_exit_pending; }
|
||||||
bool new_driver_pending() const { return (m_new_driver_pending != NULL); }
|
bool new_driver_pending() const { return (m_new_driver_pending != NULL); }
|
||||||
const char *new_driver_name() const { return m_new_driver_pending->name; }
|
const char *new_driver_name() const { return m_new_driver_pending->name; }
|
||||||
|
@ -2577,7 +2577,7 @@ static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter,
|
|||||||
case IPT_UI_DISPLAY_COMMENT:
|
case IPT_UI_DISPLAY_COMMENT:
|
||||||
case IPT_UI_UP:
|
case IPT_UI_UP:
|
||||||
case IPT_UI_DOWN:
|
case IPT_UI_DOWN:
|
||||||
if (cheat_get_comment(event->itemref).len() != 0)
|
if (cheat_get_comment(event->itemref))
|
||||||
popmessage("Cheat Comment:\n%s", cheat_get_comment(event->itemref).cstr());
|
popmessage("Cheat Comment:\n%s", cheat_get_comment(event->itemref).cstr());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ static bool validate_roms(int drivnum, const machine_config *config, region_arra
|
|||||||
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++)
|
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++)
|
||||||
{
|
{
|
||||||
/* stop when we hit an empty */
|
/* stop when we hit an empty */
|
||||||
if (rgninfo->entries[rgnnum].tag.len() == 0)
|
if (!rgninfo->entries[rgnnum].tag)
|
||||||
{
|
{
|
||||||
currgn = &rgninfo->entries[rgnnum];
|
currgn = &rgninfo->entries[rgnnum];
|
||||||
currgn->tag.cpy(fulltag);
|
currgn->tag.cpy(fulltag);
|
||||||
@ -650,7 +650,7 @@ static bool validate_gfx(int drivnum, const machine_config *config, region_array
|
|||||||
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++)
|
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++)
|
||||||
{
|
{
|
||||||
/* stop if we hit an empty */
|
/* stop if we hit an empty */
|
||||||
if (rgninfo->entries[rgnnum].tag.len() == 0)
|
if (!rgninfo->entries[rgnnum].tag)
|
||||||
{
|
{
|
||||||
mame_printf_error("%s: %s has gfx[%d] referencing non-existent region '%s'\n", driver->source_file, driver->name, gfxnum, region);
|
mame_printf_error("%s: %s has gfx[%d] referencing non-existent region '%s'\n", driver->source_file, driver->name, gfxnum, region);
|
||||||
error = true;
|
error = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user