From 2edee0b81142bb565d646145f79cb6e70a7f1d4a Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 13 Apr 2015 12:25:00 +0200 Subject: [PATCH] updated astring constructors to have just one string param, to be more like std::string (nw) --- src/emu/audit.c | 13 ++++++++++--- src/emu/clifront.c | 2 +- src/emu/cpu/drcbex64.c | 2 +- src/emu/cpu/drcbex86.c | 2 +- src/emu/cpu/drcuml.c | 2 +- src/emu/diimage.c | 6 +++--- src/emu/emuopts.c | 2 +- src/emu/emupal.c | 2 +- src/emu/fileio.c | 12 ++++++------ src/emu/imagedev/diablo.c | 2 +- src/emu/imagedev/harddriv.c | 2 +- src/emu/machine.c | 2 +- src/emu/render.c | 2 +- src/emu/romload.c | 4 ++-- src/emu/save.h | 2 +- src/emu/softlist.c | 10 +++++----- src/emu/tilemap.c | 2 +- src/emu/ui/imgcntrl.c | 2 +- src/emu/video.c | 8 ++++---- src/emu/webengine.c | 2 +- src/lib/util/astring.h | 4 ---- src/lib/util/options.c | 2 +- src/osd/modules/debugger/win/disasmwininfo.c | 2 +- src/osd/modules/debugger/win/logwininfo.c | 2 +- src/osd/modules/debugger/win/memorywininfo.c | 2 +- src/osd/modules/render/d3d/d3dhlsl.c | 4 ++-- 26 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/emu/audit.c b/src/emu/audit.c index de03cf93a52..72bb77684d2 100644 --- a/src/emu/audit.c +++ b/src/emu/audit.c @@ -64,7 +64,7 @@ const char *driverpath = m_enumerator.config().root_device().searchpath(); for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region)) { // temporary hack: add the driver path & region name -astring combinedpath(device->searchpath(), ";", driverpath); +astring combinedpath = astring(device->searchpath()).cat(";").cat(driverpath); if (device->shortname()) combinedpath.cat(";").cat(device->shortname()); m_searchpath = combinedpath.c_str(); @@ -188,8 +188,15 @@ media_auditor::summary media_auditor::audit_software(const char *list_name, soft // store validation for later m_validation = validation; - astring combinedpath(swinfo->shortname(), ";", list_name, PATH_SEPARATOR, swinfo->shortname()); - astring locationtag(list_name, "%", swinfo->shortname(), "%"); + astring combinedpath(swinfo->shortname()); + combinedpath.cat(";"); + combinedpath.cat(list_name); + combinedpath.cat(PATH_SEPARATOR); + combinedpath.cat(swinfo->shortname()); + astring locationtag(list_name); + locationtag.cat("%"); + locationtag.cat(swinfo->shortname()); + locationtag.cat("%"); if (swinfo->parentname() != NULL) { locationtag.cat(swinfo->parentname()); diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 8f7e979eec0..b52b54b7d25 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -1686,7 +1686,7 @@ void media_identifier::identify(const char *filename) for (const osd_directory_entry *entry = osd_readdir(directory); entry != NULL; entry = osd_readdir(directory)) if (entry->type == ENTTYPE_FILE) { - astring curfile(filename, PATH_SEPARATOR, entry->name); + astring curfile = astring(filename).cat(PATH_SEPARATOR).cat(entry->name); identify(curfile.c_str()); } diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index 316577f4abd..eb51d667b5e 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -654,7 +654,7 @@ drcbe_x64::drcbe_x64(drcuml_state &drcuml, device_t &device, drc_cache &cache, U // create the log if (device.machine().options().drc_log_native()) { - astring filename("drcbex64_", device.shortname(), ".asm"); + astring filename = astring("drcbex64_").cat(device.shortname()).cat(".asm"); m_log = x86log_create_context(filename.c_str()); } } diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c index 311228db2ec..ca90329ac2d 100644 --- a/src/emu/cpu/drcbex86.c +++ b/src/emu/cpu/drcbex86.c @@ -568,7 +568,7 @@ drcbe_x86::drcbe_x86(drcuml_state &drcuml, device_t &device, drc_cache &cache, U // create the log if (device.machine().options().drc_log_native()) { - astring filename("drcbex86_", device.shortname(), ".asm"); + astring filename = astring("drcbex86_").cat(device.shortname()).cat(".asm"); m_log = x86log_create_context(filename.c_str()); } } diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index ca52ee34e3e..7537d220ae4 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -129,7 +129,7 @@ drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int // if we're to log, create the logfile if (device.machine().options().drc_log_uml()) { - astring filename("drcuml_", m_device.shortname(), ".asm"); + astring filename = astring("drcuml_").cat(m_device.shortname()).cat(".asm"); m_umllog = fopen(filename.c_str(), "w"); } } diff --git a/src/emu/diimage.c b/src/emu/diimage.c index 58a46671c4e..bb483af9d91 100644 --- a/src/emu/diimage.c +++ b/src/emu/diimage.c @@ -499,13 +499,13 @@ UINT32 device_image_interface::crc() -------------------------------------------------*/ void device_image_interface::battery_load(void *buffer, int length, int fill) { - astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext.c_str(), ".nv"); + astring fname = astring(device().machine().system().name).cat(PATH_SEPARATOR).cat(m_basename_noext.c_str()).cat(".nv"); image_battery_load_by_name(device().machine().options(), fname.c_str(), buffer, length, fill); } void device_image_interface::battery_load(void *buffer, int length, void *def_buffer) { - astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext.c_str(), ".nv"); + astring fname = astring(device().machine().system().name).cat(PATH_SEPARATOR).cat(m_basename_noext.c_str()).cat(".nv"); image_battery_load_by_name(device().machine().options(), fname.c_str(), buffer, length, def_buffer); } @@ -517,7 +517,7 @@ void device_image_interface::battery_load(void *buffer, int length, void *def_bu -------------------------------------------------*/ void device_image_interface::battery_save(const void *buffer, int length) { - astring fname(device().machine().system().name, PATH_SEPARATOR, m_basename_noext.c_str(), ".nv"); + astring fname = astring(device().machine().system().name).cat(PATH_SEPARATOR).cat(m_basename_noext.c_str()).cat(".nv"); image_battery_save_by_name(device().machine().options(), fname.c_str(), buffer, length); } diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index f4609d53a2c..e1142588300 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -549,7 +549,7 @@ const char *emu_options::main_value(astring &buffer, const char *name) const const char *emu_options::sub_value(astring &buffer, const char *name, const char *subname) const { - astring tmp(",", subname, "="); + astring tmp = astring(",").cat(subname).cat("="); buffer = value(name); int pos = buffer.find(0, tmp.c_str()); if (pos != -1) diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 617d594ff66..91cf944911e 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -408,7 +408,7 @@ void palette_device::device_start() if (share != NULL) { // find the extended (split) memory, if present - astring tag_ext(tag(), "_ext"); + astring tag_ext = astring(tag()).cat("_ext"); const memory_share *share_ext = memshare(tag_ext.c_str()); // make sure we have specified a format diff --git a/src/emu/fileio.c b/src/emu/fileio.c index 5d9514702e4..b88e191d376 100644 --- a/src/emu/fileio.c +++ b/src/emu/fileio.c @@ -281,21 +281,21 @@ file_error emu_file::open(const char *name) file_error emu_file::open(const char *name1, const char *name2) { // concatenate the strings and do a standard open - astring name(name1, name2); + astring name = astring(name1).cat(name2); return open(name.c_str()); } file_error emu_file::open(const char *name1, const char *name2, const char *name3) { // concatenate the strings and do a standard open - astring name(name1, name2, name3); + astring name = astring(name1).cat(name2).cat(name3); return open(name.c_str()); } file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4) { // concatenate the strings and do a standard open - astring name(name1, name2, name3, name4); + astring name = astring(name1).cat(name2).cat(name3).cat(name4); return open(name.c_str()); } @@ -314,21 +314,21 @@ file_error emu_file::open(const char *name, UINT32 crc) file_error emu_file::open(const char *name1, const char *name2, UINT32 crc) { // concatenate the strings and do a standard open - astring name(name1, name2); + astring name = astring(name1).cat(name2); return open(name.c_str(), crc); } file_error emu_file::open(const char *name1, const char *name2, const char *name3, UINT32 crc) { // concatenate the strings and do a standard open - astring name(name1, name2, name3); + astring name = astring(name1).cat(name2).cat(name3); return open(name.c_str(), crc); } file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc) { // concatenate the strings and do a standard open - astring name(name1, name2, name3, name4); + astring name = astring(name1).cat(name2).cat(name3).cat(name4); return open(name.c_str(), crc); } diff --git a/src/emu/imagedev/diablo.c b/src/emu/imagedev/diablo.c index 66731719920..1f4af5b3242 100644 --- a/src/emu/imagedev/diablo.c +++ b/src/emu/imagedev/diablo.c @@ -170,7 +170,7 @@ void diablo_image_device::call_unload() static chd_error open_disk_diff(emu_options &options, const char *name, chd_file &source, chd_file &diff_chd) { - astring fname(name, ".dif"); + astring fname = astring(name).cat(".dif"); /* try to open the diff */ //printf("Opening differencing image file: %s\n", fname.c_str()); diff --git a/src/emu/imagedev/harddriv.c b/src/emu/imagedev/harddriv.c index 780317e9193..a34658600e7 100644 --- a/src/emu/imagedev/harddriv.c +++ b/src/emu/imagedev/harddriv.c @@ -176,7 +176,7 @@ void harddisk_image_device::call_unload() static chd_error open_disk_diff(emu_options &options, const char *name, chd_file &source, chd_file &diff_chd) { - astring fname(name, ".dif"); + astring fname = astring(name).cat(".dif"); /* try to open the diff */ //printf("Opening differencing image file: %s\n", fname.c_str()); diff --git a/src/emu/machine.c b/src/emu/machine.c index 229a507f3ac..e85f39d03cd 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -206,7 +206,7 @@ TIMER_CALLBACK_MEMBER(running_machine::autoboot_callback) else if (strlen(options().autoboot_command())!=0) { astring cmd = astring(options().autoboot_command()); cmd.replace("'","\\'"); - astring val = astring("emu.keypost('", cmd.c_str(), "')").c_str(); + astring val = astring("emu.keypost('").cat(cmd.c_str()).cat("')").c_str(); manager().lua()->load_string(val.c_str()); } } diff --git a/src/emu/render.c b/src/emu/render.c index b7da5fcbb38..a510a6fd7b8 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -1571,7 +1571,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) else { // build the path and optionally prepend the directory - astring fname(filename, ".lay"); + astring fname = astring(filename).cat(".lay"); if (dirname != NULL) fname.ins(0, PATH_SEPARATOR).ins(0, dirname); diff --git a/src/emu/romload.c b/src/emu/romload.c index 4ccc05da1fb..fa99559ca9a 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -1179,7 +1179,7 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_ static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd_file &source, chd_file &diff_chd) { - astring fname(ROM_GETNAME(romp), ".dif"); + astring fname = astring(ROM_GETNAME(romp)).cat(".dif"); /* try to open the diff */ LOG(("Opening differencing image file: %s\n", fname.c_str())); @@ -1236,7 +1236,7 @@ static void process_disk_entries(romload_private *romdata, const char *regiontag chd_error err; /* make the filename of the source */ - astring filename(ROM_GETNAME(romp), ".chd"); + astring filename = astring(ROM_GETNAME(romp)).cat(".chd"); /* first open the source drive */ LOG(("Opening disk image: %s\n", filename.c_str())); diff --git a/src/emu/save.h b/src/emu/save.h index a4d6e041e08..4b026ed9ad2 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -267,7 +267,7 @@ inline void save_manager::save_item(device_t *device, const char *module, const template<> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, attotime &value, const char *name) { - astring tempstr(name, ".attoseconds"); + astring tempstr = astring(name).cat(".attoseconds"); save_memory(device, module, tag, index, tempstr.c_str(), &value.attoseconds, sizeof(value.attoseconds)); tempstr.cpy(name).cat(".seconds"); save_memory(device, module, tag, index, tempstr.c_str(), &value.seconds, sizeof(value.seconds)); diff --git a/src/emu/softlist.c b/src/emu/softlist.c index fd70d3dd12d..d2ac76aceb9 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -149,8 +149,8 @@ bool software_part::is_compatible(const software_list_device &swlistdev) const return true; // copy the comma-delimited strings and ensure they end with a final comma - astring comp(compatibility, ","); - astring filt(filter, ","); + astring comp = astring(compatibility).cat(","); + astring filt = astring(filter).cat(","); // iterate over filter items and see if they exist in the compatibility list; if so, return true for (int start = 0, end = filt.chr(start, ','); end != -1; start = end + 1, end = filt.chr(start, ',')) @@ -175,10 +175,10 @@ bool software_part::matches_interface(const char *interface_list) const return true; // copy the comma-delimited interface list and ensure it ends with a final comma - astring interfaces(interface_list, ","); + astring interfaces = astring(interface_list).cat(","); // then add a comma to the end of our interface and return true if we find it in the list string - astring our_interface(m_interface, ","); + astring our_interface = astring(m_interface).cat(","); return (interfaces.find(0, our_interface.c_str()) != -1); } @@ -500,7 +500,7 @@ void software_list_device::device_validity_check(validity_checker &valid) const { // add to the global map whenever we check a list so we don't re-check // it in the future - if (valid.already_checked(astring("softlist/", m_list_name.c_str()).c_str())) + if (valid.already_checked(astring("softlist/").cat(m_list_name.c_str()).c_str())) return; // do device validation only in case of validate command diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index eaae73d871f..4492dd23d95 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -1785,7 +1785,7 @@ void tilemap_device::device_start() m_basemem.set(*share, m_bytes_per_entry); // look for an extension entry - astring tag_ext(tag(), "_ext"); + astring tag_ext = astring(tag()).cat("_ext"); share = memshare(tag_ext.c_str()); if (share != NULL) m_extmem.set(*share, m_bytes_per_entry); diff --git a/src/emu/ui/imgcntrl.c b/src/emu/ui/imgcntrl.c index fa3ebff3136..bb1d54f0220 100644 --- a/src/emu/ui/imgcntrl.c +++ b/src/emu/ui/imgcntrl.c @@ -132,7 +132,7 @@ void ui_menu_control_device_image::test_create(bool &can_create, bool &need_conf void ui_menu_control_device_image::load_software_part() { - astring temp_name(sld->list_name(), ":", swi->shortname(), ":", swp->name()); + astring temp_name = astring(sld->list_name()).cat(":").cat(swi->shortname()).cat(":").cat(swp->name()); driver_enumerator drivlist(machine().options(), machine().options().system_name()); media_auditor auditor(drivlist); diff --git a/src/emu/video.c b/src/emu/video.c index c922fe79b9d..caa0138455f 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -308,8 +308,8 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) create_snapshot_bitmap(screen); // add two text entries describing the image - astring text1(emulator_info::get_appname(), " ", build_version); - astring text2(machine().system().manufacturer, " ", machine().system().description); + astring text1 = astring(emulator_info::get_appname()).cat(" ").cat(build_version); + astring text2 = astring(machine().system().manufacturer).cat(" ").cat(machine().system().description); png_info pnginfo = { 0 }; png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); @@ -1278,8 +1278,8 @@ void video_manager::record_frame() png_info pnginfo = { 0 }; if (m_mng_frame == 0) { - astring text1(emulator_info::get_appname(), " ", build_version); - astring text2(machine().system().manufacturer, " ", machine().system().description); + astring text1 = astring(emulator_info::get_appname()).cat(" ").cat(build_version); + astring text2 = astring(machine().system().manufacturer).cat(" ").cat(machine().system().description); png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); } diff --git a/src/emu/webengine.c b/src/emu/webengine.c index 78be772a731..70c6e50f43b 100644 --- a/src/emu/webengine.c +++ b/src/emu/webengine.c @@ -260,7 +260,7 @@ static int filename_endswith(const char *str, const char *suffix) // This function will be called by mongoose on every new request. int web_engine::begin_request_handler(struct mg_connection *conn) { - astring file_path(mg_get_option(m_server, "document_root"), PATH_SEPARATOR, conn->uri); + astring file_path = astring(mg_get_option(m_server, "document_root")).cat(PATH_SEPARATOR).cat(conn->uri); if (filename_endswith(file_path.c_str(), ".lp")) { FILE *fp = NULL; diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h index 0858896184a..089ee585dae 100644 --- a/src/lib/util/astring.h +++ b/src/lib/util/astring.h @@ -34,10 +34,6 @@ public: // construction with copy astring(const char *string) { init(); if(string) cpy(string); } astring(const char *string, int length) { init().cpy(string, length); } - astring(const char *str1, const char *str2) { init().cpy(str1).cat(str2); } - astring(const char *str1, const char *str2, const char *str3) { init().cpy(str1).cat(str2).cat(str3); } - astring(const char *str1, const char *str2, const char *str3, const char *str4) { init().cpy(str1).cat(str2).cat(str3).cat(str4); } - astring(const char *str1, const char *str2, const char *str3, const char *str4, const char *str5) { init().cpy(str1).cat(str2).cat(str3).cat(str4).cat(str5); } astring(const astring &string) { init().cpy(string); } astring(const astring &string, int start, int count = -1) { init().cpysubstr(string, start, count); } diff --git a/src/lib/util/options.c b/src/lib/util/options.c index d1d69db2e82..f5beddf1d71 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -687,7 +687,7 @@ void core_options::append_entry(core_options::entry &newentry) // for boolean options add a "no" variant as well if (newentry.type() == OPTION_BOOLEAN) - m_entrymap.add(astring("no", newentry.name(name)).c_str(), &newentry); + m_entrymap.add(astring("no").cat(newentry.name(name)).c_str(), &newentry); } } diff --git a/src/osd/modules/debugger/win/disasmwininfo.c b/src/osd/modules/debugger/win/disasmwininfo.c index 59e97d6e0c1..7b9097a1e67 100644 --- a/src/osd/modules/debugger/win/disasmwininfo.c +++ b/src/osd/modules/debugger/win/disasmwininfo.c @@ -145,5 +145,5 @@ void disasmwin_info::process_string(char const *string) void disasmwin_info::update_caption() { - win_set_window_text_utf8(window(), astring("Disassembly: ", m_views[0]->source_name()).c_str()); + win_set_window_text_utf8(window(), astring("Disassembly: ").cat(m_views[0]->source_name()).c_str()); } diff --git a/src/osd/modules/debugger/win/logwininfo.c b/src/osd/modules/debugger/win/logwininfo.c index 5f8b28b9217..6621048ac48 100644 --- a/src/osd/modules/debugger/win/logwininfo.c +++ b/src/osd/modules/debugger/win/logwininfo.c @@ -12,7 +12,7 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : - debugwin_info(debugger, false, astring("Errorlog: ", debugger.machine().system().description, " [", debugger.machine().system().name, "]").c_str(), NULL) + debugwin_info(debugger, false, astring("Errorlog: ").cat(debugger.machine().system().description).cat(" [").cat(debugger.machine().system().name).cat("]").c_str(), NULL) { if (!window()) return; diff --git a/src/osd/modules/debugger/win/memorywininfo.c b/src/osd/modules/debugger/win/memorywininfo.c index 3e91168cb11..1610e2b6002 100644 --- a/src/osd/modules/debugger/win/memorywininfo.c +++ b/src/osd/modules/debugger/win/memorywininfo.c @@ -275,5 +275,5 @@ void memorywin_info::process_string(char const *string) void memorywin_info::update_caption() { - win_set_window_text_utf8(window(), astring("Memory: ", m_views[0]->source_name()).c_str()); + win_set_window_text_utf8(window(), astring("Memory: ").cat(m_views[0]->source_name()).c_str()); } diff --git a/src/osd/modules/render/d3d/d3dhlsl.c b/src/osd/modules/render/d3d/d3dhlsl.c index cc2267636a9..b76c3365528 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.c +++ b/src/osd/modules/render/d3d/d3dhlsl.c @@ -370,8 +370,8 @@ void shaders::render_snapshot(surface *surface) return; // add two text entries describing the image - astring text1(emulator_info::get_appname(), " ", build_version); - astring text2(machine->system().manufacturer, " ", machine->system().description); + astring text1 = astring(emulator_info::get_appname()).cat(" ").cat(build_version); + astring text2 = astring(machine->system().manufacturer).cat(" ").cat(machine->system().description); png_info pnginfo = { 0 }; png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str());