summaryrefslogtreecommitdiff
path: root/os2.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-03-21 22:08:15 +0000
committerDarkvater <darkvater@openttd.org>2006-03-21 22:08:15 +0000
commit7656bf80759ea2af75e2694a9c070b75113d862d (patch)
treeb5b00ebf09959e957c1c291c92d531f5fbfcc8eb /os2.c
parent5701e1a23773c84ddb4492a07f43905c71594a4b (diff)
downloadopenttd-7656bf80759ea2af75e2694a9c070b75113d862d.tar.xz
(svn r4001) - Add length parameter to FiosMakeSavegameName() and use this function for creating the full path instead of home-brewn snprintf.
Diffstat (limited to 'os2.c')
-rw-r--r--os2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/os2.c b/os2.c
index c2fd448f3..3b6c48e2c 100644
--- a/os2.c
+++ b/os2.c
@@ -401,7 +401,7 @@ StringID FiosGetDescText(const char **path, uint32 *tot)
return STR_4006_UNABLE_TO_READ_DRIVE;
}
-void FiosMakeSavegameName(char *buf, const char *name)
+void FiosMakeSavegameName(char *buf, const char *name, size_t size)
{
const char* extension;
const char* period;
@@ -415,14 +415,14 @@ void FiosMakeSavegameName(char *buf, const char *name)
period = strrchr(name, '.');
if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
- sprintf(buf, "%s\\%s%s", _fios_path, name, extension);
+ snprintf(buf, size, "%s\\%s%s", _fios_path, name, extension);
}
bool FiosDelete(const char *name)
{
char path[512];
- snprintf(path, lengthof(path), "%s\\%s", _fios_path, name);
+ FiosMakeSavegameName(path, name, sizeof(path));
return unlink(path) == 0;
}