[Common] CFile::Write(): Use standard memory size input type.
This commit is contained in:
parent
43f175ce70
commit
a3cac34c74
|
@ -140,15 +140,19 @@ bool CFile::Flush()
|
|||
return ::FlushFileBuffers(m_hFile) != 0;
|
||||
}
|
||||
|
||||
bool CFile::Write(const void* lpBuf, uint32_t nCount)
|
||||
bool CFile::Write(const void* lpBuf, size_t nCount)
|
||||
{
|
||||
if (nCount == 0)
|
||||
{
|
||||
return true; // avoid Win32 "null-write" option
|
||||
}
|
||||
if (nCount > ULONG_MAX)
|
||||
{
|
||||
nCount = ULONG_MAX; /* Or should we loop WriteFile() every 2 GB? */
|
||||
}
|
||||
|
||||
ULONG nWritten = 0;
|
||||
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
|
||||
DWORD nWritten = 0;
|
||||
if (!::WriteFile(m_hFile, lpBuf, (DWORD)nCount, &nWritten, NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
virtual uint32_t GetLength() const = 0;
|
||||
|
||||
virtual uint32_t Read(void* lpBuf, uint32_t nCount) = 0;
|
||||
virtual bool Write(const void* lpBuf, uint32_t nCount) = 0;
|
||||
virtual bool Write(const void* lpBuf, size_t nCount) = 0;
|
||||
|
||||
virtual bool Flush() = 0;
|
||||
virtual bool Close() = 0;
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
virtual uint32_t GetLength() const;
|
||||
|
||||
virtual uint32_t Read(void* lpBuf, uint32_t nCount);
|
||||
virtual bool Write(const void* lpBuf, uint32_t nCount);
|
||||
virtual bool Write(const void* lpBuf, size_t nCount);
|
||||
|
||||
virtual bool Flush();
|
||||
virtual bool Close();
|
||||
|
|
|
@ -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,(uint32_t)strlen(Message)*sizeof(TCHAR));
|
||||
m_hLogFile.Write(Message, strlen(Message)*sizeof(TCHAR));
|
||||
if (m_FlushOnWrite)
|
||||
{
|
||||
m_hLogFile.Flush();
|
||||
|
|
Loading…
Reference in New Issue