diff options
Diffstat (limited to 'src')
47 files changed, 133 insertions, 135 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index fa65b327d6c..342374bd545 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -3119,7 +3119,7 @@ void debugger_commands::execute_snap(int ref, const std::vector<std::string> &pa if (fname.find(".png") == -1) fname.append(".png"); emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - osd_file::error filerr = file.open(fname.c_str()); + osd_file::error filerr = file.open(fname); if (filerr != osd_file::error::NONE) { diff --git a/src/emu/device.cpp b/src/emu/device.cpp index cd7bc5918ec..0a4a36c20f2 100644 --- a/src/emu/device.cpp +++ b/src/emu/device.cpp @@ -130,7 +130,7 @@ device_t::~device_t() memory_region *device_t::memregion(std::string _tag) const { // build a fully-qualified name and look it up - auto search = machine().memory().regions().find(subtag(_tag).c_str()); + auto search = machine().memory().regions().find(subtag(_tag)); if (search != machine().memory().regions().end()) return search->second.get(); else @@ -146,7 +146,7 @@ memory_region *device_t::memregion(std::string _tag) const memory_share *device_t::memshare(std::string _tag) const { // build a fully-qualified name and look it up - auto search = machine().memory().shares().find(subtag(_tag).c_str()); + auto search = machine().memory().shares().find(subtag(_tag)); if (search != machine().memory().shares().end()) return search->second.get(); else @@ -161,7 +161,7 @@ memory_share *device_t::memshare(std::string _tag) const memory_bank *device_t::membank(std::string _tag) const { - auto search = machine().memory().banks().find(subtag(_tag).c_str()); + auto search = machine().memory().banks().find(subtag(_tag)); if (search != machine().memory().banks().end()) return search->second.get(); else diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 5595ca809be..fe3d6d9e292 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -448,7 +448,7 @@ u8 *device_image_interface::get_software_region(const char *tag) return nullptr; std::string full_tag = util::string_format("%s:%s", device().tag(), tag); - memory_region *region = device().machine().root_device().memregion(full_tag.c_str()); + memory_region *region = device().machine().root_device().memregion(full_tag); return region != nullptr ? region->base() : nullptr; } @@ -460,7 +460,7 @@ u8 *device_image_interface::get_software_region(const char *tag) u32 device_image_interface::get_software_region_length(const char *tag) { std::string full_tag = util::string_format("%s:%s", device().tag(), tag); - memory_region *region = device().machine().root_device().memregion(full_tag.c_str()); + memory_region *region = device().machine().root_device().memregion(full_tag); return region != nullptr ? region->bytes() : 0; } @@ -632,7 +632,7 @@ void device_image_interface::battery_load(void *buffer, int length, int fill) osd_file::error filerr; int bytes_read = 0; - std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv"); + std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext).append(".nv"); /* try to open the battery file and read it in, if possible */ emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ); @@ -651,7 +651,7 @@ void device_image_interface::battery_load(void *buffer, int length, const void * osd_file::error filerr; int bytes_read = 0; - std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv"); + std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext).append(".nv"); // try to open the battery file and read it in, if possible emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ); @@ -680,7 +680,7 @@ void device_image_interface::battery_save(const void *buffer, int length) if (!device().machine().options().nvram_save()) return; - std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv"); + std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext).append(".nv"); // try to open the battery file and write it out, if possible emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); @@ -930,7 +930,7 @@ bool device_image_interface::load_software(software_list_device &swlist, const c while (swinfo != nullptr) { locationtag.append(swinfo->shortname()).append(breakstr); - swinfo = !swinfo->parentname().empty() ? swlist.find(swinfo->parentname().c_str()) : nullptr; + swinfo = !swinfo->parentname().empty() ? swlist.find(swinfo->parentname()) : nullptr; } // strip the final '%' locationtag.erase(locationtag.length() - 1, 1); diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index 6135b4a2f64..a48ad44c40b 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -260,7 +260,7 @@ void device_sound_interface::interface_validity_check(validity_checker &valid) c // find a device with the requested tag device_t const *const target = route.m_base.get().subdevice(route.m_target.c_str()); if (!target) - osd_printf_error("Attempting to route sound to non-existent device '%s'\n", route.m_base.get().subtag(route.m_target.c_str())); + osd_printf_error("Attempting to route sound to non-existent device '%s'\n", route.m_base.get().subtag(route.m_target)); // if it's not a speaker or a sound device, error device_sound_interface const *sound; diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index 691917bc4a5..3514045e32d 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -1422,7 +1422,7 @@ void address_space::prepare_map() { // if we can't find it, add it to our map std::string fulltag = entry.m_devbase.subtag(entry.m_share); - if (m_manager.m_sharelist.find(fulltag.c_str()) == m_manager.m_sharelist.end()) + if (m_manager.m_sharelist.find(fulltag) == m_manager.m_sharelist.end()) { VPRINTF(("Creating share '%s' of length 0x%X\n", fulltag.c_str(), entry.m_addrend + 1 - entry.m_addrstart)); m_manager.m_sharelist.emplace(fulltag.c_str(), std::make_unique<memory_share>(m_config.data_width(), address_to_byte(entry.m_addrend + 1 - entry.m_addrstart), endianness())); @@ -1447,7 +1447,7 @@ void address_space::prepare_map() std::string fulltag = entry.m_devbase.subtag(entry.m_region); // find the region - memory_region *region = m_manager.machine().root_device().memregion(fulltag.c_str()); + memory_region *region = m_manager.machine().root_device().memregion(fulltag); if (region == nullptr) fatalerror("device '%s' %s space memory map entry %X-%X references nonexistent region \"%s\"\n", m_device.tag(), m_name, entry.m_addrstart, entry.m_addrend, entry.m_region); @@ -1463,7 +1463,7 @@ void address_space::prepare_map() std::string fulltag = entry.m_devbase.subtag(entry.m_region); // set the memory address - entry.m_memory = m_manager.machine().root_device().memregion(fulltag.c_str())->base() + entry.m_rgnoffs; + entry.m_memory = m_manager.machine().root_device().memregion(fulltag)->base() + entry.m_rgnoffs; } } } @@ -1774,7 +1774,7 @@ address_map_entry *address_space::block_assign_intersecting(offs_t addrstart, of if (entry.m_memory == nullptr && entry.m_share != nullptr) { std::string fulltag = entry.m_devbase.subtag(entry.m_share); - auto share = m_manager.shares().find(fulltag.c_str()); + auto share = m_manager.shares().find(fulltag); if (share != m_manager.shares().end() && share->second->ptr() != nullptr) { entry.m_memory = share->second->ptr(); @@ -1797,7 +1797,7 @@ address_map_entry *address_space::block_assign_intersecting(offs_t addrstart, of if (entry.m_memory != nullptr && entry.m_share != nullptr) { std::string fulltag = entry.m_devbase.subtag(entry.m_share); - auto share = m_manager.shares().find(fulltag.c_str()); + auto share = m_manager.shares().find(fulltag); if (share != m_manager.shares().end() && share->second->ptr() == nullptr) { share->second->set_ptr(entry.m_memory); @@ -2299,7 +2299,7 @@ bool address_space::needs_backing_store(const address_map_entry &entry) if (entry.m_share != nullptr) { std::string fulltag = entry.m_devbase.subtag(entry.m_share); - auto share = m_manager.shares().find(fulltag.c_str()); + auto share = m_manager.shares().find(fulltag); if (share != m_manager.shares().end() && share->second->ptr() == nullptr) return true; } diff --git a/src/emu/emupal.cpp b/src/emu/emupal.cpp index 536eff6577d..6c027ffe611 100644 --- a/src/emu/emupal.cpp +++ b/src/emu/emupal.cpp @@ -502,7 +502,7 @@ void palette_device::device_start() { // find the extended (split) memory, if present std::string tag_ext = std::string(tag()).append("_ext"); - const memory_share *share_ext = memshare(tag_ext.c_str()); + const memory_share *share_ext = memshare(tag_ext); // make sure we have specified a format if (m_raw_to_rgb.bytes_per_entry() <= 0) diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 1f45ba4fe04..4bff92807d9 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -2754,7 +2754,7 @@ void ioport_manager::timecode_init() filename.append(record_filename).append(".timecode"); osd_printf_info("Record input timecode file: %s\n", record_filename); - osd_file::error filerr = m_timecode_file.open(filename.c_str()); + osd_file::error filerr = m_timecode_file.open(filename); if (filerr != osd_file::error::NONE) throw emu_fatalerror("ioport_manager::timecode_init: Failed to open file for input timecode recording"); @@ -3028,7 +3028,7 @@ ioport_configurer& ioport_configurer::port_modify(const char *tag) std::string fulltag = m_owner.subtag(tag); // find the existing port - m_curport = m_portlist.find(fulltag.c_str())->second.get(); + m_curport = m_portlist.find(fulltag)->second.get(); if (m_curport == nullptr) throw emu_fatalerror("Requested to modify nonexistent port '%s'", fulltag.c_str()); diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index e6ef063a0ac..a7c9c1be749 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -513,7 +513,7 @@ std::string running_machine::get_statename(const char *option) const if (pos != -1) { // if more %d are found, revert to default and ignore them all - if (statename_str.find(statename_dev.c_str(), pos + 3) != -1) + if (statename_str.find(statename_dev, pos + 3) != -1) statename_str.assign("%g"); // else if there is a single %d, try to create the correct snapname else @@ -557,7 +557,7 @@ std::string running_machine::get_statename(const char *option) const std::string filename(image.basename_noext()); // setup snapname and remove the %d_ - strreplace(statename_str, devname_str.c_str(), filename.c_str()); + strreplace(statename_str, devname_str, filename); statename_str.erase(pos, 3); //printf("check image: %s\n", filename.c_str()); diff --git a/src/emu/render.cpp b/src/emu/render.cpp index b25e18fa968..6e7067ea30e 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -2041,7 +2041,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) // attempt to open the file; bail if we can't emu_file layoutfile(m_manager.machine().options().art_path(), OPEN_FLAG_READ); - osd_file::error const filerr(layoutfile.open(fname.c_str())); + osd_file::error const filerr(layoutfile.open(fname)); if (filerr != osd_file::error::NONE) return false; diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index c5debb5f055..788f84a60ca 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -958,7 +958,7 @@ bool render_font::load_cached_bdf(const char *filename) // attempt to open the cached version of the font { emu_file cachefile(m_manager.machine().options().font_path(), OPEN_FLAG_READ); - filerr = cachefile.open(cachedname.c_str()); + filerr = cachefile.open(cachedname); if (filerr == osd_file::error::NONE) { // if we have a cached version, load it diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index f13d8aff77b..e33de69da50 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3414,7 +3414,7 @@ void layout_view::item::resolve_tags() if (!m_input_tag.empty()) { - m_input_port = m_element->machine().root_device().ioport(m_input_tag.c_str()); + m_input_port = m_element->machine().root_device().ioport(m_input_tag); if (m_input_port) { for (ioport_field &field : m_input_port->fields()) diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index ab5770b86e1..7a1aa9193bb 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -559,7 +559,7 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname else fname.assign(dirname).append(PATH_SEPARATOR).append(filename); - if (file.open(fname.c_str()) != osd_file::error::NONE) + if (file.open(fname) != osd_file::error::NONE) return; // define standard JPEG structures @@ -637,7 +637,7 @@ bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, fname.assign(dirname).append(PATH_SEPARATOR).append(filename); else fname.assign(filename); - osd_file::error const filerr = file.open(fname.c_str()); + osd_file::error const filerr = file.open(fname); if (filerr != osd_file::error::NONE) return false; @@ -810,7 +810,7 @@ ru_imgformat render_detect_image(emu_file &file, const char *dirname, const char fname.assign(dirname).append(PATH_SEPARATOR).append(filename); else fname.assign(filename); - osd_file::error const filerr = file.open(fname.c_str()); + osd_file::error const filerr = file.open(fname); if (filerr != osd_file::error::NONE) return RENDUTIL_IMGFORMAT_ERROR; diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 57f04d8de74..67ef6cfb6aa 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -1093,7 +1093,7 @@ chd_error rom_load_manager::open_disk_diff(emu_options &options, const rom_entry /* try to open the diff */ LOG("Opening differencing image file: %s\n", fname.c_str()); emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE); - osd_file::error filerr = diff_file.open(fname.c_str()); + osd_file::error filerr = diff_file.open(fname); if (filerr == osd_file::error::NONE) { std::string fullpath(diff_file.fullpath()); @@ -1106,7 +1106,7 @@ chd_error rom_load_manager::open_disk_diff(emu_options &options, const rom_entry /* didn't work; try creating it instead */ LOG("Creating differencing image: %s\n", fname.c_str()); diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - filerr = diff_file.open(fname.c_str()); + filerr = diff_file.open(fname); if (filerr == osd_file::error::NONE) { std::string fullpath(diff_file.fullpath()); @@ -1282,7 +1282,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list while (swinfo != nullptr) { locationtag.append(swinfo->shortname()).append(breakstr); - swinfo = !swinfo->parentname().empty() ? swlist.find(swinfo->parentname().c_str()) : nullptr; + swinfo = !swinfo->parentname().empty() ? swlist.find(swinfo->parentname()) : nullptr; } // strip the final '%' locationtag.erase(locationtag.length() - 1, 1); @@ -1303,7 +1303,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list /* if this is a device region, override with the device width and endianness */ endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; u8 width = ROMREGION_GETWIDTH(region) / 8; - memory_region *memregion = machine().root_device().memregion(regiontag.c_str()); + memory_region *memregion = machine().root_device().memregion(regiontag); if (memregion != nullptr) { normalize_flags_for_device(regiontag.c_str(), width, endianness); @@ -1413,7 +1413,7 @@ void rom_load_manager::process_region_list() for (device_t &device : deviter) for (const rom_entry *param = rom_first_parameter(device); param != nullptr; param = rom_next_parameter(param)) { - std::string regiontag = device.subtag(param->name().c_str()); + std::string regiontag = device.subtag(param->name()); machine().parameters().add(regiontag, param->hashdata()); } } diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp index e177954b248..9b749e8a4ec 100644 --- a/src/emu/softlist_dev.cpp +++ b/src/emu/softlist_dev.cpp @@ -282,7 +282,7 @@ void software_list_device::parse() m_errors.clear(); // attempt to open the file - osd_file::error filerr = m_file.open(m_list_name.c_str(), ".xml"); + osd_file::error filerr = m_file.open(m_list_name, ".xml"); if (filerr == osd_file::error::NONE) { // parse if no error @@ -489,7 +489,7 @@ void software_list_device::internal_validity_check(validity_checker &valid) } // make sure the parent exists - const software_info *swinfo2 = find(swinfo.parentname().c_str()); + const software_info *swinfo2 = find(swinfo.parentname()); if (swinfo2 == nullptr) osd_printf_error("%s: parent '%s' software for '%s' not found\n", filename(), swinfo.parentname(), shortname); diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index 0957d25c4f0..fab04e8f162 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -1784,7 +1784,7 @@ void tilemap_device::device_start() // look for an extension entry std::string tag_ext = std::string(tag()).append("_ext"); - share = memshare(tag_ext.c_str()); + share = memshare(tag_ext); if (share != nullptr) m_extmem.set(*share, m_bytes_per_entry); } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 71bc97d6cef..727af74ea01 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -441,7 +441,7 @@ void video_manager::begin_recording_mng(const char *name, uint32_t index, screen full_name = name_buf; } - filerr = info.m_mng_file->open(full_name.c_str()); + filerr = info.m_mng_file->open(full_name); } else { @@ -518,7 +518,7 @@ void video_manager::begin_recording_avi(const char *name, uint32_t index, screen full_name = name_buf; } - filerr = tempfile.open(full_name.c_str()); + filerr = tempfile.open(full_name); } else { @@ -1350,7 +1350,7 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension, if (pos != -1) { // if more %d are found, revert to default and ignore them all - if (snapstr.find(snapdev.c_str(), pos + 3) != -1) + if (snapstr.find(snapdev, pos + 3) != -1) snapstr.assign("%g/%i"); // else if there is a single %d, try to create the correct snapname else @@ -1397,7 +1397,7 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension, filename = filename.substr(0, filename.find_last_of('.')); // setup snapname and remove the %d_ - strreplace(snapstr, snapdevname.c_str(), filename.c_str()); + strreplace(snapstr, snapdevname, filename); snapstr.erase(pos, 3); //printf("check image: %s\n", filename.c_str()); @@ -1433,10 +1433,10 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension, { // build up the filename fname.assign(snapstr); - strreplace(fname, "%i", string_format("%04d", seq).c_str()); + strreplace(fname, "%i", string_format("%04d", seq)); // try to open the file; stop when we fail - osd_file::error filerr = file.open(fname.c_str()); + osd_file::error filerr = file.open(fname); if (filerr == osd_file::error::NOT_FOUND) { break; @@ -1446,7 +1446,7 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension, // create the final file file.set_openflags(origflags); - return file.open(fname.c_str()); + return file.open(fname); } diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp index a33dd4bb52a..dbba78e20ec 100644 --- a/src/frontend/mame/audit.cpp +++ b/src/frontend/mame/audit.cpp @@ -220,14 +220,14 @@ media_auditor::summary media_auditor::audit_samples() // look for the files emu_file file(m_enumerator.options().sample_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); - path_iterator path(searchpath.c_str()); + path_iterator path(searchpath); std::string curpath; while (path.next(curpath, samplename)) { // attempt to access the file (.flac) or (.wav) - osd_file::error filerr = file.open(curpath.c_str(), ".flac"); + osd_file::error filerr = file.open(curpath, ".flac"); if (filerr != osd_file::error::NONE) - filerr = file.open(curpath.c_str(), ".wav"); + filerr = file.open(curpath, ".wav"); if (filerr == osd_file::error::NONE) { @@ -397,9 +397,9 @@ media_auditor::audit_record &media_auditor::audit_one_rom(const rom_entry *rom) // open the file if we can osd_file::error filerr; if (has_crc) - filerr = file.open(curpath.c_str(), crc); + filerr = file.open(curpath, crc); else - filerr = file.open(curpath.c_str()); + filerr = file.open(curpath); // if it worked, get the actual length and hashes, then stop if (filerr == osd_file::error::NONE) diff --git a/src/frontend/mame/language.cpp b/src/frontend/mame/language.cpp index a5f2e9ce3a9..2740aed973f 100644 --- a/src/frontend/mame/language.cpp +++ b/src/frontend/mame/language.cpp @@ -68,7 +68,7 @@ void load_translation(emu_options &m_options) strreplace(name, "(", ""); strreplace(name, ")", ""); emu_file file(m_options.language_path(), OPEN_FLAG_READ); - if (file.open(name.c_str(), PATH_SEPARATOR "strings.mo") != osd_file::error::NONE) + if (file.open(name, PATH_SEPARATOR "strings.mo") != osd_file::error::NONE) { osd_printf_error("Error opening translation file %s\n", name); return; diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index cc9c597b037..411004676a9 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1227,13 +1227,13 @@ void lua_engine::initialize() if(e.type() != OPTION_FLOAT) luaL_error(m_lua_state, "Cannot set option to wrong type"); else - e.set_value(string_format("%f", val).c_str(), OPTION_PRIORITY_CMDLINE); + e.set_value(string_format("%f", val), OPTION_PRIORITY_CMDLINE); }, [this](core_options::entry &e, int val) { if(e.type() != OPTION_INTEGER) luaL_error(m_lua_state, "Cannot set option to wrong type"); else - e.set_value(string_format("%d", val).c_str(), OPTION_PRIORITY_CMDLINE); + e.set_value(string_format("%d", val), OPTION_PRIORITY_CMDLINE); }, [this](core_options::entry &e, const char *val) { if(e.type() != OPTION_STRING) @@ -1647,9 +1647,9 @@ void lua_engine::initialize() if(!item) break; name = &(strchr(item, '/')[1]); - if(name.substr(0, name.find("/")) == tag) + if(name.substr(0, name.find('/')) == tag) { - name = name.substr(name.find("/") + 1, std::string::npos); + name = name.substr(name.find('/') + 1, std::string::npos); table[name] = i; } } diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp index 48fd67a2a67..dfd206706b8 100644 --- a/src/frontend/mame/ui/custui.cpp +++ b/src/frontend/mame/ui/custui.cpp @@ -76,7 +76,7 @@ menu_custom_ui::~menu_custom_ui() ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE); if (!m_lang.empty()) { - machine().options().set_value(OPTION_LANGUAGE, m_lang[m_currlang].c_str(), OPTION_PRIORITY_CMDLINE); + machine().options().set_value(OPTION_LANGUAGE, m_lang[m_currlang], OPTION_PRIORITY_CMDLINE); load_translation(machine().options()); } ui_globals::reset = true; @@ -172,7 +172,7 @@ void menu_custom_ui::populate(float &customtop, float &custombottom) if (!m_lang.empty()) { arrow_flags = get_arrow_flags<std::uint16_t>(0, m_lang.size() - 1, m_currlang); - item_append(_("Language"), m_lang[m_currlang].c_str(), arrow_flags, (void *)(uintptr_t)LANGUAGE_MENU); + item_append(_("Language"), m_lang[m_currlang], arrow_flags, (void *)(uintptr_t)LANGUAGE_MENU); } arrow_flags = get_arrow_flags<uint16_t>(0, HIDE_BOTH, ui_globals::panels_status); @@ -445,7 +445,7 @@ menu_colors_ui::~menu_colors_ui() for (int index = 1; index < MUI_RESTORE; index++) { dec_color = string_format("%x", (uint32_t)m_color_table[index].color); - ui().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE); + ui().options().set_value(m_color_table[index].option, dec_color, OPTION_PRIORITY_CMDLINE); } // refresh our cached colors diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp index 1d8166718f0..50afe928561 100644 --- a/src/frontend/mame/ui/dirmenu.cpp +++ b/src/frontend/mame/ui/dirmenu.cpp @@ -170,7 +170,7 @@ void menu_display_actual::populate(float &customtop, float &custombottom) else m_searchpath.assign(machine().options().value(s_folders[m_ref].option)); - path_iterator path(m_searchpath.c_str()); + path_iterator path(m_searchpath); std::string curpath; m_folders.clear(); while (path.next(curpath, nullptr)) @@ -226,7 +226,7 @@ menu_add_change_folder::menu_add_change_folder(mame_ui_manager &mui, render_cont else searchpath = mui.machine().options().value(s_folders[m_ref].option); - path_iterator path(searchpath.c_str()); + path_iterator path(searchpath); std::string curpath; while (path.next(curpath, nullptr)) m_folders.push_back(curpath); @@ -289,10 +289,10 @@ void menu_add_change_folder::handle() if (m_change) { if (ui().options().exists(s_folders[m_ref].option)) - ui().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE); + ui().options().set_value(s_folders[m_ref].option, m_current_path, OPTION_PRIORITY_CMDLINE); else if (strcmp(machine().options().value(s_folders[m_ref].option), m_current_path.c_str()) != 0) { - machine().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE); + machine().options().set_value(s_folders[m_ref].option, m_current_path, OPTION_PRIORITY_CMDLINE); } } else @@ -307,10 +307,10 @@ void menu_add_change_folder::handle() } if (ui().options().exists(s_folders[m_ref].option)) - ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE); + ui().options().set_value(s_folders[m_ref].option, tmppath, OPTION_PRIORITY_CMDLINE); else if (strcmp(machine().options().value(s_folders[m_ref].option), tmppath.c_str()) != 0) { - machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE); + machine().options().set_value(s_folders[m_ref].option, tmppath, OPTION_PRIORITY_CMDLINE); } } @@ -449,7 +449,7 @@ menu_remove_folder::menu_remove_folder(mame_ui_manager &mui, render_container &c else m_searchpath.assign(mui.machine().options().value(s_folders[m_ref].option)); - path_iterator path(m_searchpath.c_str()); + path_iterator path(m_searchpath); std::string curpath; while (path.next(curpath, nullptr)) m_folders.push_back(curpath); @@ -479,10 +479,10 @@ void menu_remove_folder::handle() } if (ui().options().exists(s_folders[m_ref].option)) - ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE); + ui().options().set_value(s_folders[m_ref].option, tmppath, OPTION_PRIORITY_CMDLINE); else if (strcmp(machine().options().value(s_folders[m_ref].option),tmppath.c_str())!=0) { - machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE); + machine().options().set_value(s_folders[m_ref].option, tmppath, OPTION_PRIORITY_CMDLINE); } reset_parent(reset_options::REMEMBER_REF); diff --git a/src/frontend/mame/ui/filecreate.cpp b/src/frontend/mame/ui/filecreate.cpp index 9928829ecf5..157b19bec9a 100644 --- a/src/frontend/mame/ui/filecreate.cpp +++ b/src/frontend/mame/ui/filecreate.cpp @@ -205,7 +205,7 @@ void menu_file_create::handle() if ((event->itemref == ITEMREF_CREATE) || (event->itemref == ITEMREF_NEW_IMAGE_NAME)) { std::string tmp_file(m_filename); - if (tmp_file.find(".") != -1 && tmp_file.find(".") < tmp_file.length() - 1) + if (tmp_file.find('.') != -1 && tmp_file.find('.') < tmp_file.length() - 1) { m_current_file = m_filename; stack_pop(); diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp index 3312e5d54e7..8d3ef0974c1 100644 --- a/src/frontend/mame/ui/imgcntrl.cpp +++ b/src/frontend/mame/ui/imgcntrl.cpp @@ -95,7 +95,7 @@ void menu_control_device_image::test_create(bool &can_create, bool &need_confirm auto path = util::zippath_combine(m_current_directory, m_current_file); // does a file or a directory exist at the path - auto entry = osd_stat(path.c_str()); + auto entry = osd_stat(path); auto file_type = (entry != nullptr) ? entry->type : osd::directory::entry::entry_type::NONE; switch(file_type) @@ -211,7 +211,7 @@ void menu_control_device_image::handle() break; case SELECT_PARTLIST: - m_swi = m_sld->find(m_software_info_name.c_str()); + m_swi = m_sld->find(m_software_info_name); if (!m_swi) m_state = START_SOFTLIST; else if (m_swi->has_multiple_parts(m_image.image_interface())) diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 4278e0efad9..55147b020ec 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -609,11 +609,11 @@ void menu_export::handle() { std::string filename("exported"); emu_file infile(ui().options().ui_path(), OPEN_FLAG_READ); - if (infile.open(filename.c_str(), ".xml") == osd_file::error::NONE) + if (infile.open(filename, ".xml") == osd_file::error::NONE) for (int seq = 0; ; ++seq) { std::string seqtext = string_format("%s_%04d", filename, seq); - if (infile.open(seqtext.c_str(), ".xml") != osd_file::error::NONE) + if (infile.open(seqtext, ".xml") != osd_file::error::NONE) { filename = seqtext; break; @@ -622,7 +622,7 @@ void menu_export::handle() // attempt to open the output file emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(filename.c_str(), ".xml") == osd_file::error::NONE) + if (file.open(filename, ".xml") == osd_file::error::NONE) { std::string fullpath(file.fullpath()); file.close(); @@ -654,11 +654,11 @@ void menu_export::handle() { std::string filename("exported"); emu_file infile(ui().options().ui_path(), OPEN_FLAG_READ); - if (infile.open(filename.c_str(), ".txt") == osd_file::error::NONE) + if (infile.open(filename, ".txt") == osd_file::error::NONE) for (int seq = 0; ; ++seq) { std::string seqtext = string_format("%s_%04d", filename, seq); - if (infile.open(seqtext.c_str(), ".txt") != osd_file::error::NONE) + if (infile.open(seqtext, ".txt") != osd_file::error::NONE) { filename = seqtext; break; @@ -667,7 +667,7 @@ void menu_export::handle() // attempt to open the output file emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(filename.c_str(), ".txt") == osd_file::error::NONE) + if (file.open(filename, ".txt") == osd_file::error::NONE) { // print the header std::ostringstream buffer; @@ -764,7 +764,7 @@ void menu_machine_configure::handle() { std::string filename(m_drv.name); emu_file file(machine().options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); - osd_file::error filerr = file.open(filename.c_str(), ".ini"); + osd_file::error filerr = file.open(filename, ".ini"); if (filerr == osd_file::error::NONE) { std::string inistring = m_opts.output_ini(); diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index b7e621997ad..00113d8aeda 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -251,7 +251,7 @@ menu_select_game::menu_select_game(mame_ui_manager &mui, render_container &conta ui_globals::rpanel = std::min<int>(std::max<int>(moptions.last_right_panel(), RP_FIRST), RP_LAST); std::string tmp(moptions.last_used_filter()); - std::size_t const found = tmp.find_first_of(","); + std::size_t const found = tmp.find_first_of(','); std::string fake_ini; if (found == std::string::npos) { @@ -306,8 +306,8 @@ menu_select_game::~menu_select_game() ui_options &mopt = ui().options(); mopt.set_value(OPTION_LAST_RIGHT_PANEL, ui_globals::rpanel, OPTION_PRIORITY_CMDLINE); - mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE); - mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE); + mopt.set_value(OPTION_LAST_USED_FILTER, filter, OPTION_PRIORITY_CMDLINE); + mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver, OPTION_PRIORITY_CMDLINE); mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE); ui().save_ui_options(); } @@ -894,8 +894,8 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) driver_enumerator drv(machine().options(), *ui_swinfo->driver); media_auditor auditor(drv); drv.next(); - software_list_device *swlist = software_list_device::find_by_name(*drv.config(), ui_swinfo->listname.c_str()); - const software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); + software_list_device *swlist = software_list_device::find_by_name(*drv.config(), ui_swinfo->listname); + const software_info *swinfo = swlist->find(ui_swinfo->shortname); media_auditor::summary const summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index bb3e5dc8c00..4fd71e2798e 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -346,8 +346,8 @@ void menu_select_launch::bios_selection::handle() machine().options().set_value(OPTION_BIOS, elem.second, OPTION_PRIORITY_CMDLINE); // oh dear, relying on this persisting through the part selection menu driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); drivlist.next(); - software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname.c_str()); - const software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); + software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname); + const software_info *swinfo = swlist->find(ui_swinfo->shortname); if (!select_part(ui(), container(), *swinfo, *ui_swinfo)) { reselect_last::reselect(true); @@ -693,7 +693,7 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto else { std::string copyright(emulator_info::get_copyright()); - size_t found = copyright.find("\n"); + size_t found = copyright.find('\n'); tempbuf[0].clear(); tempbuf[1] = string_format(_("%1$s %2$s"), emulator_info::get_appname(), build_version); @@ -1305,8 +1305,8 @@ void menu_select_launch::get_title_search(std::string &snaptext, std::string &se } std::string tmp(searchstr); - path_iterator path(tmp.c_str()); - path_iterator path_iter(addpath.c_str()); + path_iterator path(tmp); + path_iterator path_iter(addpath); std::string c_path, curpath; // iterate over path and add path for zipped formats diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index 4133f238e08..3c689d19239 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -483,8 +483,8 @@ void menu_select_software::inkey_select(const event *menu_event) driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); media_auditor auditor(drivlist); drivlist.next(); - software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname.c_str()); - const software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); + software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname); + const software_info *swinfo = swlist->find(ui_swinfo->shortname); media_auditor::summary const summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp index 77df1a003cf..aa3ebac7976 100644 --- a/src/frontend/mame/ui/sliders.cpp +++ b/src/frontend/mame/ui/sliders.cpp @@ -151,7 +151,7 @@ void menu_sliders::populate(float &customtop, float &custombottom) // add UI sliders std::vector<menu_item> ui_sliders = ui().get_slider_list(); - for (menu_item item : ui_sliders) + for (const menu_item &item : ui_sliders) { if (item.type == menu_item_type::SLIDER) { @@ -180,7 +180,7 @@ void menu_sliders::populate(float &customtop, float &custombottom) // add OSD options std::vector<menu_item> osd_sliders = machine().osd().get_slider_list(); - for (menu_item item : osd_sliders) + for (const menu_item &item : osd_sliders) { if (item.type == menu_item_type::SLIDER) { diff --git a/src/frontend/mame/ui/tapectrl.cpp b/src/frontend/mame/ui/tapectrl.cpp index 0784ed72d26..1517554efd9 100644 --- a/src/frontend/mame/ui/tapectrl.cpp +++ b/src/frontend/mame/ui/tapectrl.cpp @@ -87,7 +87,7 @@ void menu_tape_control::populate(float &customtop, float &custombottom) ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? _("playing") : _("(playing)")) : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? _("recording") : _("(recording)")) ), - timepos.c_str(), + timepos, tapeflags, TAPECMD_SLIDER); diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp index 5035e989f22..f5de872c672 100644 --- a/src/lib/formats/jvc_dsk.cpp +++ b/src/lib/formats/jvc_dsk.cpp @@ -150,8 +150,8 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int switch (header_size) { - case 5: emu_fatalerror("jvc_format: sector attribute flag unsupported\n"); - break; + case 5: + throw emu_fatalerror("jvc_format: sector attribute flag unsupported\n"); case 4: base_sector_id = header[3]; // no break case 3: sector_size = 128 << header[2]; @@ -184,7 +184,7 @@ bool jvc_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) // safety check if (sector_count * sector_size > 10000) - emu_fatalerror("jvc_format: incorrect track layout\n"); + throw emu_fatalerror("jvc_format: incorrect track layout\n"); int file_offset = header_size; @@ -253,7 +253,7 @@ bool jvc_format::save(io_generic *io, floppy_image *image) for (int i = 0; i < 18; i++) { if (sectors[1 + i].size != 256) - emu_fatalerror("jvc_format: invalid sector size: %d\n", sectors[1 + i].size); + throw emu_fatalerror("jvc_format: invalid sector size: %d\n", sectors[1 + i].size); io_generic_write(io, sectors[1 + i].data, file_offset, sectors[1 + i].size); file_offset += sectors[1 + i].size; diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index 65aac4a8883..87eb779a341 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -520,7 +520,7 @@ void core_options::add_entry(const options_entry &opt, bool override_existing) { for (const std::string &name : names) { - existing_entry = get_entry(name.c_str()); + existing_entry = get_entry(name); if (existing_entry) break; } diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp index d8e90de11ff..e4414a3b907 100644 --- a/src/lib/util/zippath.cpp +++ b/src/lib/util/zippath.cpp @@ -264,7 +264,7 @@ osd_file::error zippath_resolve(const char *path, osd::directory::entry::entry_t apath = zippath_parent(apath); } } - while ((current_entry_type == osd::directory::entry::entry_type::NONE) && !is_root(apath.c_str())); + while ((current_entry_type == osd::directory::entry::entry_type::NONE) && !is_root(apath)); // if we did not find anything, then error out if (current_entry_type == osd::directory::entry::entry_type::NONE) diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp index e30f8712d2f..713e79e1ed7 100644 --- a/src/osd/modules/debugger/debuggdbstub.cpp +++ b/src/osd/modules/debugger/debuggdbstub.cpp @@ -587,7 +587,7 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop) #endif std::string socket_name = string_format("socket.localhost:%d", m_debugger_port); - osd_file::error filerr = m_socket.open(socket_name.c_str()); + osd_file::error filerr = m_socket.open(socket_name); if ( filerr != osd_file::error::NONE ) fatalerror("gdbstub: failed to start listening on port %d\n", m_debugger_port); osd_printf_info("gdbstub: listening on port %d\n", m_debugger_port); diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 487ad42ecc5..fde6882a69b 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -949,7 +949,7 @@ void debug_imgui::mount_image() case file_entry_type::DIRECTORY: { util::zippath_directory::ptr dir; - err = util::zippath_directory::open(m_selected_file->fullpath.c_str(), dir); + err = util::zippath_directory::open(m_selected_file->fullpath, dir); } if(err == osd_file::error::NONE) { @@ -958,7 +958,7 @@ void debug_imgui::mount_image() } break; case file_entry_type::FILE: - m_dialog_image->load(m_selected_file->fullpath.c_str()); + m_dialog_image->load(m_selected_file->fullpath); ImGui::CloseCurrentPopup(); break; } @@ -1106,7 +1106,7 @@ void debug_imgui::draw_mount_dialog(const char* label) { // render dialog //ImGui::SetNextWindowContentWidth(200.0f); - if(ImGui::BeginPopupModal(label,NULL,ImGuiWindowFlags_AlwaysAutoResize)) + if(ImGui::BeginPopupModal(label,nullptr,ImGuiWindowFlags_AlwaysAutoResize)) { if(m_filelist_refresh) refresh_filelist(); @@ -1157,7 +1157,7 @@ void debug_imgui::draw_create_dialog(const char* label) { // render dialog //ImGui::SetNextWindowContentWidth(200.0f); - if(ImGui::BeginPopupModal(label,NULL,ImGuiWindowFlags_AlwaysAutoResize)) + if(ImGui::BeginPopupModal(label,nullptr,ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::LabelText("##static1","Filename:"); ImGui::SameLine(); diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp index 88367c09fc9..9610cf68e78 100644 --- a/src/osd/modules/debugger/win/consolewininfo.cpp +++ b/src/osd/modules/debugger/win/consolewininfo.cpp @@ -281,7 +281,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) std::string as = slmap.find(opt_name)->second; /* Make sure a folder was specified, and that it exists */ - if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos)) + if ((!osd::directory::open(as)) || (as.find(':') == std::string::npos)) { /* Default to emu directory */ osd_get_full_path(as, "."); @@ -321,7 +321,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) buf.erase(0, t1+1); // load software - img->load_software( buf.c_str()); + img->load_software(buf); } } } @@ -351,7 +351,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) as = buf; // the only path /* Make sure a folder was specified, and that it exists */ - if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos)) + if ((!osd::directory::open(as)) || (as.find(':') == std::string::npos)) { /* Default to emu directory */ osd_get_full_path(as, "."); @@ -377,7 +377,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) if (GetOpenFileName(&ofn)) { auto utf8_buf = osd::text::from_tstring(selectedFilename); - img->load(utf8_buf.c_str()); + img->load(utf8_buf); } } } @@ -406,7 +406,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) as = buf; // the only path /* Make sure a folder was specified, and that it exists */ - if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos)) + if ((!osd::directory::open(as)) || (as.find(':') == std::string::npos)) { /* Default to emu directory */ osd_get_full_path(as, "."); @@ -432,7 +432,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) if (GetSaveFileName(&ofn)) { auto utf8_buf = osd::text::from_tstring(selectedFilename); - img->create(utf8_buf.c_str(), img->device_get_indexed_creatable_format(0), nullptr); + img->create(utf8_buf, img->device_get_indexed_creatable_format(0), nullptr); } } } @@ -598,7 +598,7 @@ bool consolewin_info::get_softlist_info(device_image_interface *img) while (sl_root && !passes_tests) { std::string test_path = sl_root + sl_dir; - if (osd::directory::open(test_path.c_str())) + if (osd::directory::open(test_path)) { passes_tests = true; slmap[opt_name] = test_path; diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp index c466e059f23..cfd9683ae9c 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp +++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp @@ -192,7 +192,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) command = string_format("bpset 0x%X", address); else command = string_format("bpclear 0x%X", bp->index()); - machine().debugger().console().execute_command(command.c_str(), true); + machine().debugger().console().execute_command(command, true); } } return true; @@ -220,7 +220,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) { std::string command; command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (uint32_t)bp->index()); - machine().debugger().console().execute_command(command.c_str(), true); + machine().debugger().console().execute_command(command, true); } } } @@ -234,7 +234,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) { std::string command; command = string_format("go 0x%X", address); - machine().debugger().console().execute_command(command.c_str(), true); + machine().debugger().console().execute_command(command, true); } else { diff --git a/src/osd/modules/debugger/win/editwininfo.cpp b/src/osd/modules/debugger/win/editwininfo.cpp index af3dd1bf66e..1b9f88c6d68 100644 --- a/src/osd/modules/debugger/win/editwininfo.cpp +++ b/src/osd/modules/debugger/win/editwininfo.cpp @@ -199,7 +199,7 @@ LRESULT editwin_info::edit_proc(UINT message, WPARAM wparam, LPARAM lparam) // process { auto utf8_buffer = osd::text::from_tstring(buffer); - process_string(utf8_buffer.c_str()); + process_string(utf8_buffer); } } break; diff --git a/src/osd/modules/file/winptty.cpp b/src/osd/modules/file/winptty.cpp index 61867a869df..7723b0a04c7 100644 --- a/src/osd/modules/file/winptty.cpp +++ b/src/osd/modules/file/winptty.cpp @@ -100,7 +100,7 @@ osd_file::error win_open_ptty(std::string const &path, std::uint32_t openflags, else { DWORD state = PIPE_NOWAIT; - SetNamedPipeHandleState(pipe, &state, NULL, NULL); + SetNamedPipeHandleState(pipe, &state, nullptr, nullptr); } try diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp index 04ccf11a7ce..82f70c17672 100644 --- a/src/osd/modules/font/font_dwrite.cpp +++ b/src/osd/modules/font/font_dwrite.cpp @@ -366,7 +366,7 @@ public: // find the font HR_RET0(find_font( - familyName.c_str(), + familyName, bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STRETCH_NORMAL, italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, diff --git a/src/osd/modules/monitor/monitor_dxgi.cpp b/src/osd/modules/monitor/monitor_dxgi.cpp index 6638f98806c..36890e36f27 100644 --- a/src/osd/modules/monitor/monitor_dxgi.cpp +++ b/src/osd/modules/monitor/monitor_dxgi.cpp @@ -164,7 +164,7 @@ protected: // if we're verbose, print the list of monitors { - for (auto monitor : list()) + for (const auto &monitor : list()) { osd_printf_verbose("Video: Monitor %I64u = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : ""); } diff --git a/src/osd/modules/monitor/monitor_win32.cpp b/src/osd/modules/monitor/monitor_win32.cpp index 6bcd6094e83..42e51595915 100644 --- a/src/osd/modules/monitor/monitor_win32.cpp +++ b/src/osd/modules/monitor/monitor_win32.cpp @@ -94,7 +94,7 @@ protected: // if we're verbose, print the list of monitors { - for (auto monitor : list()) + for (const auto &monitor : list()) { osd_printf_verbose("Video: Monitor %I64u = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : ""); } diff --git a/src/osd/modules/output/network.cpp b/src/osd/modules/output/network.cpp index e92b009670f..4fc4b382da6 100644 --- a/src/osd/modules/output/network.cpp +++ b/src/osd/modules/output/network.cpp @@ -160,7 +160,7 @@ public: void deliver_to_all(std::string msg) { - for (auto client: m_clients) + for (const auto &client: m_clients) client->deliver(msg); } diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp index 0cc97275497..d5f5e6e5c52 100644 --- a/src/osd/modules/render/bgfx/slider.cpp +++ b/src/osd/modules/render/bgfx/slider.cpp @@ -25,7 +25,7 @@ bgfx_slider::bgfx_slider(running_machine &machine, std::string name, float min, m_max = max; m_value = def; - for (std::string string : strings) + for (const std::string &string : strings) { m_strings.push_back(string); } diff --git a/src/osd/osdsync.cpp b/src/osd/osdsync.cpp index f8143aa2c51..11feb0edda4 100644 --- a/src/osd/osdsync.cpp +++ b/src/osd/osdsync.cpp @@ -447,8 +447,7 @@ void osd_work_queue_free(osd_work_queue *queue) { osd_work_item *item = (osd_work_item *)queue->free; queue->free = item->next; - if (item->event != nullptr) - delete item->event; + delete item->event; delete item; } @@ -457,8 +456,7 @@ void osd_work_queue_free(osd_work_queue *queue) { osd_work_item *item = (osd_work_item *)queue->list; queue->list = item->next; - if (item->event != nullptr) - delete item->event; + delete item->event; delete item; } diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index ca50be44639..87041eb9657 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -90,7 +90,7 @@ void windows_osd_interface::update(bool skip_redraw) if (!skip_redraw) { // profiler_mark(PROFILER_BLIT); - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) window->update(); // profiler_mark(PROFILER_END); } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 3794e79cd14..ce63d28eba6 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -204,7 +204,7 @@ bool windows_osd_interface::window_init() void windows_osd_interface::update_slider_list() { - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) { // check if any window has dirty sliders if (window->has_renderer() && window->renderer().sliders_dirty()) @@ -224,7 +224,7 @@ void windows_osd_interface::build_slider_list() { m_sliders.clear(); - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) { if (window->has_renderer()) { @@ -418,7 +418,7 @@ void winwindow_process_events_periodic(running_machine &machine) static bool is_mame_window(HWND hwnd) { - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) if (std::static_pointer_cast<win_window_info>(window)->platform_window() == hwnd) return true; @@ -582,7 +582,7 @@ void winwindow_take_snap(void) assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) { window->renderer().save(); } @@ -600,7 +600,7 @@ void winwindow_toggle_fsfx(void) assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) { window->renderer().toggle_fsfx(); } @@ -618,7 +618,7 @@ void winwindow_take_video(void) assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) { window->renderer().record(); } @@ -636,7 +636,7 @@ void winwindow_toggle_full_screen(void) assert(GetCurrentThreadId() == main_threadid); // if we are in debug mode, never go full screen - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) if (window->machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) return; @@ -644,7 +644,7 @@ void winwindow_toggle_full_screen(void) video_config.windowed = !video_config.windowed; // iterate over windows and toggle their fullscreen state - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) SendMessage(std::static_pointer_cast<win_window_info>(window)->platform_window(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); // Set the first window as foreground @@ -661,7 +661,7 @@ void winwindow_toggle_full_screen(void) bool winwindow_has_focus(void) { // see if one of the video windows has focus - for (auto window : osd_common_t::s_window_list) + for (const auto &window : osd_common_t::s_window_list) { switch (std::static_pointer_cast<win_window_info>(window)->focus()) { @@ -752,7 +752,7 @@ void win_window_info::create(running_machine &machine, int index, std::shared_pt // set main window if (window->m_index > 0) { - for (auto w : osd_common_t::s_window_list) + for (const auto &w : osd_common_t::s_window_list) { if (w->m_index == 0) { @@ -769,7 +769,7 @@ void win_window_info::create(running_machine &machine, int index, std::shared_pt // see if we are safe for fullscreen window->m_fullscreen_safe = TRUE; - for (auto win : osd_common_t::s_window_list) + for (const auto &win : osd_common_t::s_window_list) if (win->monitor() == monitor.get()) window->m_fullscreen_safe = FALSE; diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 1ce656c2a37..b922d9a77c5 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -566,7 +566,7 @@ void windows_osd_interface::init(running_machine &machine) osd_common_t::init_subsystems(); // notify listeners of screen configuration - for (auto info : osd_common_t::s_window_list) + for (const auto &info : osd_common_t::s_window_list) { machine.output().set_value(string_format("Orientation(%s)", info->monitor()->devicename()).c_str(), std::static_pointer_cast<win_window_info>(info)->m_targetorient); } |