diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 38ae2eeb7..7852cc796 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -221,10 +221,8 @@ void Settings::loadConfig() continue; // Split the line into key/value pairs and trim any whitespace - key = line.substr(0, equalPos); - value = line.substr(equalPos + 1, line.length() - key.length() - 1); - key = trim(key); - value = trim(value); + key = trim(line.substr(0, equalPos)); + value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1)); // Skip absent key if(key.length() == 0) diff --git a/src/emucore/Settings.hxx b/src/emucore/Settings.hxx index 610defc83..ee83e55a0 100644 --- a/src/emucore/Settings.hxx +++ b/src/emucore/Settings.hxx @@ -98,7 +98,7 @@ class Settings virtual void saveConfig(); // Trim leading and following whitespace from a string - static string trim(string& str) + static string trim(const string& str) { string::size_type first = str.find_first_not_of(' '); return (first == string::npos) ? EmptyString :