From db411324a6c538ae06698d9bbf7eeab9f04a7c61 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Mon, 14 Jun 2021 23:17:58 +0200 Subject: [PATCH] Cleanup: remove some unneeded c_str() calls --- src/game/game_text.cpp | 2 +- src/script/script_scanner.cpp | 2 +- src/settings.cpp | 6 +++--- src/vehicle_cmd.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 74e8d63bd86f..ca102f912038 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -231,7 +231,7 @@ GameStrings *LoadTranslations() basename.erase(e + 1); std::string filename = basename + "lang" PATHSEP "english.txt"; - if (!FioCheckFileExists(filename.c_str() , GAME_DIR)) return nullptr; + if (!FioCheckFileExists(filename, GAME_DIR)) return nullptr; auto ls = ReadRawLanguageStrings(filename); if (!ls.IsValid()) return nullptr; diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index dc14da1db317..319a1c7fc008 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -182,7 +182,7 @@ struct ScriptFileChecksumCreator : FileScanner { byte tmp_md5sum[16]; /* Open the file ... */ - FILE *f = FioFOpenFile(filename.c_str(), "rb", this->dir, &size); + FILE *f = FioFOpenFile(filename, "rb", this->dir, &size); if (f == nullptr) return false; /* ... calculate md5sum... */ diff --git a/src/settings.cpp b/src/settings.cpp index 23f43d24f209..54189a0fce8d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -708,7 +708,7 @@ static void IniSaveSettingList(IniFile *ini, const char *grpname, StringList &li group->Clear(); for (const auto &iter : list) { - group->GetItem(iter.c_str(), true)->SetValue(""); + group->GetItem(iter, true)->SetValue(""); } } @@ -1272,7 +1272,7 @@ static void AILoadConfig(IniFile *ini, const char *grpname) continue; } } - if (item->value.has_value()) config->StringToSettings(item->value->c_str()); + if (item->value.has_value()) config->StringToSettings(*item->value); } } @@ -1299,7 +1299,7 @@ static void GameLoadConfig(IniFile *ini, const char *grpname) return; } } - if (item->value.has_value()) config->StringToSettings(item->value->c_str()); + if (item->value.has_value()) config->StringToSettings(*item->value); } /** diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 84d339b279fb..499b3b3ebd5a 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -804,7 +804,7 @@ static void CloneVehicleName(const Vehicle *src, Vehicle *dst) /* Check the name is unique. */ auto new_name = oss.str(); - if (IsUniqueVehicleName(new_name.c_str())) { + if (IsUniqueVehicleName(new_name)) { dst->name = new_name; break; }