Change the re-use of stdargs which upsets some platforms.

This commit is contained in:
Jonathan Naylor
2016-02-08 15:27:29 +00:00
parent fb3d76787a
commit 263a34853f

11
Log.cpp
View File

@@ -122,16 +122,17 @@ void Log(unsigned int level, const char* fmt, ...)
va_list vl; va_list vl;
va_start(vl, fmt); va_start(vl, fmt);
vfprintf(m_fpLog, fmt, vl);
if (m_display) char buffer[200U];
vfprintf(stdout, fmt, vl); ::vsprintf(buffer, fmt, vl);
va_end(vl); va_end(vl);
::fprintf(m_fpLog, "\n"); ::fprintf(m_fpLog, "%s\n", buffer);
::fflush(m_fpLog); ::fflush(m_fpLog);
if (m_display) { if (m_display) {
::fprintf(stdout, "\n"); ::fprintf(stdout, "%s\n", buffer);
::fflush(stdout); ::fflush(stdout);
} }