Use util::streqlower in more places

This commit is contained in:
AJR 2022-08-27 10:47:05 -04:00
parent c26f3dd96b
commit f3f4a7a5d4
4 changed files with 8 additions and 10 deletions

View File

@ -23,7 +23,6 @@
#include "zippath.h"
#include <algorithm>
#include <cctype>
#include <cstring>
#include <regex>
#include <sstream>
@ -140,8 +139,7 @@ void device_image_interface::set_image_filename(std::string_view filename)
bool device_image_interface::is_filetype(std::string_view candidate_filetype) const
{
return std::equal(m_filetype.begin(), m_filetype.end(), candidate_filetype.begin(), candidate_filetype.end(),
[] (unsigned char c1, unsigned char c2) { return std::tolower(c1) == c2; });
return util::streqlower(m_filetype, candidate_filetype);
}

View File

@ -8,9 +8,9 @@
#include "emu.h"
#include "emuopts.h"
#include "corestr.h"
#include "zippath.h"
#include <algorithm>
#include <cctype>
device_slot_interface::device_slot_interface(const machine_config &mconfig, device_t &device) :
@ -170,6 +170,5 @@ bool get_default_card_software_hook::hashfile_extrainfo(std::string &extrainfo)
bool get_default_card_software_hook::is_filetype(std::string_view candidate_filetype) const
{
return std::equal(m_file_type.begin(), m_file_type.end(), candidate_filetype.begin(), candidate_filetype.end(),
[] (unsigned char c1, unsigned char c2) { return std::tolower(c1) == c2; });
return util::streqlower(m_file_type, candidate_filetype);
}

View File

@ -267,7 +267,7 @@ const software_info *software_list_device::find(const std::string &look_for)
{
const char *shortname = info.shortname().c_str();
return (iswild && core_strwildcmp(look_for.c_str(), shortname) == 0)
|| core_stricmp(look_for.c_str(), shortname) == 0;
|| util::streqlower(look_for, shortname);
});
return iter != info_list.end() ? &*iter : nullptr;

View File

@ -1028,9 +1028,10 @@ private:
}
}
static bool include_clones_default(std::string const &name)
static bool include_clones_default(std::string_view name)
{
return !core_stricmp(name.c_str(), "category.ini") || !core_stricmp(name.c_str(), "alltime.ini");
using namespace std::literals;
return util::streqlower(name, "category.ini"sv) || util::streqlower(name, "alltime.ini"sv);
}
unsigned m_ini, m_group;