diff options
author | smatz <smatz@openttd.org> | 2009-05-10 17:27:25 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-10 17:27:25 +0000 |
commit | f5316c5cbd13c3ce8c0a7d8b652ce7d975c17438 (patch) | |
tree | e9c57e3fa45a652740e681f7d25b731d7b2f9cfb /src/debug.cpp | |
parent | 552f10bb09667a7c36724092d290808c2c9e51b4 (diff) | |
download | openttd-f5316c5cbd13c3ce8c0a7d8b652ce7d975c17438.tar.xz |
(svn r16269) -Codechange: use gcc's ability to check parameters sent to printf-like functions
-Fix: wrong number of parameters or wrong parameter types sent to printf-like functions at several places
Diffstat (limited to 'src/debug.cpp')
-rw-r--r-- | src/debug.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index 7717749f0..7b369603e 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -92,15 +92,13 @@ static void debug_print(const char *dbg, const char *buf) } } -void CDECL debug(const char *dbg, ...) +void CDECL debug(const char *dbg, const char *format, ...) { - va_list va; - va_start(va, dbg); - const char *s; char buf[1024]; - s = va_arg(va, const char*); - vsnprintf(buf, lengthof(buf), s, va); + va_list va; + va_start(va, format); + vsnprintf(buf, lengthof(buf), format, va); va_end(va); debug_print(dbg, buf); @@ -149,7 +147,7 @@ void SetDebugString(const char *s) if (p != NULL) { *p = v; } else { - ShowInfoF("Unknown debug level '%.*s'", s - t, t); + ShowInfoF("Unknown debug level '%.*s'", (int)(s - t), t); return; } } |