1
0

Revert "Properly initialised variables"

This reverts commit 02e7527893.
This commit is contained in:
Tiger Wang 2014-02-02 20:10:02 +00:00
parent dd3cc733ae
commit ecbb9134a5
4 changed files with 10 additions and 13 deletions

View File

@ -18,8 +18,7 @@
cLog* cLog::s_Log = NULL; cLog* cLog::s_Log = NULL;
cLog::cLog(const AString & a_FileName ) cLog::cLog(const AString & a_FileName )
: m_File(NULL), : m_File(NULL)
m_LastStringSize(0)
{ {
s_Log = this; s_Log = this;

View File

@ -10,7 +10,7 @@ class cLog
private: private:
FILE * m_File; FILE * m_File;
static cLog * s_Log; static cLog * s_Log;
size_t m_LastStringSize; size_t m_LastStringSize = 0;
public: public:
cLog(const AString & a_FileName); cLog(const AString & a_FileName);
~cLog(); ~cLog();

View File

@ -11,6 +11,10 @@
cMCLogger * cMCLogger::s_MCLogger = NULL; cMCLogger * cMCLogger::s_MCLogger = NULL;
bool g_ShouldColorOutput = false; bool g_ShouldColorOutput = false;
/** Flag to show whether a 'replace line' log command has been issued
Used to decide when to put a newline */
bool g_BeginLineUpdate = false;
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> // Needed for _isatty(), not available on Linux #include <io.h> // Needed for _isatty(), not available on Linux
@ -34,7 +38,6 @@ cMCLogger * cMCLogger::GetInstance(void)
cMCLogger::cMCLogger(void) cMCLogger::cMCLogger(void)
: m_BeginLineUpdate(false)
{ {
AString FileName; AString FileName;
Printf(FileName, "LOG_%d.txt", (int)time(NULL)); Printf(FileName, "LOG_%d.txt", (int)time(NULL));
@ -46,7 +49,6 @@ cMCLogger::cMCLogger(void)
cMCLogger::cMCLogger(const AString & a_FileName) cMCLogger::cMCLogger(const AString & a_FileName)
: m_BeginLineUpdate(false)
{ {
InitLog(a_FileName); InitLog(a_FileName);
} }
@ -125,14 +127,14 @@ void cMCLogger::Log(const char * a_Format, va_list a_ArgList, bool a_ShouldRepla
{ {
cCSLock Lock(m_CriticalSection); cCSLock Lock(m_CriticalSection);
if (!m_BeginLineUpdate && a_ShouldReplaceLine) if (!g_BeginLineUpdate && a_ShouldReplaceLine)
{ {
a_ShouldReplaceLine = false; // Print a normal line first if this is the initial replace line a_ShouldReplaceLine = false; // Print a normal line first if this is the initial replace line
m_BeginLineUpdate = true; g_BeginLineUpdate = true;
} }
else if (m_BeginLineUpdate && !a_ShouldReplaceLine) else if (g_BeginLineUpdate && !a_ShouldReplaceLine)
{ {
m_BeginLineUpdate = false; g_BeginLineUpdate = false;
} }
if (a_ShouldReplaceLine) if (a_ShouldReplaceLine)

View File

@ -51,10 +51,6 @@ private:
/// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this /// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this
void InitLog(const AString & a_FileName); void InitLog(const AString & a_FileName);
/** Flag to show whether a 'replace line' log command has been issued
Used to decide when to put a newline */
bool m_BeginLineUpdate;
}; // tolua_export }; // tolua_export