Skip to content

Commit

Permalink
Cleanup: remove some unneeded c_str() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
rubidium42 committed Jun 14, 2021
1 parent eb0e320 commit db41132
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/game/game_text.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/script/script_scanner.cpp
Expand Up @@ -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... */
Expand Down
6 changes: 3 additions & 3 deletions src/settings.cpp
Expand Up @@ -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("");
}
}

Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/vehicle_cmd.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit db41132

Please sign in to comment.