diff options
author | rubidium <rubidium@openttd.org> | 2008-01-24 18:47:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-01-24 18:47:05 +0000 |
commit | bbdc5a9314f0f0e90517b3a513ba49db06e30260 (patch) | |
tree | 80e848502114343ca21477b04e1cddee125bb546 /src/debug.cpp | |
parent | 4991dcecc7ea2e4ab9de69cf0cdfc69740594ef3 (diff) | |
download | openttd-bbdc5a9314f0f0e90517b3a513ba49db06e30260.tar.xz |
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
Diffstat (limited to 'src/debug.cpp')
-rw-r--r-- | src/debug.cpp | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index d6104f9b0..aefa0a64b 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -59,50 +59,34 @@ struct DebugLevel { #if !defined(NO_DEBUG_MESSAGES) -/** Functionized DEBUG macro for compilers that don't support - * variadic macros (__VA_ARGS__) such as...yes MSVC2003 and lower */ -#if defined(NO_VARARG_MACRO) -void CDECL DEBUG(int name, int level, ...) -{ - va_list va; - const char *dbg; - const DebugLevel *dl = &debug_level[name]; - - if (level != 0 && *dl->level < level) return; - dbg = dl->name; - va_start(va, level); -#else void CDECL debug(const char *dbg, ...) { va_list va; va_start(va, dbg); -#endif /* NO_VARARG_MACRO */ - { - const char *s; - char buf[1024]; + const char *s; + char buf[1024]; - s = va_arg(va, const char*); - vsnprintf(buf, lengthof(buf), s, va); - va_end(va); + s = va_arg(va, const char*); + vsnprintf(buf, lengthof(buf), s, va); + va_end(va); #if defined(ENABLE_NETWORK) - if (_debug_socket != INVALID_SOCKET) { - char buf2[lengthof(buf) + 32]; + if (_debug_socket != INVALID_SOCKET) { + char buf2[lengthof(buf) + 32]; - snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf); - send(_debug_socket, buf2, strlen(buf2), 0); - } else + snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf); + send(_debug_socket, buf2, strlen(buf2), 0); + } else #endif /* ENABLE_NETWORK */ - { + { #if defined(WINCE) - /* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */ - TCHAR tbuf[512]; - _sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg)); - NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf)); + /* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */ + TCHAR tbuf[512]; + _sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg)); + NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf)); #else - fprintf(stderr, "dbg: [%s] %s\n", dbg, buf); + fprintf(stderr, "dbg: [%s] %s\n", dbg, buf); #endif - IConsoleDebug(dbg, buf); - } + IConsoleDebug(dbg, buf); } } #endif /* NO_DEBUG_MESSAGES */ |