[Project64] Log Class.cpp to use standard types

This commit is contained in:
zilmar 2015-11-11 17:51:19 +11:00
parent 4b150ded03
commit 53aa2faf3b
2 changed files with 14 additions and 15 deletions

View File

@ -120,7 +120,7 @@ void CLog::LogArgs(const char * Message, va_list & args )
void CLog::Log( const char * Message )
{
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)
{
m_hLogFile.Flush();
@ -145,13 +145,13 @@ void CLog::Log( const char * Message )
m_hLogFile.Seek((end - m_MaxFileSize) + m_FileChangeSize,CFile::begin);
// Find next end of line
size_t NextEnter = 0, dwRead = 0;
uint32_t NextEnter = 0, dwRead = 0;
do
{
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)
{
break;
@ -170,9 +170,8 @@ void CLog::Log( const char * Message )
} while(dwRead != 0);
// copy content of log to the new file
size_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
uint32_t WritePos = 0;
size_t SizeToRead;
uint32_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
uint32_t SizeToRead, WritePos = 0;
do
{
enum { fIS_MvSize = 0x5000 };
@ -183,8 +182,8 @@ void CLog::Log( const char * Message )
m_hLogFile.Seek(ReadPos,CFile::begin);
size_t dwRead;
dwRead = m_hLogFile.Read(Data, SizeToRead);
uint32_t dwRead;
dwRead = m_hLogFile.Read(Data,SizeToRead);
m_hLogFile.Seek(WritePos,CFile::begin);

View File

@ -15,8 +15,8 @@ class CLog
bool m_FlushOnWrite;
stdstr m_FileName;
bool m_TruncateFileLog;
size_t m_MaxFileSize;
size_t m_FileChangeSize;
uint32_t m_MaxFileSize;
uint32_t m_FileChangeSize;
public:
CLog ( void );
@ -29,10 +29,10 @@ public:
bool Empty ( void );
void Close ( void );
inline void SetMaxFileSize(size_t Size)
{
m_MaxFileSize = Size;
m_FileChangeSize = (size_t)(Size * 0.1);
inline void SetMaxFileSize ( uint32_t Size )
{
m_MaxFileSize = Size;
m_FileChangeSize = (uint32_t)(Size * 0.1);
}
inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; }
inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; }