diff --git a/src/common/StellaKeys.hxx b/src/common/StellaKeys.hxx index 2fa84f151..0fb113951 100644 --- a/src/common/StellaKeys.hxx +++ b/src/common/StellaKeys.hxx @@ -439,12 +439,12 @@ namespace StellaModTest namespace StellaKeyName { - inline const char* forKey(StellaKey key) + inline string_view forKey(StellaKey key) { #ifdef SDL_SUPPORT return SDL_GetScancodeName(SDL_Scancode(key)); #else - return ""; + return string_view{}; #endif } } diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index d876116a2..3186886a4 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -1513,7 +1513,7 @@ string CartDebug::clearConfig(int bank) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartDebug::getCompletions(const char* in, StringList& completions) const +void CartDebug::getCompletions(string_view in, StringList& completions) const { // First scan system equates for(uInt16 addr = 0x00; addr <= 0x0F; ++addr) @@ -1532,7 +1532,7 @@ void CartDebug::getCompletions(const char* in, StringList& completions) const // Now scan user-defined labels for(const auto& iter: myUserAddresses) { - const char* const l = iter.first.c_str(); + const string_view l = iter.first; if(BSPF::matchesCamelCase(l, in)) completions.emplace_back(l); } diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index c4c3e06c8..95b100970 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -260,7 +260,7 @@ class CartDebug : public DebuggerSystem Methods used by the command parser for tab-completion In this case, return completions from the equate list(s) */ - void getCompletions(const char* in, StringList& completions) const; + void getCompletions(string_view in, StringList& completions) const; // Convert given address to corresponding access type and append to buf void accessTypeAsString(ostream& buf, uInt16 addr) const; diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 58daa0390..4e5b6b5c9 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -892,14 +892,14 @@ string Debugger::builtinHelp() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::getCompletions(const char* in, StringList& list) const +void Debugger::getCompletions(string_view in, StringList& list) const { // skip if filter equals "_" only if(!BSPF::equalsIgnoreCase(in, "_")) { - for(const auto& iter : myFunctions) + for(const auto& iter: myFunctions) { - const char* const l = iter.first.c_str(); + const string_view l = iter.first; if(BSPF::matchesCamelCase(l, in)) list.emplace_back(l); } diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 48cd70d8f..772ad708d 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -123,7 +123,7 @@ class Debugger : public DialogContainer Methods used by the command parser for tab-completion In this case, return completions from the function list */ - void getCompletions(const char* in, StringList& list) const; + void getCompletions(string_view in, StringList& list) const; /** The dialog/GUI associated with the debugger diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 15b3a7ed1..81f9226ff 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -175,7 +175,7 @@ void DebuggerParser::outputCommandError(string_view errorMsg, int command) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Completion-related stuff: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void DebuggerParser::getCompletions(const char* in, StringList& completions) +void DebuggerParser::getCompletions(string_view in, StringList& completions) { // cerr << "Attempting to complete \"" << in << "\"" << endl; for(const auto& c: commands) diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 2fb3fadd0..848b36df4 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -42,7 +42,7 @@ class DebuggerParser /** Given a substring, determine matching substrings from the list of available commands. Used in the debugger prompt for tab-completion */ - static void getCompletions(const char* in, StringList& completions); + static void getCompletions(string_view in, StringList& completions); /** Evaluate the given expression using operators, current base, etc */ int decipher_arg(string_view str); diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index 39aa9c7da..9af9c22d7 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -367,7 +367,7 @@ bool FileListWidget::handleText(char text) const bool firstShift = StellaModTest::isShift(_firstMod); if(StellaModTest::isShift(_lastMod)) - text = *StellaKeyName::forKey(_lastKey); + text = StellaKeyName::forKey(_lastKey)[0]; if(_quickSelectTime < time) _quickSelectStr = text;