summaryrefslogtreecommitdiff
path: root/src/driver.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-10-28 14:42:31 +0000
committerrubidium <rubidium@openttd.org>2008-10-28 14:42:31 +0000
commit0d254e8914f294a8f9a0e177e2d0208e57b2d5c9 (patch)
treeb5fc23e46516c5f53edc37ad11559ac6e8586d4c /src/driver.cpp
parentcf4cffd91adbe563e4cd9f892ad3ab54a2fef13e (diff)
downloadopenttd-0d254e8914f294a8f9a0e177e2d0208e57b2d5c9.tar.xz
(svn r14540) -Codechange: introduce [v]seprintf which are like [v]snprintf but do return the number of characters written instead of the number of characters that would be written; as size_t is unsigned substraction can cause integer underflows quite quickly.
Diffstat (limited to 'src/driver.cpp')
-rw-r--r--src/driver.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/driver.cpp b/src/driver.cpp
index b042ea620..dc8ffb1af 100644
--- a/src/driver.cpp
+++ b/src/driver.cpp
@@ -168,7 +168,7 @@ void DriverFactoryBase::RegisterDriver(const char *name, Driver::Type type, int
char *DriverFactoryBase::GetDriversInfo(char *p, const char *last)
{
for (Driver::Type type = Driver::DT_BEGIN; type != Driver::DT_END; type++) {
- p += snprintf(p, last - p, "List of %s drivers:\n", GetDriverTypeName(type));
+ p += seprintf(p, last, "List of %s drivers:\n", GetDriverTypeName(type));
for (int priority = 10; priority >= 0; priority--) {
Drivers::iterator it = GetDrivers().begin();
@@ -176,11 +176,11 @@ char *DriverFactoryBase::GetDriversInfo(char *p, const char *last)
DriverFactoryBase *d = (*it).second;
if (d->type != type) continue;
if (d->priority != priority) continue;
- p += snprintf(p, last - p, "%18s: %s\n", d->name, d->GetDescription());
+ p += seprintf(p, last, "%18s: %s\n", d->name, d->GetDescription());
}
}
- p += snprintf(p, last - p, "\n");
+ p += seprintf(p, last, "\n");
}
return p;