diff options
author | Michael Lutz <michi@icosahedron.de> | 2018-05-20 03:15:22 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2018-05-26 22:28:01 +0200 |
commit | 3fc9c9522d41ee4383f9d7ec6fc8583db9289324 (patch) | |
tree | c3e3a886f52d8cfb7aaf2af9665b959246617693 /src | |
parent | e1a164b5316a6242d69d56b53c9df19edb9d279f (diff) | |
download | openttd-3fc9c9522d41ee4383f9d7ec6fc8583db9289324.tar.xz |
Codechange: [Win32] Use a local buffer to store the output text of DEBUG() to make the call thread-safe.
Diffstat (limited to 'src')
-rw-r--r-- | src/debug.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index d4d547c88..f8f3f0ad5 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -17,6 +17,10 @@ #include "fileio_func.h" #include "settings_type.h" +#if defined(WIN32) || defined(WIN64) +#include "os/windows/win32.h" +#endif + #include <time.h> #if defined(ENABLE_NETWORK) @@ -136,7 +140,9 @@ static void debug_print(const char *dbg, const char *buf) char buffer[512]; seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf); #if defined(WIN32) || defined(WIN64) - _fputts(OTTD2FS(buffer, true), stderr); + TCHAR system_buf[512]; + convert_to_fs(buffer, system_buf, lengthof(system_buf), true); + _fputts(system_buf, stderr); #else fputs(buffer, stderr); #endif |