mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
Changed a few more 'const char *' ==> 'const std::string &' (#2111)
This commit is contained in:
parent
573853e3b6
commit
a011e3a22e
@ -3013,7 +3013,7 @@ void debugger_commands::execute_mount(int ref, const std::vector<std::string> &p
|
||||
bool done = false;
|
||||
for (device_image_interface &img : image_interface_iterator(m_machine.root_device()))
|
||||
{
|
||||
if (strcmp(img.brief_instance_name(), params[0].c_str()) == 0)
|
||||
if (img.brief_instance_name() == params[0])
|
||||
{
|
||||
if (img.load(params[1]) != image_init_result::PASS)
|
||||
m_console.printf("Unable to mount file %s on %s\n", params[1], params[0]);
|
||||
@ -3036,7 +3036,7 @@ void debugger_commands::execute_unmount(int ref, const std::vector<std::string>
|
||||
bool done = false;
|
||||
for (device_image_interface &img : image_interface_iterator(m_machine.root_device()))
|
||||
{
|
||||
if (strcmp(img.brief_instance_name(), params[0].c_str()) == 0)
|
||||
if (img.brief_instance_name() == params[0])
|
||||
{
|
||||
img.unload();
|
||||
m_console.printf("Unmounted file from : %s\n", params[0]);
|
||||
|
@ -1171,7 +1171,7 @@ image_init_result device_image_interface::load_software(const std::string &softw
|
||||
|
||||
bool device_image_interface::open_image_file(emu_options &options)
|
||||
{
|
||||
const char* path = options.value(instance_name());
|
||||
const char* path = options.value(instance_name().c_str());
|
||||
if (*path != 0)
|
||||
{
|
||||
set_init_phase();
|
||||
@ -1498,7 +1498,7 @@ bool device_image_interface::load_software_part(const std::string &identifier)
|
||||
|
||||
std::string device_image_interface::software_get_default_slot(const char *default_card_slot) const
|
||||
{
|
||||
const char *path = device().mconfig().options().value(instance_name());
|
||||
const char *path = device().mconfig().options().value(instance_name().c_str());
|
||||
std::string result;
|
||||
if (*path != '\0')
|
||||
{
|
||||
|
@ -223,8 +223,8 @@ public:
|
||||
|
||||
const char *image_type_name() const { return device_typename(image_type()); }
|
||||
|
||||
const char *instance_name() const { return m_instance_name.c_str(); }
|
||||
const char *brief_instance_name() const { return m_brief_instance_name.c_str(); }
|
||||
const std::string &instance_name() const { return m_instance_name; }
|
||||
const std::string &brief_instance_name() const { return m_brief_instance_name; }
|
||||
bool uses_file_extension(const char *file_extension) const;
|
||||
const formatlist_type &formatlist() const { return m_formatlist; }
|
||||
|
||||
|
@ -38,7 +38,7 @@ image_manager::image_manager(running_machine &machine)
|
||||
continue;
|
||||
|
||||
// is an image specified for this image
|
||||
const char *image_name_ptr = machine.options().value(image.instance_name());
|
||||
const char *image_name_ptr = machine.options().value(image.instance_name().c_str());
|
||||
if ((image_name_ptr != nullptr) && (image_name_ptr[0] != '\0'))
|
||||
{
|
||||
image_init_result result = image_init_result::FAIL;
|
||||
@ -107,7 +107,7 @@ void image_manager::config_load(config_type cfg_type, util::xml::data_node const
|
||||
{
|
||||
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
|
||||
{
|
||||
if (!strcmp(dev_instance, image.instance_name()))
|
||||
if (!strcmp(dev_instance, image.instance_name().c_str()))
|
||||
{
|
||||
const char *const working_directory = node->get_attribute_string("directory", nullptr);
|
||||
if (working_directory != nullptr)
|
||||
@ -131,7 +131,7 @@ void image_manager::config_save(config_type cfg_type, util::xml::data_node *pare
|
||||
{
|
||||
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
|
||||
{
|
||||
const char *const dev_instance = image.instance_name();
|
||||
const char *const dev_instance = image.instance_name().c_str();
|
||||
|
||||
util::xml::data_node *const node = parentnode->add_child("device", nullptr);
|
||||
if (node != nullptr)
|
||||
@ -188,7 +188,7 @@ void image_manager::options_extract()
|
||||
|
||||
/* and set the option */
|
||||
std::string error;
|
||||
machine().options().set_value(image.instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error);
|
||||
machine().options().set_value(image.instance_name().c_str(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error);
|
||||
|
||||
index++;
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ void cli_frontend::listmedia(const char *gamename)
|
||||
std::string paren_shortname = string_format("(%s)", imagedev.brief_instance_name());
|
||||
|
||||
// output the line, up to the list of extensions
|
||||
printf("%-16s %-16s %-10s ", first ? drivlist.driver().name : "", imagedev.instance_name(), paren_shortname.c_str());
|
||||
printf("%-16s %-16s %-10s ", first ? drivlist.driver().name : "", imagedev.instance_name().c_str(), paren_shortname.c_str());
|
||||
|
||||
// get the extensions and print them
|
||||
std::string extensions(imagedev.file_extensions());
|
||||
|
@ -1482,8 +1482,8 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
|
||||
|
||||
if (loadable)
|
||||
{
|
||||
const char *name = imagedev.instance_name();
|
||||
const char *shortname = imagedev.brief_instance_name();
|
||||
const char *name = imagedev.instance_name().c_str();
|
||||
const char *shortname = imagedev.brief_instance_name().c_str();
|
||||
|
||||
fprintf(m_output, "\t\t\t<instance");
|
||||
fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(name));
|
||||
|
@ -129,11 +129,11 @@ void mame_options::add_device_options(emu_options &options, std::function<void(e
|
||||
// retrieve info about the device instance
|
||||
std::ostringstream option_name;
|
||||
util::stream_format(option_name, "%s;%s", image.instance_name(), image.brief_instance_name());
|
||||
if (strcmp(image.device_typename(image.image_type()), image.instance_name()) == 0)
|
||||
if (strcmp(image.device_typename(image.image_type()), image.instance_name().c_str()) == 0)
|
||||
util::stream_format(option_name, ";%s1;%s1", image.instance_name(), image.brief_instance_name());
|
||||
|
||||
// add the option
|
||||
if (!options.exists(image.instance_name()))
|
||||
if (!options.exists(image.instance_name().c_str()))
|
||||
{
|
||||
// first device? add the header as to be pretty
|
||||
if (m_device_options++ == 0)
|
||||
|
@ -203,7 +203,7 @@ void favorite_manager::add_favorite_game()
|
||||
tmpmatches.driver = &machine().system();
|
||||
tmpmatches.listname = strensure(image.software_list_name());
|
||||
tmpmatches.interface = part->interface();
|
||||
tmpmatches.instance = strensure(image.instance_name());
|
||||
tmpmatches.instance = image.instance_name();
|
||||
tmpmatches.startempty = 0;
|
||||
tmpmatches.parentlongname.clear();
|
||||
if (!swinfo->parentname().empty())
|
||||
|
@ -540,7 +540,7 @@ void menu_select_software::build_software_list()
|
||||
const char *interface = image.image_interface();
|
||||
if (interface != nullptr && part.matches_interface(interface))
|
||||
{
|
||||
instance_name = image.instance_name();
|
||||
instance_name = image.instance_name().c_str();
|
||||
if (instance_name != nullptr)
|
||||
tmpmatches.instance = image.instance_name();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user