InputConfig::LoadConfig(): Convert num[] to an array of std::string_view.

NOTE: The explicit std::string() conversions later are needed. Otherwise,
gcc-9.2.0 throws all sorts of errors because it can't find a matching
operator+() function.
This commit is contained in:
David Korth 2019-09-24 00:32:43 -04:00
parent a23b3d26f4
commit 6e549bb668
1 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ bool InputConfig::LoadConfig(bool isGC)
{ {
IniFile inifile; IniFile inifile;
bool useProfile[MAX_BBMOTES] = {false, false, false, false, false}; bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
std::string num[MAX_BBMOTES] = {"1", "2", "3", "4", "BB"}; static constexpr std::array<std::string_view, MAX_BBMOTES> num = {"1", "2", "3", "4", "BB"};
std::string profile[MAX_BBMOTES]; std::string profile[MAX_BBMOTES];
std::string path; std::string path;
@ -58,10 +58,10 @@ bool InputConfig::LoadConfig(bool isGC)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
if (control_section->Exists(type + "Profile" + num[i])) if (control_section->Exists(type + "Profile" + std::string(num[i])))
{ {
std::string profile_setting; std::string profile_setting;
if (control_section->Get(type + "Profile" + num[i], &profile_setting)) if (control_section->Get(type + "Profile" + std::string(num[i]), &profile_setting))
{ {
auto profiles = InputProfile::GetProfilesFromSetting( auto profiles = InputProfile::GetProfilesFromSetting(
profile_setting, File::GetUserPath(D_CONFIG_IDX) + path); profile_setting, File::GetUserPath(D_CONFIG_IDX) + path);