summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2021-02-21 17:03:19 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-07 09:31:47 +0200
commite0561dbded57f195e7842cf69764e3ee2c3a71da (patch)
tree10ae740118601eb102fa73a753bdcdca03607552 /src/strings.cpp
parent825867f2c50ce508fac442e6113da9cebbfccf75 (diff)
downloadopenttd-e0561dbded57f195e7842cf69764e3ee2c3a71da.tar.xz
Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index 08e826141..7cbdc3cb0 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -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)) {