diff options
author | rubidium <rubidium@openttd.org> | 2014-04-23 21:23:21 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-04-23 21:23:21 +0000 |
commit | 21f991e2353d99064555acf7996b51c46bbd44a5 (patch) | |
tree | 98bcaf86aac6edddf70877a13a71b8337049254d /src/fios_gui.cpp | |
parent | 160ad31028c6d089ee9bc69581c9a25da00912aa (diff) | |
download | openttd-21f991e2353d99064555acf7996b51c46bbd44a5.tar.xz |
(svn r26489) -Codechange: properly account for the end of buffers in the file io code instead of assuming MAX_PATH is okay
Diffstat (limited to 'src/fios_gui.cpp')
-rw-r--r-- | src/fios_gui.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 579eedf89..5c91ec77d 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -298,17 +298,17 @@ public: switch (_saveload_mode) { case SLD_SAVE_GAME: case SLD_LOAD_GAME: - FioGetDirectory(o_dir.name, lengthof(o_dir.name), SAVE_DIR); + FioGetDirectory(o_dir.name, lastof(o_dir.name), SAVE_DIR); break; case SLD_SAVE_SCENARIO: case SLD_LOAD_SCENARIO: - FioGetDirectory(o_dir.name, lengthof(o_dir.name), SCENARIO_DIR); + FioGetDirectory(o_dir.name, lastof(o_dir.name), SCENARIO_DIR); break; case SLD_SAVE_HEIGHTMAP: case SLD_LOAD_HEIGHTMAP: - FioGetDirectory(o_dir.name, lengthof(o_dir.name), HEIGHTMAP_DIR); + FioGetDirectory(o_dir.name, lastof(o_dir.name), HEIGHTMAP_DIR); break; default: @@ -654,10 +654,10 @@ public: } else if (this->IsWidgetLowered(WID_SL_SAVE_GAME)) { // Save button clicked if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) { _switch_mode = SM_SAVE_GAME; - FiosMakeSavegameName(_file_to_saveload.name, this->filename_editbox.text.buf, sizeof(_file_to_saveload.name)); + FiosMakeSavegameName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name)); } else { _switch_mode = SM_SAVE_HEIGHTMAP; - FiosMakeHeightmapName(_file_to_saveload.name, this->filename_editbox.text.buf, sizeof(_file_to_saveload.name)); + FiosMakeHeightmapName(_file_to_saveload.name, this->filename_editbox.text.buf, lastof(_file_to_saveload.name)); } /* In the editor set up the vehicle engines correctly (date might have changed) */ |