From e8f19ee9e811e10cb0ece76b7c763ccd882f3685 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sat, 24 Sep 2016 08:56:00 -0400 Subject: [PATCH] Fixed an off by one error when identifying best entries for typeahead on the file selection and software list dialogs --- src/frontend/mame/ui/filesel.cpp | 2 +- src/frontend/mame/ui/swlist.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp index 94e09207027..187b7175cb0 100644 --- a/src/frontend/mame/ui/filesel.cpp +++ b/src/frontend/mame/ui/filesel.cpp @@ -446,7 +446,7 @@ void menu_file_selector::handle() if (cur_selected != &entry) { int match = 0; - for (int i = 0; i < m_filename.size(); i++) + for (int i = 0; i < m_filename.size() + 1; i++) { if (core_strnicmp(entry.basename.c_str(), m_filename.c_str(), i) == 0) match = i; diff --git a/src/frontend/mame/ui/swlist.cpp b/src/frontend/mame/ui/swlist.cpp index 7fbd453217e..df7bc42e2c1 100644 --- a/src/frontend/mame/ui/swlist.cpp +++ b/src/frontend/mame/ui/swlist.cpp @@ -280,7 +280,7 @@ void menu_software_list::handle() auto &compare_name = m_ordered_by_shortname ? entry.short_name : entry.long_name; int match = 0; - for (int i = 0; i < m_filename_buffer.length(); i++) + for (int i = 0; i < m_filename_buffer.size() + 1; i++) { if (core_strnicmp(compare_name.c_str(), m_filename_buffer.c_str(), i) == 0) match = i;