Changed various string arguments for emu_file::open() from 'const char *' to std::string

This commit is contained in:
Nathan Woods 2016-07-29 20:53:46 -04:00
parent 037465d109
commit a7bfc73cfb
4 changed files with 28 additions and 34 deletions

View File

@ -550,7 +550,7 @@ void device_image_interface::battery_load(void *buffer, int length, int fill)
/* try to open the battery file and read it in, if possible */
emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ);
filerr = file.open(fname.c_str());
filerr = file.open(fname);
if (filerr == osd_file::error::NONE)
bytes_read = file.read(buffer, length);
@ -568,7 +568,7 @@ void device_image_interface::battery_load(void *buffer, int length, void *def_bu
// try to open the battery file and read it in, if possible
emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ);
filerr = file.open(fname.c_str());
filerr = file.open(fname);
if (filerr == osd_file::error::NONE)
bytes_read = file.read(buffer, length);
@ -592,7 +592,7 @@ void device_image_interface::battery_save(const void *buffer, int length)
// 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);
osd_file::error filerr = file.open(fname.c_str());
osd_file::error filerr = file.open(fname);
if (filerr == osd_file::error::NONE)
file.write(buffer, length);
}

View File

@ -110,7 +110,7 @@ const osd::directory::entry *file_enumerator::next()
return nullptr;
// open the path
m_curdir = osd::directory::open(m_pathbuffer.c_str());
m_curdir = osd::directory::open(m_pathbuffer);
}
// get the next entry from the current directory
@ -240,7 +240,7 @@ util::hash_collection &emu_file::hashes(const char *types)
// open - open a file by searching paths
//-------------------------------------------------
osd_file::error emu_file::open(const char *name)
osd_file::error emu_file::open(const std::string &name)
{
// remember the filename and CRC info
m_filename = name;
@ -252,28 +252,25 @@ osd_file::error emu_file::open(const char *name)
return open_next();
}
osd_file::error emu_file::open(const char *name1, const char *name2)
osd_file::error emu_file::open(const std::string &name1, const std::string &name2)
{
// concatenate the strings and do a standard open
std::string name = std::string(name1).append(name2);
return open(name.c_str());
return open(name1 + name2);
}
osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3)
osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3)
{
// concatenate the strings and do a standard open
std::string name = std::string(name1).append(name2).append(name3);
return open(name.c_str());
return open(name1 + name2 + name3);
}
osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4)
osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4)
{
// concatenate the strings and do a standard open
std::string name = std::string(name1).append(name2).append(name3).append(name4);
return open(name.c_str());
return open(name1 + name2 + name3 + name4);
}
osd_file::error emu_file::open(const char *name, UINT32 crc)
osd_file::error emu_file::open(const std::string &name, UINT32 crc)
{
// remember the filename and CRC info
m_filename = name;
@ -285,25 +282,22 @@ osd_file::error emu_file::open(const char *name, UINT32 crc)
return open_next();
}
osd_file::error emu_file::open(const char *name1, const char *name2, UINT32 crc)
osd_file::error emu_file::open(const std::string &name1, const std::string &name2, UINT32 crc)
{
// concatenate the strings and do a standard open
std::string name = std::string(name1).append(name2);
return open(name.c_str(), crc);
return open(name1 + name2, crc);
}
osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3, UINT32 crc)
osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, UINT32 crc)
{
// concatenate the strings and do a standard open
std::string name = std::string(name1).append(name2).append(name3);
return open(name.c_str(), crc);
return open(name1 + name2 + name3, crc);
}
osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc)
osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, UINT32 crc)
{
// concatenate the strings and do a standard open
std::string name = std::string(name1).append(name2).append(name3).append(name4);
return open(name.c_str(), crc);
return open(name1 + name2 + name3 + name4, crc);
}

View File

@ -101,14 +101,14 @@ public:
void set_restrict_to_mediapath(bool rtmp = true) { m_restrict_to_mediapath = rtmp; }
// open/close
osd_file::error open(const char *name);
osd_file::error open(const char *name1, const char *name2);
osd_file::error open(const char *name1, const char *name2, const char *name3);
osd_file::error open(const char *name1, const char *name2, const char *name3, const char *name4);
osd_file::error open(const char *name, UINT32 crc);
osd_file::error open(const char *name1, const char *name2, UINT32 crc);
osd_file::error open(const char *name1, const char *name2, const char *name3, UINT32 crc);
osd_file::error open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc);
osd_file::error open(const std::string &name);
osd_file::error open(const std::string &name1, const std::string &name2);
osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3);
osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4);
osd_file::error open(const std::string &name, UINT32 crc);
osd_file::error open(const std::string &name1, const std::string &name2, UINT32 crc);
osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, UINT32 crc);
osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, UINT32 crc);
osd_file::error open_next();
osd_file::error open_ram(const void *data, UINT32 length);
void close();

View File

@ -1113,7 +1113,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());
@ -1126,7 +1126,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());