diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2021-02-21 17:03:19 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2021-04-07 09:31:47 +0200 |
commit | e0561dbded57f195e7842cf69764e3ee2c3a71da (patch) | |
tree | 10ae740118601eb102fa73a753bdcdca03607552 /src/ini.cpp | |
parent | 825867f2c50ce508fac442e6113da9cebbfccf75 (diff) | |
download | openttd-e0561dbded57f195e7842cf69764e3ee2c3a71da.tar.xz |
Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers
Diffstat (limited to 'src/ini.cpp')
-rw-r--r-- | src/ini.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ini.cpp b/src/ini.cpp index 4988c778e..a5045b715 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -53,7 +53,7 @@ bool IniFile::SaveToDisk(const std::string &filename) std::string file_new{ filename }; file_new.append(".new"); - std::ofstream os(OTTD2FS(file_new.c_str())); + std::ofstream os(OTTD2FS(file_new)); if (os.fail()) return false; for (const IniGroup *group = this->group; group != nullptr; group = group->next) { @@ -94,8 +94,8 @@ bool IniFile::SaveToDisk(const std::string &filename) #if defined(_WIN32) /* Allocate space for one more \0 character. */ wchar_t tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1]; - wcsncpy(tfilename, OTTD2FS(filename.c_str()), MAX_PATH); - wcsncpy(tfile_new, OTTD2FS(file_new.c_str()), MAX_PATH); + wcsncpy(tfilename, OTTD2FS(filename).c_str(), MAX_PATH); + wcsncpy(tfile_new, OTTD2FS(file_new).c_str(), MAX_PATH); /* SHFileOperation wants a double '\0' terminated string. */ tfilename[MAX_PATH - 1] = '\0'; tfile_new[MAX_PATH - 1] = '\0'; |