From e22568da38d339d2a1a11546cc3a791325f0c38e Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 20 Jan 2019 01:44:08 +1100 Subject: one shouldn't assume page zero looks like a std::string (nw) --- src/emu/softlist_dev.cpp | 6 +++--- 1 file 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 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; -- cgit v1.2.3