summaryrefslogtreecommitdiff
path: root/win32.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
commit413dd85cd7da04afb486647d0f8f77ca8f5d0449 (patch)
treeb5b00ebf09959e957c1c291c92d531f5fbfcc8eb /win32.c
parent1815383ba7ed31e43034f13134f5b6a7cf704145 (diff)
downloadopenttd-413dd85cd7da04afb486647d0f8f77ca8f5d0449.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 'win32.c')
-rw-r--r--win32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/win32.c b/win32.c
index f4e642efc..096702cf0 100644
--- a/win32.c
+++ b/win32.c
@@ -963,7 +963,7 @@ StringID FiosGetDescText(const char **path, uint32 *tot)
return sid;
}
-void FiosMakeSavegameName(char *buf, const char *name)
+void FiosMakeSavegameName(char *buf, const char *name, size_t size)
{
const char* extension;
const char* period;
@@ -977,14 +977,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 DeleteFile(path) != 0;
}