From 1d508951c746a32a15d519afc9fe6635564aa4ec Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Thu, 30 Jun 2016 09:58:23 -0400 Subject: [PATCH] Changing menu_file_selector::append_entry() to return a reference instead of a pointer --- src/frontend/mame/ui/filesel.cpp | 10 +++++----- src/frontend/mame/ui/filesel.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp index d25abdb4d50..deaef81c3d0 100644 --- a/src/frontend/mame/ui/filesel.cpp +++ b/src/frontend/mame/ui/filesel.cpp @@ -419,7 +419,7 @@ int menu_file_selector::compare_entries(const file_selector_entry *e1, const fil // file selector entry to an entry list //------------------------------------------------- -menu_file_selector::file_selector_entry *menu_file_selector::append_entry( +menu_file_selector::file_selector_entry &menu_file_selector::append_entry( file_selector_entry_type entry_type, const std::string &entry_basename, const std::string &entry_fullpath) { return append_entry(entry_type, std::string(entry_basename), std::string(entry_fullpath)); @@ -431,7 +431,7 @@ menu_file_selector::file_selector_entry *menu_file_selector::append_entry( // file selector entry to an entry list //------------------------------------------------- -menu_file_selector::file_selector_entry *menu_file_selector::append_entry( +menu_file_selector::file_selector_entry &menu_file_selector::append_entry( file_selector_entry_type entry_type, std::string &&entry_basename, std::string &&entry_fullpath) { // allocate a new entry @@ -442,7 +442,7 @@ menu_file_selector::file_selector_entry *menu_file_selector::append_entry( // find the end of the list m_entrylist.emplace_back(std::move(entry)); - return &m_entrylist[m_entrylist.size() - 1]; + return m_entrylist[m_entrylist.size() - 1]; } @@ -476,7 +476,7 @@ menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry util::zippath_combine(buffer, m_current_directory.c_str(), dirent->name); // create the file selector entry - entry = append_entry( + entry = &append_entry( entry_type, dirent->name, std::move(buffer)); @@ -564,7 +564,7 @@ void menu_file_selector::populate() if (m_has_softlist) { // add the "[software list]" entry - entry = append_entry(SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, "", ""); + entry = &append_entry(SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, "", ""); selected_entry = entry; } diff --git a/src/frontend/mame/ui/filesel.h b/src/frontend/mame/ui/filesel.h index 1fd1fa45624..2960c6a6b5b 100644 --- a/src/frontend/mame/ui/filesel.h +++ b/src/frontend/mame/ui/filesel.h @@ -103,8 +103,8 @@ private: // methods int compare_entries(const file_selector_entry *e1, const file_selector_entry *e2); - file_selector_entry *append_entry(file_selector_entry_type entry_type, const std::string &entry_basename, const std::string &entry_fullpath); - file_selector_entry *append_entry(file_selector_entry_type entry_type, std::string &&entry_basename, std::string &&entry_fullpath); + file_selector_entry &append_entry(file_selector_entry_type entry_type, const std::string &entry_basename, const std::string &entry_fullpath); + file_selector_entry &append_entry(file_selector_entry_type entry_type, std::string &&entry_basename, std::string &&entry_fullpath); file_selector_entry *append_dirent_entry(const osd::directory::entry *dirent); void append_entry_menu_item(const file_selector_entry *entry); };