1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 20:49:11 +00:00

Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers

This commit is contained in:
Niels Martin Hansen
2021-02-21 17:03:19 +01:00
parent 825867f2c5
commit e0561dbded
17 changed files with 109 additions and 100 deletions

View File

@@ -1910,14 +1910,14 @@ static void GetLanguageList(const char *path)
if (dir != nullptr) {
struct dirent *dirent;
while ((dirent = readdir(dir)) != nullptr) {
const char *d_name = FS2OTTD(dirent->d_name);
const char *extension = strrchr(d_name, '.');
std::string d_name = FS2OTTD(dirent->d_name);
const char *extension = strrchr(d_name.c_str(), '.');
/* Not a language file */
if (extension == nullptr || strcmp(extension, ".lng") != 0) continue;
LanguageMetadata lmd;
seprintf(lmd.file, lastof(lmd.file), "%s%s", path, d_name);
seprintf(lmd.file, lastof(lmd.file), "%s%s", path, d_name.c_str());
/* Check whether the file is of the correct version */
if (!GetLanguageFileHeader(lmd.file, &lmd)) {