summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/softlist_dev.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-01-20 01:44:08 +1100
committer Vas Crabb <vas@vastheman.com>2019-01-20 01:44:08 +1100
commite22568da38d339d2a1a11546cc3a791325f0c38e (patch)
treeef1ba92e6691bec2774d98d1839e401297193400 /src/emu/softlist_dev.cpp
parent57d9f16115db189930e973dc5b01891272e1ada3 (diff)
one shouldn't assume page zero looks like a std::string (nw)
Diffstat (limited to 'src/emu/softlist_dev.cpp')
-rw-r--r--src/emu/softlist_dev.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp
index b96fd63b3fa..831fc3f6734 100644
--- a/src/emu/softlist_dev.cpp
+++ b/src/emu/softlist_dev.cpp
@@ -116,7 +116,7 @@ void software_list_device::find_approx_matches(const std::string &name, int matc
std::vector<double> penalty(matches);
for (int matchnum = 0; matchnum < matches; matchnum++)
{
- penalty[matchnum] = 1.0;
+ penalty[matchnum] = 2.0;
list[matchnum] = nullptr;
}
@@ -131,11 +131,11 @@ void software_list_device::find_approx_matches(const std::string &name, int matc
// pick the best match between driver name and description
double const longpenalty = util::edit_distance(search, ustr_from_utf8(normalize_unicode(swinfo.longname(), unicode_normalization_form::D, true)));
double const shortpenalty = util::edit_distance(search, ustr_from_utf8(normalize_unicode(swinfo.shortname(), unicode_normalization_form::D, true)));
- double const curpenalty = std::min(longpenalty, shortpenalty);
+ double const curpenalty = (std::min)(longpenalty, shortpenalty);
// make sure it isn't already in the table
bool skip = false;
- for (int matchnum = 0; matchnum < matches; matchnum++)
+ for (int matchnum = 0; !skip && (matchnum < matches) && list[matchnum]; matchnum++)
{
if ((penalty[matchnum] == curpenalty) && (swinfo.longname() == list[matchnum]->longname()) && (swinfo.shortname() == list[matchnum]->shortname()))
skip = true;