summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/audit.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-01-20 17:46:03 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-01-20 18:06:15 -0500
commit91921618c2e06bd0ed073b8efccd31a127c9012d (patch)
treed3958b32d8db82540cd31083766b22991eb8e8ae /src/frontend/mame/audit.cpp
parentc691b79cce315acdfabe1901cb2b5a1e39957bc1 (diff)
Much more core std::string_view modernization
- Remove corestr.h from emu.h; update a few source files to not use it at all - Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type - Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string - Remove the string-modifying version of zippath_parent - Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char * - Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only - Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this) - Change output_manager to use std::string_view for output name arguments - Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now) - Change miscellaneous other functions to accept std::string_view arguments - Remove a few string accessor macros from romload.h - Remove many unnecessary c_str() calls from logging/error messages
Diffstat (limited to 'src/frontend/mame/audit.cpp')
-rw-r--r--src/frontend/mame/audit.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp
index ce8e1368992..42ddcdad438 100644
--- a/src/frontend/mame/audit.cpp
+++ b/src/frontend/mame/audit.cpp
@@ -31,7 +31,7 @@ namespace {
struct parent_rom
{
- parent_rom(device_type t, rom_entry const *r) : type(t), name(ROM_GETNAME(r)), hashes(ROM_GETHASHDATA(r)), length(rom_file_size(r)) { }
+ parent_rom(device_type t, rom_entry const *r) : type(t), name(r->name()), hashes(r->hashdata()), length(rom_file_size(r)) { }
std::reference_wrapper<std::remove_reference_t<device_type> > type;
std::string name;
@@ -74,7 +74,7 @@ public:
}
}
- std::add_pointer_t<device_type> find_shared_device(device_t &current, char const *name, util::hash_collection const &hashes, uint64_t length) const
+ std::add_pointer_t<device_type> find_shared_device(device_t &current, std::string_view name, util::hash_collection const &hashes, uint64_t length) const
{
// if we're examining a child device, it will always have a perfect match
if (current.owner())
@@ -120,7 +120,7 @@ public:
{
if (rom_file_size(rom) == record.actual_length())
{
- util::hash_collection const hashes(ROM_GETHASHDATA(rom));
+ util::hash_collection const hashes(rom->hashdata());
if (hashes == record.actual_hashes())
return std::make_pair(&current.type(), empty());
else if (hashes.flag(util::hash_collection::FLAG_NO_DUMP) && (rom->name() == record.name()))
@@ -228,8 +228,8 @@ media_auditor::summary media_auditor::audit_media(const char *validation)
}
// look for a matching parent or device ROM
- char const *const name(ROM_GETNAME(rom));
- util::hash_collection const hashes(ROM_GETHASHDATA(rom));
+ std::string const &name(rom->name());
+ util::hash_collection const hashes(rom->hashdata());
bool const dumped(!hashes.flag(util::hash_collection::FLAG_NO_DUMP));
std::add_pointer_t<device_type> const shared_device(parentroms.find_shared_device(device, name, hashes, rom_file_size(rom)));
if (shared_device)
@@ -557,7 +557,7 @@ void media_auditor::audit_regions(T do_audit, const rom_entry *region, std::size
for (rom_entry const *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
// count the number of files with hashes
- util::hash_collection const hashes(ROM_GETHASHDATA(rom));
+ util::hash_collection const hashes(rom->hashdata());
if (!hashes.flag(util::hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom))
required++;
@@ -679,14 +679,13 @@ media_auditor::audit_record::audit_record(const rom_entry &media, media_type typ
: m_type(type)
, m_status(audit_status::UNVERIFIED)
, m_substatus(audit_substatus::UNVERIFIED)
- , m_name(ROM_GETNAME(&media))
+ , m_name(media.name())
, m_explength(rom_file_size(&media))
, m_length(0)
- , m_exphashes()
+ , m_exphashes(media.hashdata())
, m_hashes()
, m_shared_device(nullptr)
{
- m_exphashes.from_internal_string(ROM_GETHASHDATA(&media));
}
media_auditor::audit_record::audit_record(const char *name, media_type type)