[Project64] Log Class.cpp to use standard types
This commit is contained in:
parent
4b150ded03
commit
53aa2faf3b
|
@ -120,7 +120,7 @@ void CLog::LogArgs(const char * Message, va_list & args )
|
||||||
void CLog::Log( const char * Message )
|
void CLog::Log( const char * Message )
|
||||||
{
|
{
|
||||||
if (!m_hLogFile.IsOpen()) { return; }
|
if (!m_hLogFile.IsOpen()) { return; }
|
||||||
m_hLogFile.Write(Message, strlen(Message)*sizeof(TCHAR));
|
m_hLogFile.Write(Message,(uint32_t)strlen(Message)*sizeof(TCHAR));
|
||||||
if (m_FlushOnWrite)
|
if (m_FlushOnWrite)
|
||||||
{
|
{
|
||||||
m_hLogFile.Flush();
|
m_hLogFile.Flush();
|
||||||
|
@ -145,13 +145,13 @@ void CLog::Log( const char * Message )
|
||||||
m_hLogFile.Seek((end - m_MaxFileSize) + m_FileChangeSize,CFile::begin);
|
m_hLogFile.Seek((end - m_MaxFileSize) + m_FileChangeSize,CFile::begin);
|
||||||
|
|
||||||
// Find next end of line
|
// Find next end of line
|
||||||
size_t NextEnter = 0, dwRead = 0;
|
uint32_t NextEnter = 0, dwRead = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
BYTE Data[300];
|
BYTE Data[300];
|
||||||
size_t dwRead;
|
uint32_t dwRead;
|
||||||
|
|
||||||
dwRead = m_hLogFile.Read(Data, sizeof(Data));
|
dwRead = m_hLogFile.Read(Data,sizeof(Data));
|
||||||
if (dwRead == 0)
|
if (dwRead == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -170,9 +170,8 @@ void CLog::Log( const char * Message )
|
||||||
} while(dwRead != 0);
|
} while(dwRead != 0);
|
||||||
|
|
||||||
// copy content of log to the new file
|
// copy content of log to the new file
|
||||||
size_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
|
uint32_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
|
||||||
uint32_t WritePos = 0;
|
uint32_t SizeToRead, WritePos = 0;
|
||||||
size_t SizeToRead;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
enum { fIS_MvSize = 0x5000 };
|
enum { fIS_MvSize = 0x5000 };
|
||||||
|
@ -183,8 +182,8 @@ void CLog::Log( const char * Message )
|
||||||
|
|
||||||
m_hLogFile.Seek(ReadPos,CFile::begin);
|
m_hLogFile.Seek(ReadPos,CFile::begin);
|
||||||
|
|
||||||
size_t dwRead;
|
uint32_t dwRead;
|
||||||
dwRead = m_hLogFile.Read(Data, SizeToRead);
|
dwRead = m_hLogFile.Read(Data,SizeToRead);
|
||||||
|
|
||||||
m_hLogFile.Seek(WritePos,CFile::begin);
|
m_hLogFile.Seek(WritePos,CFile::begin);
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ class CLog
|
||||||
bool m_FlushOnWrite;
|
bool m_FlushOnWrite;
|
||||||
stdstr m_FileName;
|
stdstr m_FileName;
|
||||||
bool m_TruncateFileLog;
|
bool m_TruncateFileLog;
|
||||||
size_t m_MaxFileSize;
|
uint32_t m_MaxFileSize;
|
||||||
size_t m_FileChangeSize;
|
uint32_t m_FileChangeSize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLog ( void );
|
CLog ( void );
|
||||||
|
@ -29,10 +29,10 @@ public:
|
||||||
bool Empty ( void );
|
bool Empty ( void );
|
||||||
void Close ( void );
|
void Close ( void );
|
||||||
|
|
||||||
inline void SetMaxFileSize(size_t Size)
|
inline void SetMaxFileSize ( uint32_t Size )
|
||||||
{
|
{
|
||||||
m_MaxFileSize = Size;
|
m_MaxFileSize = Size;
|
||||||
m_FileChangeSize = (size_t)(Size * 0.1);
|
m_FileChangeSize = (uint32_t)(Size * 0.1);
|
||||||
}
|
}
|
||||||
inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; }
|
inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; }
|
||||||
inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; }
|
inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; }
|
||||||
|
|
Loading…
Reference in New Issue