summaryrefslogtreecommitdiff
path: root/src/fios.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-05 15:01:36 +0000
committeralberth <alberth@openttd.org>2009-07-05 15:01:36 +0000
commitabd37177f2470caad29c57e63c249996417917c0 (patch)
treee15c7dfcd124cfd0e1e287a626df6217d3b3ce74 /src/fios.cpp
parente1a26058e90e3f0e80df044f8f65161f126e88d0 (diff)
downloadopenttd-abd37177f2470caad29c57e63c249996417917c0.tar.xz
(svn r16748) -Codechange: Don't cast away constness.
Diffstat (limited to 'src/fios.cpp')
-rw-r--r--src/fios.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fios.cpp b/src/fios.cpp
index dfa57ccf2..56048197f 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -572,13 +572,15 @@ public:
Md5 checksum;
uint8 buffer[1024];
+ char basename[MAX_PATH]; ///< \a filename without the extension.
size_t len, size;
/* open the scenario file, but first get the name.
* This is safe as we check on extension which
* must always exist. */
- *(char *)strrchr(filename, '.') = '\0';
- f = FioFOpenFile(filename, "rb", SCENARIO_DIR, &size);
+ strecpy(basename, filename, lastof(basename));
+ *strrchr(basename, '.') = '\0';
+ f = FioFOpenFile(basename, "rb", SCENARIO_DIR, &size);
if (f == NULL) return false;
/* calculate md5sum */