diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-23 13:36:00 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-23 13:36:00 -0700 |
commit | f1e7c461dfabbff6b65a072f24f6711b34159361 (patch) | |
tree | 3b0bb772a59669f06b86824a444fd06642592d4b /core/src/fxcrt | |
parent | 320b2313d19869333ed453af546e61a9fc2b81c9 (diff) | |
download | pdfium-f1e7c461dfabbff6b65a072f24f6711b34159361.tar.xz |
Revert "FX_BOOL considered harmful, part 2."
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9.
Reason for revert: build failure.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1255693002 .
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r-- | core/src/fxcrt/extension.h | 112 | ||||
-rw-r--r-- | core/src/fxcrt/fx_arabic.cpp | 12 | ||||
-rw-r--r-- | core/src/fxcrt/fx_arabic.h | 8 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_array.cpp | 44 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_bstring.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 48 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_coords.cpp | 36 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_gcc.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_maps.cpp | 52 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_util.cpp | 80 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_wstring.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fx_extension.cpp | 28 | ||||
-rw-r--r-- | core/src/fxcrt/fx_unicode.cpp | 12 | ||||
-rw-r--r-- | core/src/fxcrt/fx_xml_parser.cpp | 102 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.cpp | 40 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.h | 8 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_posix.cpp | 38 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_posix.h | 8 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_windows.cpp | 40 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_windows.h | 8 | ||||
-rw-r--r-- | core/src/fxcrt/xml_int.h | 38 |
21 files changed, 363 insertions, 363 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 2d7f3ae220..ba42916599 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -14,8 +14,8 @@ class IFXCRT_FileAccess { public: virtual ~IFXCRT_FileAccess() {} - virtual bool Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) = 0; - virtual bool Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) = 0; + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) = 0; + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) = 0; virtual void Close() = 0; virtual void Release() = 0; virtual FX_FILESIZE GetSize() const = 0; @@ -25,14 +25,14 @@ public: virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; virtual size_t WritePos(const void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; - virtual bool Flush() = 0; - virtual bool Truncate(FX_FILESIZE szFile) = 0; + virtual FX_BOOL Flush() = 0; + virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; }; IFXCRT_FileAccess* FXCRT_FileAccess_Create(); class CFX_CRTFileStream final : public IFX_FileStream { public: - CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bUseRange(false), m_nOffset(0), m_nSize(0) {} + CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bUseRange(FALSE), m_nOffset(0), m_nSize(0) {} ~CFX_CRTFileStream() { if (m_pFile) { @@ -55,7 +55,7 @@ public: { return m_bUseRange ? m_nSize : m_pFile->GetSize(); } - virtual bool IsEOF() override + virtual FX_BOOL IsEOF() override { return GetPosition() >= GetSize(); } @@ -67,42 +67,42 @@ public: } return pos; } - virtual bool SetRange(FX_FILESIZE offset, FX_FILESIZE size) override + virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) override { if (offset < 0 || size < 0) { - return false; + return FALSE; } FX_SAFE_FILESIZE pos = size; pos += offset; if (!pos.IsValid() || pos.ValueOrDie() > m_pFile->GetSize()) { - return false; + return FALSE; } m_nOffset = offset, m_nSize = size; - m_bUseRange = true; + m_bUseRange = TRUE; m_pFile->SetPosition(m_nOffset); - return true; + return TRUE; } virtual void ClearRange() override { - m_bUseRange = false; + m_bUseRange = FALSE; } - virtual bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override + virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { if (m_bUseRange && offset < 0) { - return false; + return FALSE; } FX_SAFE_FILESIZE pos = offset; if (m_bUseRange) { pos += m_nOffset; if (!pos.IsValid() || pos.ValueOrDie() > (size_t)GetSize()) { - return false; + return FALSE; } } - return (bool)m_pFile->ReadPos(buffer, size, pos.ValueOrDie()); + return (FX_BOOL)m_pFile->ReadPos(buffer, size, pos.ValueOrDie()); } virtual size_t ReadBlock(void* buffer, size_t size) override { @@ -114,20 +114,20 @@ public: } return m_pFile->Read(buffer, size); } - virtual bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override + virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override { if (m_bUseRange) { offset += m_nOffset; } - return (bool)m_pFile->WritePos(buffer, size, offset); + return (FX_BOOL)m_pFile->WritePos(buffer, size, offset); } - virtual bool Flush() override + virtual FX_BOOL Flush() override { return m_pFile->Flush(); } IFXCRT_FileAccess* m_pFile; FX_DWORD m_dwCount; - bool m_bUseRange; + FX_BOOL m_bUseRange; FX_FILESIZE m_nOffset; FX_FILESIZE m_nSize; }; @@ -137,23 +137,23 @@ public: class CFX_MemoryStream final : public IFX_MemoryStream { public: - CFX_MemoryStream(bool bConsecutive) + CFX_MemoryStream(FX_BOOL bConsecutive) : m_dwCount(1) , m_nTotalSize(0) , m_nCurSize(0) , m_nCurPos(0) , m_nGrowSize(FX_MEMSTREAM_BlockSize) - , m_bUseRange(false) + , m_bUseRange(FALSE) { m_dwFlags = FX_MEMSTREAM_TakeOver | (bConsecutive ? FX_MEMSTREAM_Consecutive : 0); } - CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver) + CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver) : m_dwCount(1) , m_nTotalSize(nSize) , m_nCurSize(nSize) , m_nCurPos(0) , m_nGrowSize(FX_MEMSTREAM_BlockSize) - , m_bUseRange(false) + , m_bUseRange(FALSE) { m_Blocks.Add(pBuffer); m_dwFlags = FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0); @@ -184,7 +184,7 @@ public: { return m_bUseRange ? (FX_FILESIZE) m_nSize : (FX_FILESIZE)m_nCurSize; } - virtual bool IsEOF() override + virtual FX_BOOL IsEOF() override { return m_nCurPos >= (size_t)GetSize(); } @@ -196,30 +196,30 @@ public: } return pos; } - virtual bool SetRange(FX_FILESIZE offset, FX_FILESIZE size) override + virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) override { if (offset < 0 || size < 0) { - return false; + return FALSE; } FX_SAFE_FILESIZE range = size; range += offset; if (!range.IsValid() || range.ValueOrDie() > m_nCurSize) { - return false; + return FALSE; } m_nOffset = (size_t)offset, m_nSize = (size_t)size; - m_bUseRange = true; + m_bUseRange = TRUE; m_nCurPos = m_nOffset; - return true; + return TRUE; } virtual void ClearRange() override { - m_bUseRange = false; + m_bUseRange = FALSE; } - virtual bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override + virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { if (!buffer || !size) { - return false; + return FALSE; } FX_SAFE_FILESIZE safeOffset = offset; @@ -228,7 +228,7 @@ public: } if (!safeOffset.IsValid()) { - return false; + return FALSE; } offset = safeOffset.ValueOrDie(); @@ -236,13 +236,13 @@ public: FX_SAFE_SIZE_T newPos = size; newPos += offset; if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 || newPos.ValueOrDie() > m_nCurSize) { - return false; + return FALSE; } m_nCurPos = newPos.ValueOrDie(); if (m_dwFlags & FX_MEMSTREAM_Consecutive) { FXSYS_memcpy(buffer, (uint8_t*)m_Blocks[0] + (size_t)offset, size); - return true; + return TRUE; } size_t nStartBlock = (size_t)offset / m_nGrowSize; offset -= (FX_FILESIZE)(nStartBlock * m_nGrowSize); @@ -257,7 +257,7 @@ public: nStartBlock ++; offset = 0; } - return true; + return TRUE; } virtual size_t ReadBlock(void* buffer, size_t size) override { @@ -276,10 +276,10 @@ public: } return nRead; } - virtual bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override + virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override { if (!buffer || !size) { - return false; + return FALSE; } if (m_bUseRange) { offset += (FX_FILESIZE)m_nOffset; @@ -288,7 +288,7 @@ public: FX_SAFE_SIZE_T newPos = size; newPos += offset; if (!newPos.IsValid()) - return false; + return FALSE; m_nCurPos = newPos.ValueOrDie(); if (m_nCurPos > m_nTotalSize) { @@ -301,24 +301,24 @@ public: } if (!m_Blocks[0]) { m_Blocks.RemoveAll(); - return false; + return FALSE; } } FXSYS_memcpy((uint8_t*)m_Blocks[0] + (size_t)offset, buffer, size); if (m_nCurSize < m_nCurPos) { m_nCurSize = m_nCurPos; } - return true; + return TRUE; } FX_SAFE_SIZE_T newPos = size; newPos += offset; if (!newPos.IsValid()) { - return false; + return FALSE; } if (!ExpandBlocks(newPos.ValueOrDie())) { - return false; + return FALSE; } m_nCurPos = newPos.ValueOrDie(); size_t nStartBlock = (size_t)offset / m_nGrowSize; @@ -334,13 +334,13 @@ public: nStartBlock ++; offset = 0; } - return true; + return TRUE; } - virtual bool Flush() override + virtual FX_BOOL Flush() override { - return true; + return TRUE; } - virtual bool IsConsecutive() const override + virtual FX_BOOL IsConsecutive() const override { return m_dwFlags & FX_MEMSTREAM_Consecutive; } @@ -360,7 +360,7 @@ public: { return m_Blocks.GetSize() ? (uint8_t*)m_Blocks[0] : NULL; } - virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, bool bTakeOver = false) override + virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) override { if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) { return; @@ -390,16 +390,16 @@ protected: size_t m_nCurPos; size_t m_nGrowSize; FX_DWORD m_dwFlags; - bool m_bUseRange; + FX_BOOL m_bUseRange; size_t m_nOffset; size_t m_nSize; - bool ExpandBlocks(size_t size) + FX_BOOL ExpandBlocks(size_t size) { if (m_nCurSize < size) { m_nCurSize = size; } if (size <= m_nTotalSize) { - return true; + return TRUE; } int32_t iCount = m_Blocks.GetSize(); size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; @@ -409,7 +409,7 @@ protected: m_Blocks.SetAt(iCount ++, pBlock); m_nTotalSize += m_nGrowSize; } - return true; + return TRUE; } }; #ifdef __cplusplus @@ -424,15 +424,15 @@ typedef struct _FX_MTRANDOMCONTEXT { _FX_MTRANDOMCONTEXT() { mti = MT_N + 1; - bHaveSeed = false; + bHaveSeed = FALSE; } FX_DWORD mti; - bool bHaveSeed; + FX_BOOL bHaveSeed; FX_DWORD mt[MT_N]; } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -bool FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); +FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index 497c1bab4f..3cb2fd067a 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -13,7 +13,7 @@ IFX_BidiChar* IFX_BidiChar::Create() return new CFX_BidiChar; } CFX_BidiChar::CFX_BidiChar() - : m_bSeparateNeutral(true) + : m_bSeparateNeutral(TRUE) , m_iCurStart(0) , m_iCurCount(0) , m_iCurBidi(0) @@ -22,12 +22,12 @@ CFX_BidiChar::CFX_BidiChar() , m_iLastCount(0) { } -void CFX_BidiChar::SetPolicy(bool bSeparateNeutral) +void CFX_BidiChar::SetPolicy(FX_BOOL bSeparateNeutral) { m_bSeparateNeutral = bSeparateNeutral; } -bool CFX_BidiChar::AppendChar(FX_WCHAR wch) +FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; @@ -43,10 +43,10 @@ bool CFX_BidiChar::AppendChar(FX_WCHAR wch) iContext = 2; break; } - bool bRet = false; + FX_BOOL bRet = FALSE; if (iContext != m_iCurBidi) { if (m_bSeparateNeutral) { - bRet = true; + bRet = TRUE; } else { if (m_iCurBidi == 0) { bRet = (m_iCurCount > 0); @@ -67,7 +67,7 @@ bool CFX_BidiChar::AppendChar(FX_WCHAR wch) m_iCurCount ++; return bRet; } -bool CFX_BidiChar::EndChar() +FX_BOOL CFX_BidiChar::EndChar() { m_iLastBidi = m_iCurBidi; m_iLastStart = m_iCurStart; diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h index 10a16afa63..e4c1ddacf2 100644 --- a/core/src/fxcrt/fx_arabic.h +++ b/core/src/fxcrt/fx_arabic.h @@ -15,14 +15,14 @@ public: CFX_BidiChar(); ~CFX_BidiChar() override {} - void SetPolicy(bool bSeparateNeutral = true) override; - bool AppendChar(FX_WCHAR wch) override; - bool EndChar() override; + void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) override; + FX_BOOL AppendChar(FX_WCHAR wch) override; + FX_BOOL EndChar() override; int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) override; void Reset() override; private: - bool m_bSeparateNeutral; + FX_BOOL m_bSeparateNeutral; int32_t m_iCurStart; int32_t m_iCurCount; int32_t m_iCurBidi; diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index f139365740..4ab34bb022 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -22,7 +22,7 @@ CFX_BasicArray::~CFX_BasicArray() { FX_Free(m_pData); } -bool CFX_BasicArray::SetSize(int nNewSize) +FX_BOOL CFX_BasicArray::SetSize(int nNewSize) { if (nNewSize <= 0) { FX_Free(m_pData); @@ -36,7 +36,7 @@ bool CFX_BasicArray::SetSize(int nNewSize) totalSize *= m_nUnitSize; if (!totalSize.IsValid()) { m_nSize = m_nMaxSize = 0; - return false; + return FALSE; } m_pData = FX_Alloc(uint8_t, totalSize.ValueOrDie()); m_nSize = m_nMaxSize = nNewSize; @@ -50,38 +50,38 @@ bool CFX_BasicArray::SetSize(int nNewSize) pdfium::base::CheckedNumeric<int> totalSize = nNewMax; totalSize *= m_nUnitSize; if (!totalSize.IsValid() || nNewMax < m_nSize) { - return false; + return FALSE; } uint8_t* pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); if (pNewData == NULL) { - return false; + return FALSE; } FXSYS_memset(pNewData + m_nSize * m_nUnitSize, 0, (nNewMax - m_nSize) * m_nUnitSize); m_pData = pNewData; m_nSize = nNewSize; m_nMaxSize = nNewMax; } - return true; + return TRUE; } -bool CFX_BasicArray::Append(const CFX_BasicArray& src) +FX_BOOL CFX_BasicArray::Append(const CFX_BasicArray& src) { int nOldSize = m_nSize; pdfium::base::CheckedNumeric<int> newSize = m_nSize; newSize += src.m_nSize; if (m_nUnitSize != src.m_nUnitSize || !newSize.IsValid() || !SetSize(newSize.ValueOrDie())) { - return false; + return FALSE; } FXSYS_memcpy(m_pData + nOldSize * m_nUnitSize, src.m_pData, src.m_nSize * m_nUnitSize); - return true; + return TRUE; } -bool CFX_BasicArray::Copy(const CFX_BasicArray& src) +FX_BOOL CFX_BasicArray::Copy(const CFX_BasicArray& src) { if (!SetSize(src.m_nSize)) { - return false; + return FALSE; } FXSYS_memcpy(m_pData, src.m_pData, src.m_nSize * m_nUnitSize); - return true; + return TRUE; } uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) { @@ -103,31 +103,31 @@ uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) } return m_pData + nIndex * m_nUnitSize; } -bool CFX_BasicArray::RemoveAt(int nIndex, int nCount) +FX_BOOL CFX_BasicArray::RemoveAt(int nIndex, int nCount) { if (nIndex < 0 || nCount <= 0 || m_nSize < nIndex + nCount) { - return false; + return FALSE; } int nMoveCount = m_nSize - (nIndex + nCount); if (nMoveCount) { FXSYS_memmove(m_pData + nIndex * m_nUnitSize, m_pData + (nIndex + nCount) * m_nUnitSize, nMoveCount * m_nUnitSize); } m_nSize -= nCount; - return true; + return TRUE; } -bool CFX_BasicArray::InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) +FX_BOOL CFX_BasicArray::InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) { if (pNewArray == NULL) { - return false; + return FALSE; } if (pNewArray->m_nSize == 0) { - return true; + return TRUE; } if (!InsertSpaceAt(nStartIndex, pNewArray->m_nSize)) { - return false; + return FALSE; } FXSYS_memcpy(m_pData + nStartIndex * m_nUnitSize, pNewArray->m_pData, pNewArray->m_nSize * m_nUnitSize); - return true; + return TRUE; } const void* CFX_BasicArray::GetDataPtr(int index) const { @@ -260,7 +260,7 @@ void** CFX_BaseSegmentedArray::GetIndex(int seg_index) const } return pSpot; } -void* CFX_BaseSegmentedArray::IterateSegment(const uint8_t* pSegment, int count, bool (*callback)(void* param, void* pData), void* param) const +void* CFX_BaseSegmentedArray::IterateSegment(const uint8_t* pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const { for (int i = 0; i < count; i ++) { if (!callback(param, (void*)(pSegment + i * m_UnitSize))) { @@ -269,7 +269,7 @@ void* CFX_BaseSegmentedArray::IterateSegment(const uint8_t* pSegment, int count, } return NULL; } -void* CFX_BaseSegmentedArray::IterateIndex(int level, int& start, void** pIndex, bool (*callback)(void* param, void* pData), void* param) const +void* CFX_BaseSegmentedArray::IterateIndex(int level, int& start, void** pIndex, FX_BOOL (*callback)(void* param, void* pData), void* param) const { if (level == 0) { int count = m_DataSize - start; @@ -290,7 +290,7 @@ void* CFX_BaseSegmentedArray::IterateIndex(int level, int& start, void** pIndex, } return NULL; } -void* CFX_BaseSegmentedArray::Iterate(bool (*callback)(void* param, void* pData), void* param) const +void* CFX_BaseSegmentedArray::Iterate(FX_BOOL (*callback)(void* param, void* pData), void* param) const { if (m_pIndex == NULL) { return NULL; diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 47c1c5b6b2..5eeb33b049 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -1086,9 +1086,9 @@ FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) if (d == 0.0f) { return 1; } - bool bNegative = false; + FX_BOOL bNegative = FALSE; if (d < 0) { - bNegative = true; + bNegative = TRUE; d = -d; } int scale = 1; diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index d7c1a1ad7b..9fc400e183 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -321,7 +321,7 @@ CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) m_LoadingPos = 0; m_LoadingSize = dwSize; } -bool CFX_ArchiveLoader::IsEOF() +FX_BOOL CFX_ArchiveLoader::IsEOF() { return m_LoadingPos >= m_LoadingSize; } @@ -372,14 +372,14 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_WideString& str) str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), encoded.GetLength()); return *this; } -bool CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) +FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { if (m_LoadingPos + dwSize > m_LoadingSize) { - return false; + return FALSE; } FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); m_LoadingPos += dwSize; - return true; + return TRUE; } void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { @@ -441,9 +441,9 @@ void IFX_BufferArchive::Clear() m_pBuffer = NULL; } } -bool IFX_BufferArchive::Flush() +FX_BOOL IFX_BufferArchive::Flush() { - bool bRet = DoWork(m_pBuffer, m_Length); + FX_BOOL bRet = DoWork(m_pBuffer, m_Length); m_Length = 0; return bRet; } @@ -488,7 +488,7 @@ int32_t IFX_BufferArchive::AppendString(const CFX_ByteStringC& lpsz) CFX_FileBufferArchive::CFX_FileBufferArchive(FX_STRSIZE size) : IFX_BufferArchive(size) , m_pFile(NULL) - , m_bTakeover(false) + , m_bTakeover(FALSE) { } CFX_FileBufferArchive::~CFX_FileBufferArchive() @@ -501,58 +501,58 @@ void CFX_FileBufferArchive::Clear() m_pFile->Release(); } m_pFile = NULL; - m_bTakeover = false; + m_bTakeover = FALSE; IFX_BufferArchive::Clear(); } -bool CFX_FileBufferArchive::AttachFile(IFX_StreamWrite *pFile, bool bTakeover ) +FX_BOOL CFX_FileBufferArchive::AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover ) { if (!pFile) { - return false; + return FALSE; } if (m_pFile && m_bTakeover) { m_pFile->Release(); } m_pFile = pFile; m_bTakeover = bTakeover; - return true; + return TRUE; } -bool CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) +FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) { if (!filename) { - return false; + return FALSE; } if (m_pFile && m_bTakeover) { m_pFile->Release(); } m_pFile = FX_CreateFileWrite(filename); if (!m_pFile) { - return false; + return FALSE; } - m_bTakeover = true; - return true; + m_bTakeover = TRUE; + return TRUE; } -bool CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) +FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) { if (!filename) { - return false; + return FALSE; } if (m_pFile && m_bTakeover) { m_pFile->Release(); } m_pFile = FX_CreateFileWrite(filename); if (!m_pFile) { - return false; + return FALSE; } - m_bTakeover = true; - return true; + m_bTakeover = TRUE; + return TRUE; } -bool CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) +FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { if (!m_pFile) { - return false; + return FALSE; } if (!pBuf || size < 1) { - return true; + return TRUE; } return m_pFile->WriteBlock(pBuf, size); } diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index 22b9bd4715..2e830809b8 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -45,15 +45,15 @@ void FX_RECT::Union(const FX_RECT& other_rect) bottom = bottom > other.bottom ? bottom : other.bottom; top = top < other.top ? top : other.top; } -bool GetIntersection(FX_FLOAT low1, FX_FLOAT high1, FX_FLOAT low2, FX_FLOAT high2, +FX_BOOL GetIntersection(FX_FLOAT low1, FX_FLOAT high1, FX_FLOAT low2, FX_FLOAT high2, FX_FLOAT& interlow, FX_FLOAT& interhigh) { if (low1 >= high2 || low2 >= high1) { - return false; + return FALSE; } interlow = low1 > low2 ? low1 : low2; interhigh = high1 > high2 ? high2 : high1; - return true; + return TRUE; } extern "C" int FXSYS_round(FX_FLOAT d) { @@ -198,18 +198,18 @@ FX_RECT CFX_FloatRect::GetClosestRect() const rect.Normalize(); return rect; } -bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const +FX_BOOL CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const { CFX_FloatRect n1 = *this; n1.Normalize(); CFX_FloatRect n2 = other_rect; n2.Normalize(); if (n2.left >= n1.left && n2.right <= n1.right && n2.bottom >= n1.bottom && n2.top <= n1.top) { - return true; + return TRUE; } - return false; + return FALSE; } -bool CFX_FloatRect::Contains(FX_FLOAT x, FX_FLOAT y) const +FX_BOOL CFX_FloatRect::Contains(FX_FLOAT x, FX_FLOAT y) const { CFX_FloatRect n1 = *this; n1.Normalize(); @@ -299,13 +299,13 @@ static void FXCRT_Matrix_Concat(CFX_Matrix &m, const CFX_Matrix &m1, const CFX_M FX_FLOAT ff = m1.e * m2.b + m1.f * m2.d + m2.f; m.a = aa, m.b = bb, m.c = cc, m.d = dd, m.e = ee, m.f = ff; } -void CFX_Matrix::Concat(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, bool bPrepended) +void CFX_Matrix::Concat(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, FX_BOOL bPrepended) { CFX_Matrix m; m.Set(a, b, c, d, e, f); Concat(m, bPrepended); } -void CFX_Matrix::Concat(const CFX_Matrix &m, bool bPrepended) +void CFX_Matrix::Concat(const CFX_Matrix &m, FX_BOOL bPrepended) { if (bPrepended) { FXCRT_Matrix_Concat(*this, m, *this); @@ -313,25 +313,25 @@ void CFX_Matrix::Concat(const CFX_Matrix &m, bool bPrepended) FXCRT_Matrix_Concat(*this, *this, m); } } -void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, bool bPrepended) +void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, FX_BOOL bPrepended) { CFX_Matrix m; m.SetReverse(src); Concat(m, bPrepended); } -bool CFX_Matrix::IsInvertible() const +FX_BOOL CFX_Matrix::IsInvertible() const { return FXSYS_fabs(a * d - b * c) >= 0.0001f; } -bool CFX_Matrix::Is90Rotated() const +FX_BOOL CFX_Matrix::Is90Rotated() const { return FXSYS_fabs(a * 1000) < FXSYS_fabs(b) && FXSYS_fabs(d * 1000) < FXSYS_fabs(c); } -bool CFX_Matrix::IsScaled() const +FX_BOOL CFX_Matrix::IsScaled() const { return FXSYS_fabs(b * 1000) < FXSYS_fabs(a) && FXSYS_fabs(c * 1000) < FXSYS_fabs(d); } -void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) +void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended) { if (bPrepended) { e += x * a + y * c; @@ -340,7 +340,7 @@ void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) e += x, f += y; } } -void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) +void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended) { a *= sx, d *= sy; if (bPrepended) { @@ -353,7 +353,7 @@ void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) f *= sy; } } -void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) +void CFX_Matrix::Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended) { FX_FLOAT cosValue = FXSYS_cos(fRadian); FX_FLOAT sinValue = FXSYS_sin(fRadian); @@ -365,13 +365,13 @@ void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) FXCRT_Matrix_Concat(*this, *this, m); } } -void CFX_Matrix::RotateAt(FX_FLOAT fRadian, FX_FLOAT dx, FX_FLOAT dy, bool bPrepended) +void CFX_Matrix::RotateAt(FX_FLOAT fRadian, FX_FLOAT dx, FX_FLOAT dy, FX_BOOL bPrepended) { Translate(dx, dy, bPrepended); Rotate(fRadian, bPrepended); Translate(-dx, -dy, bPrepended); } -void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, bool bPrepended) +void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, FX_BOOL bPrepended) { CFX_Matrix m; m.Set(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0); diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index 562f741d41..2497c74a8e 100644 --- a/core/src/fxcrt/fx_basic_gcc.cpp +++ b/core/src/fxcrt/fx_basic_gcc.cpp @@ -12,12 +12,12 @@ template <class T, class STR_T> T FXSYS_StrToInt(STR_T str) { - bool neg = false; + FX_BOOL neg = FALSE; if (str == NULL) { return 0; } if (*str == '-') { - neg = true; + neg = TRUE; str ++; } T num = 0; diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index 7de7b614f4..e34acb088d 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -69,15 +69,15 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, void rKey = pAssocRet->key; rValue = pAssocRet->value; } -bool CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const +FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { FX_DWORD nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (pAssoc == NULL) { - return false; + return FALSE; } rValue = pAssoc->value; - return true; + return TRUE; } void* CFX_MapPtrToPtr::GetValueAt(void* key) const { @@ -140,7 +140,7 @@ CFX_MapPtrToPtr::NewAssoc() return pAssoc; } void CFX_MapPtrToPtr::InitHashTable( - FX_DWORD nHashSize, bool bAllocNow) + FX_DWORD nHashSize, FX_BOOL bAllocNow) { ASSERT(m_nCount == 0); ASSERT(nHashSize > 0); @@ -153,10 +153,10 @@ void CFX_MapPtrToPtr::InitHashTable( } m_nHashTableSize = nHashSize; } -bool CFX_MapPtrToPtr::RemoveKey(void* key) +FX_BOOL CFX_MapPtrToPtr::RemoveKey(void* key) { if (m_pHashTable == NULL) { - return false; + return FALSE; } CAssoc** ppAssocPrev; ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize]; @@ -165,11 +165,11 @@ bool CFX_MapPtrToPtr::RemoveKey(void* key) if (pAssoc->key == key) { *ppAssocPrev = pAssoc->pNext; FreeAssoc(pAssoc); - return true; + return TRUE; } ppAssocPrev = &pAssoc->pNext; } - return false; + return FALSE; } void CFX_MapPtrToPtr::FreeAssoc(CFX_MapPtrToPtr::CAssoc* pAssoc) { @@ -325,18 +325,18 @@ CFX_MapByteStringToPtr::GetAssocAt(const CFX_ByteStringC& key, FX_DWORD& nHash) } return NULL; } -bool CFX_MapByteStringToPtr::Lookup(const CFX_ByteStringC& key, void*& rValue) const +FX_BOOL CFX_MapByteStringToPtr::Lookup(const CFX_ByteStringC& key, void*& rValue) const { FX_DWORD nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (pAssoc == NULL) { - return false; + return FALSE; } rValue = pAssoc->value; - return true; + return TRUE; } void CFX_MapByteStringToPtr::InitHashTable( - FX_DWORD nHashSize, bool bAllocNow) + FX_DWORD nHashSize, FX_BOOL bAllocNow) { ASSERT(m_nCount == 0); ASSERT(nHashSize > 0); @@ -359,10 +359,10 @@ inline FX_DWORD CFX_MapByteStringToPtr::HashKey(const CFX_ByteStringC& key) cons } return nHash; } -bool CFX_MapByteStringToPtr::RemoveKey(const CFX_ByteStringC& key) +FX_BOOL CFX_MapByteStringToPtr::RemoveKey(const CFX_ByteStringC& key) { if (m_pHashTable == NULL) { - return false; + return FALSE; } CAssoc** ppAssocPrev; ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize]; @@ -371,11 +371,11 @@ bool CFX_MapByteStringToPtr::RemoveKey(const CFX_ByteStringC& key) if (pAssoc->key == key) { *ppAssocPrev = pAssoc->pNext; FreeAssoc(pAssoc); - return true; + return TRUE; } ppAssocPrev = &pAssoc->pNext; } - return false; + return FALSE; } struct _CompactString { uint8_t m_CompactLen; @@ -390,16 +390,16 @@ static void _CompactStringRelease(_CompactString* pCompact) FX_Free(pCompact->m_pBuffer); } } -static bool _CompactStringSame(_CompactString* pCompact, const uint8_t* pStr, int len) +static FX_BOOL _CompactStringSame(_CompactString* pCompact, const uint8_t* pStr, int len) { if (len < sizeof(_CompactString)) { if (pCompact->m_CompactLen != len) { - return false; + return FALSE; } return FXSYS_memcmp(&pCompact->m_LenHigh, pStr, len) == 0; } if (pCompact->m_CompactLen != 0xff || pCompact->m_LenHigh * 256 + pCompact->m_LenLow != len) { - return false; + return FALSE; } return FXSYS_memcmp(pCompact->m_pBuffer, pStr, len) == 0; } @@ -497,18 +497,18 @@ void* CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const rNextPosition = NULL; return rValue; } -bool _CMapLookupCallback(void* param, void* pData) +FX_BOOL _CMapLookupCallback(void* param, void* pData) { return !_CompactStringSame((_CompactString*)pData, ((CFX_ByteStringC*)param)->GetPtr(), ((CFX_ByteStringC*)param)->GetLength()); } -bool CFX_CMapByteStringToPtr::Lookup(const CFX_ByteStringC& key, void*& rValue) const +FX_BOOL CFX_CMapByteStringToPtr::Lookup(const CFX_ByteStringC& key, void*& rValue) const { void* p = m_Buffer.Iterate(_CMapLookupCallback, (void*)&key); if (!p) { - return false; + return FALSE; } rValue = *(void**)((_CompactString*)p + 1); - return true; + return TRUE; } void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) { @@ -579,15 +579,15 @@ struct _DWordPair { FX_DWORD key; FX_DWORD value; }; -bool CFX_CMapDWordToDWord::Lookup(FX_DWORD key, FX_DWORD& value) const +FX_BOOL CFX_CMapDWordToDWord::Lookup(FX_DWORD key, FX_DWORD& value) const { void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_DWordPair), sizeof(_DWordPair), _CompareDWord); if (pResult == NULL) { - return false; + return FALSE; } value = ((FX_DWORD*)pResult)[1]; - return true; + return TRUE; } FX_POSITION CFX_CMapDWordToDWord::GetStartPosition() const { diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index 1343374111..26eeacce1b 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -26,7 +26,7 @@ void FX_PRIVATEDATA::FreeData() m_pCallback(m_pData); } } -void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback, bool bSelfDestruct) +void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct) { if (pModuleId == NULL) { return; @@ -46,26 +46,26 @@ void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA } void CFX_PrivateData::SetPrivateData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback) { - AddData(pModuleId, pData, callback, false); + AddData(pModuleId, pData, callback, FALSE); } void CFX_PrivateData::SetPrivateObj(void* pModuleId, CFX_DestructObject* pObj) { - AddData(pModuleId, pObj, NULL, true); + AddData(pModuleId, pObj, NULL, TRUE); } -bool CFX_PrivateData::RemovePrivateData(void* pModuleId) +FX_BOOL CFX_PrivateData::RemovePrivateData(void* pModuleId) { if (pModuleId == NULL) { - return false; + return FALSE; } FX_PRIVATEDATA* pList = m_DataList.GetData(); int count = m_DataList.GetSize(); for (int i = 0; i < count; i ++) { if (pList[i].m_pModuleId == pModuleId) { m_DataList.RemoveAt(i); - return true; + return TRUE; } } - return false; + return FALSE; } void* CFX_PrivateData::GetPrivateData(void* pModuleId) { @@ -90,18 +90,18 @@ void CFX_PrivateData::ClearAll() } m_DataList.RemoveAll(); } -void FX_atonum(const CFX_ByteStringC& strc, bool& bInteger, void* pData) +void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { if (FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength()) == NULL) { - bInteger = true; + bInteger = TRUE; int cc = 0, integer = 0; const FX_CHAR* str = strc.GetCStr(); int len = strc.GetLength(); - bool bNegative = false; + FX_BOOL bNegative = FALSE; if (str[0] == '+') { cc++; } else if (str[0] == '-') { - bNegative = true; + bNegative = TRUE; cc++; } while (cc < len) { @@ -119,7 +119,7 @@ void FX_atonum(const CFX_ByteStringC& strc, bool& bInteger, void* pData) } *(int*)pData = integer; } else { - bInteger = false; + bInteger = FALSE; *(FX_FLOAT*)pData = FX_atof(strc); } } @@ -129,13 +129,13 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) return 0.0; } int cc = 0; - bool bNegative = false; + FX_BOOL bNegative = FALSE; const FX_CHAR* str = strc.GetCStr(); int len = strc.GetLength(); if (str[0] == '+') { cc++; } else if (str[0] == '-') { - bNegative = true; + bNegative = TRUE; cc++; } while (cc < len) { @@ -187,13 +187,13 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap) } #endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900 -static bool FX_IsDigit(uint8_t ch) +static FX_BOOL FX_IsDigit(uint8_t ch) { - return (ch >= '0' && ch <= '9') ? true : false; + return (ch >= '0' && ch <= '9') ? TRUE : FALSE; } -static bool FX_IsXDigit(uint8_t ch) +static FX_BOOL FX_IsXDigit(uint8_t ch) { - return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? true : false; + return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? TRUE : FALSE; } static uint8_t FX_MakeUpper(uint8_t ch) { @@ -299,7 +299,7 @@ class CFindFileData public: virtual ~CFindFileData() {} HANDLE m_Handle; - bool m_bEnd; + FX_BOOL m_bEnd; }; class CFindFileDataA : public CFindFileData { @@ -332,7 +332,7 @@ void* FX_OpenFolder(const FX_CHAR* path) delete pData; return NULL; } - pData->m_bEnd = false; + pData->m_bEnd = FALSE; return pData; #else DIR* dir = opendir(path); @@ -352,82 +352,82 @@ void* FX_OpenFolder(const FX_WCHAR* path) delete pData; return NULL; } - pData->m_bEnd = false; + pData->m_bEnd = FALSE; return pData; #else DIR* dir = opendir(CFX_ByteString::FromUnicode(path)); return dir; #endif } -bool FX_GetNextFile(void* handle, CFX_ByteString& filename, bool& bFolder) +FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder) { if (handle == NULL) { - return false; + return FALSE; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifndef _WIN32_WCE CFindFileDataA* pData = (CFindFileDataA*)handle; if (pData->m_bEnd) { - return false; + return FALSE; } filename = pData->m_FindData.cFileName; bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; if (!FindNextFileA(pData->m_Handle, &pData->m_FindData)) { - pData->m_bEnd = true; + pData->m_bEnd = TRUE; } - return true; + return TRUE; #else CFindFileDataW* pData = (CFindFileDataW*)handle; if (pData->m_bEnd) { - return false; + return FALSE; } filename = CFX_ByteString::FromUnicode(pData->m_FindData.cFileName); bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; if (!FindNextFileW(pData->m_Handle, &pData->m_FindData)) { - pData->m_bEnd = true; + pData->m_bEnd = TRUE; } - return true; + return TRUE; #endif #elif defined(__native_client__) abort(); - return false; + return FALSE; #else struct dirent *de = readdir((DIR*)handle); if (de == NULL) { - return false; + return FALSE; } filename = de->d_name; bFolder = de->d_type == DT_DIR; - return true; + return TRUE; #endif } -bool FX_GetNextFile(void* handle, CFX_WideString& filename, bool& bFolder) +FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder) { if (handle == NULL) { - return false; + return FALSE; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ CFindFileDataW* pData = (CFindFileDataW*)handle; if (pData->m_bEnd) { - return false; + return FALSE; } filename = pData->m_FindData.cFileName; bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; if (!FindNextFileW(pData->m_Handle, &pData->m_FindData)) { - pData->m_bEnd = true; + pData->m_bEnd = TRUE; } - return true; + return TRUE; #elif defined(__native_client__) abort(); - return false; + return FALSE; #else struct dirent *de = readdir((DIR*)handle); if (de == NULL) { - return false; + return FALSE; } filename = CFX_WideString::FromLocal(de->d_name); bFolder = de->d_type == DT_DIR; - return true; + return TRUE; #endif } void FX_CloseFolder(void* handle) diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index bb236ac21b..b6b595588d 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -980,11 +980,11 @@ FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) return 0.0; } int cc = 0; - bool bNegative = false; + FX_BOOL bNegative = FALSE; if (str[0] == '+') { cc++; } else if (str[0] == '-') { - bNegative = true; + bNegative = TRUE; cc++; } int integer = 0; diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index fe6f29f6a2..4662e8f893 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -72,12 +72,12 @@ size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szBuffer, FX FXSYS_assert(hFile != NULL); return ((IFXCRT_FileAccess*)hFile)->WritePos(pBuffer, szBuffer, pos); } -bool FX_File_Flush(FX_HFILE hFile) +FX_BOOL FX_File_Flush(FX_HFILE hFile) { FXSYS_assert(hFile != NULL); return ((IFXCRT_FileAccess*)hFile)->Flush(); } -bool FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile) +FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile) { FXSYS_assert(hFile != NULL); return ((IFXCRT_FileAccess*)hFile)->Truncate(szFile); @@ -122,11 +122,11 @@ IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } -IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t dwSize, bool bTakeOver) +IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t dwSize, FX_BOOL bTakeOver) { return new CFX_MemoryStream(pBuffer, dwSize, bTakeOver); } -IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive) +IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive) { return new CFX_MemoryStream(bConsecutive); } @@ -160,10 +160,10 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t *pUsedLen return 0.0f; } int32_t iUsedLen = 0; - bool bNegtive = false; + FX_BOOL bNegtive = FALSE; switch (pwsStr[iUsedLen]) { case '-': - bNegtive = true; + bNegtive = TRUE; case '+': iUsedLen++; break; @@ -230,7 +230,7 @@ int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, bool bIgnoreCase) +FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { @@ -249,7 +249,7 @@ FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, bool bIgn } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, bool bIgnoreCase) +FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { @@ -283,7 +283,7 @@ void* FX_Random_MT_Start(FX_DWORD dwSeed) for (i = 1; i < MT_N; i ++) { pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i); } - pContext->bHaveSeed = true; + pContext->bHaveSeed = TRUE; return pContext; } FX_DWORD FX_Random_MT_Generate(void* pContext) @@ -347,8 +347,8 @@ void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) do { ::GetSystemTime(&st2); } while (FXSYS_memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0); - FX_DWORD dwHash1 = FX_HashCode_String_GetA((const FX_CHAR*)&st1, sizeof(st1), true); - FX_DWORD dwHash2 = FX_HashCode_String_GetA((const FX_CHAR*)&st2, sizeof(st2), true); + FX_DWORD dwHash1 = FX_HashCode_String_GetA((const FX_CHAR*)&st1, sizeof(st1), TRUE); + FX_DWORD dwHash2 = FX_HashCode_String_GetA((const FX_CHAR*)&st2, sizeof(st2), TRUE); ::srand((dwHash1 << 16) | (FX_DWORD)dwHash2); #else time_t tmLast = time(NULL), tmCur; @@ -360,15 +360,15 @@ void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -bool FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) +FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || hCP == NULL) { - return false; + return FALSE; } ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer); ::CryptReleaseContext(hCP, 0); - return true; + return TRUE; } #endif void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) diff --git a/core/src/fxcrt/fx_unicode.cpp b/core/src/fxcrt/fx_unicode.cpp index 1d63da93aa..d66a58a9b3 100644 --- a/core/src/fxcrt/fx_unicode.cpp +++ b/core/src/fxcrt/fx_unicode.cpp @@ -13,27 +13,27 @@ FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) { return gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; } -bool FX_IsCtrlCode(FX_WCHAR ch) +FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) { FX_DWORD dwRet = (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & FX_CHARTYPEBITSMASK); return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; } -bool FX_IsRotationCode(FX_WCHAR ch) +FX_BOOL FX_IsRotationCode(FX_WCHAR ch) { return (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & 0x8000) != 0; } -bool FX_IsCombinationChar(FX_WCHAR wch) +FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) { FX_DWORD dwProps = (gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK); return dwProps == FX_CHARTYPE_Combination; } -bool FX_IsBidiChar(FX_WCHAR wch) +FX_BOOL FX_IsBidiChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls); } -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) +FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; FX_DWORD dwTemp = (dwProps & 0xFF800000); @@ -49,7 +49,7 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) } return wch; } -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, bool bRTL, bool bVertical) +FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, FX_BOOL bRTL, FX_BOOL bVertical) { FX_DWORD dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 73695a6ec8..dcf91d1a97 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -12,34 +12,34 @@ CXML_Parser::~CXML_Parser() m_pDataAcc->Release(); } } -bool CXML_Parser::Init(uint8_t* pBuffer, size_t size) +FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) { m_pDataAcc = new CXML_DataBufAcc(pBuffer, size); - return Init(true); + return Init(TRUE); } -bool CXML_Parser::Init(IFX_FileRead *pFileRead) +FX_BOOL CXML_Parser::Init(IFX_FileRead *pFileRead) { m_pDataAcc = new CXML_DataStmAcc(pFileRead); - return Init(true); + return Init(TRUE); } -bool CXML_Parser::Init(IFX_BufferRead *pBuffer) +FX_BOOL CXML_Parser::Init(IFX_BufferRead *pBuffer) { if (!pBuffer) { - return false; + return FALSE; } m_pDataAcc = pBuffer; - return Init(false); + return Init(FALSE); } -bool CXML_Parser::Init(bool bOwndedStream) +FX_BOOL CXML_Parser::Init(FX_BOOL bOwndedStream) { m_bOwnedStream = bOwndedStream; m_nOffset = 0; return ReadNextBlock(); } -bool CXML_Parser::ReadNextBlock() +FX_BOOL CXML_Parser::ReadNextBlock() { if (!m_pDataAcc->ReadNextBlock()) { - return false; + return FALSE; } m_pBuffer = m_pDataAcc->GetBlockBuffer(); m_dwBufferSize = m_pDataAcc->GetBlockSize(); @@ -47,10 +47,10 @@ bool CXML_Parser::ReadNextBlock() m_dwIndex = 0; return m_dwBufferSize > 0; } -bool CXML_Parser::IsEOF() +FX_BOOL CXML_Parser::IsEOF() { if (!m_pDataAcc->IsEOF()) { - return false; + return FALSE; } return m_dwIndex >= m_dwBufferSize; } @@ -82,27 +82,27 @@ uint8_t g_FXCRT_XML_ByteTypes[256] = { 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x01, 0x01, }; -bool g_FXCRT_XML_IsWhiteSpace(uint8_t ch) +FX_BOOL g_FXCRT_XML_IsWhiteSpace(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar) != 0; } -bool g_FXCRT_XML_IsLetter(uint8_t ch) +FX_BOOL g_FXCRT_XML_IsLetter(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Letter) != 0; } -bool g_FXCRT_XML_IsDigital(uint8_t ch) +FX_BOOL g_FXCRT_XML_IsDigital(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital) != 0; } -bool g_FXCRT_XML_IsNameIntro(uint8_t ch) +FX_BOOL g_FXCRT_XML_IsNameIntro(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro) != 0; } -bool g_FXCRT_XML_IsNameChar(uint8_t ch) +FX_BOOL g_FXCRT_XML_IsNameChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar) != 0; } -bool g_FXCRT_XML_IsHexChar(uint8_t ch) +FX_BOOL g_FXCRT_XML_IsHexChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar) != 0; } @@ -310,13 +310,13 @@ void CXML_Parser::GetAttrValue(CFX_WideString &value) } while (ReadNextBlock()); value = decoder.GetResult(); } -void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, bool &bEndTag, bool bStartTag) +void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOOL &bEndTag, FX_BOOL bStartTag) { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { return; } - bEndTag = false; + bEndTag = FALSE; uint8_t ch; int32_t iState = bStartTag ? 1 : 0; do { @@ -345,10 +345,10 @@ void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, bool & if (ch == '/') { m_dwIndex ++; GetName(space, name); - bEndTag = true; + bEndTag = TRUE; } else { GetName(space, name); - bEndTag = false; + bEndTag = FALSE; } return; } @@ -359,14 +359,14 @@ void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, bool & } } while (ReadNextBlock()); } -CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, bool bStartTag) +CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag) { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { return NULL; } CFX_ByteString tag_name, tag_space; - bool bEndTag; + FX_BOOL bEndTag; GetTagName(tag_space, tag_name, bEndTag, bStartTag); if (tag_name.IsEmpty() || bEndTag) { return NULL; @@ -427,7 +427,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, bool bStartTag) } CFX_UTF8Decoder decoder; CFX_WideTextBuf content; - bool bCDATA = false; + FX_BOOL bCDATA = FALSE; int32_t iState = 0; do { while (m_dwIndex < m_dwBufferSize) { @@ -465,10 +465,10 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, bool bStartTag) InsertContentSegment(bCDATA, dataStr, pElement); content.Clear(); decoder.Clear(); - bCDATA = false; + bCDATA = FALSE; iState = 0; m_dwIndex --; - CXML_Element* pSubElement = ParseElement(pElement, true); + CXML_Element* pSubElement = ParseElement(pElement, TRUE); if (pSubElement == NULL) { break; } @@ -509,10 +509,10 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, bool bStartTag) InsertContentSegment(bCDATA, dataStr, pElement); content.Clear(); decoder.Clear(); - bCDATA = false; + bCDATA = FALSE; return pElement; } -void CXML_Parser::InsertContentSegment(bool bCDATA, const CFX_WideStringC& content, CXML_Element* pElement) +void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, const CFX_WideStringC& content, CXML_Element* pElement) { if (content.IsEmpty()) { return; @@ -522,16 +522,16 @@ void CXML_Parser::InsertContentSegment(bool bCDATA, const CFX_WideStringC& conte pElement->m_Children.Add((void*)CXML_Element::Content); pElement->m_Children.Add(pContent); } -static CXML_Element* XML_ContinueParse(CXML_Parser &parser, bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) +static CXML_Element* XML_ContinueParse(CXML_Parser &parser, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { parser.m_bSaveSpaceChars = bSaveSpaceChars; - CXML_Element* pElement = parser.ParseElement(NULL, false); + CXML_Element* pElement = parser.ParseElement(NULL, FALSE); if (pParsedSize) { *pParsedSize = parser.m_nOffset; } return pElement; } -CXML_Element* CXML_Element::Parse(const void* pBuffer, size_t size, bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) +CXML_Element* CXML_Element::Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; if (!parser.Init((uint8_t*)pBuffer, size)) { @@ -539,7 +539,7 @@ CXML_Element* CXML_Element::Parse(const void* pBuffer, size_t size, bool bSaveSp } return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); } -CXML_Element* CXML_Element::Parse(IFX_FileRead *pFile, bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) +CXML_Element* CXML_Element::Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; if (!parser.Init(pFile)) { @@ -547,7 +547,7 @@ CXML_Element* CXML_Element::Parse(IFX_FileRead *pFile, bool bSaveSpaceChars, FX_ } return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); } -CXML_Element* CXML_Element::Parse(IFX_BufferRead *pBuffer, bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) +CXML_Element* CXML_Element::Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; if (!parser.Init(pBuffer)) { @@ -600,7 +600,7 @@ void CXML_Element::RemoveChildren() } m_Children.RemoveAll(); } -CFX_ByteString CXML_Element::GetTagName(bool bQualified) const +CFX_ByteString CXML_Element::GetTagName(FX_BOOL bQualified) const { if (!bQualified || m_QSpaceName.IsEmpty()) { return m_TagName; @@ -610,7 +610,7 @@ CFX_ByteString CXML_Element::GetTagName(bool bQualified) const bsTag += m_TagName; return bsTag; } -CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const +CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const { if (bQualified) { return m_QSpaceName; @@ -644,61 +644,61 @@ void CXML_Element::GetAttrByIndex(int index, CFX_ByteString& space, CFX_ByteStri name = item.m_AttrName; value = item.m_Value; } -bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const +FX_BOOL CXML_Element::HasAttr(const CFX_ByteStringC& name) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return m_AttrMap.Lookup(bsSpace, bsName) != NULL; } -bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const +FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return GetAttrValue(bsSpace, bsName, attribute); } -bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const +FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); if (pValue) { attribute = *pValue; - return true; + return TRUE; } - return false; + return FALSE; } -bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const +FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); const CFX_WideString* pwsValue = m_AttrMap.Lookup(bsSpace, bsName); if (pwsValue) { attribute = pwsValue->GetInteger(); - return true; + return TRUE; } - return false; + return FALSE; } -bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name, int& attribute) const +FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name, int& attribute) const { const CFX_WideString* pwsValue = m_AttrMap.Lookup(space, name); if (pwsValue) { attribute = pwsValue->GetInteger(); - return true; + return TRUE; } - return false; + return FALSE; } -bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const +FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return GetAttrFloat(bsSpace, bsName, attribute); } -bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const +FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); if (pValue) { attribute = pValue->GetFloat(); - return true; + return TRUE; } - return false; + return FALSE; } FX_DWORD CXML_Element::CountChildren() const { diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 813af02ce4..e7182943be 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -40,20 +40,20 @@ CFXCRT_FileAccess_CRT::~CFXCRT_FileAccess_CRT() { Close(); } -bool CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { - return false; + return FALSE; } CFX_ByteString strMode; FXCRT_GetFileModeString(dwMode, strMode); m_hFile = FXSYS_fopen(fileName.GetCStr(), strMode.c_str()); return m_hFile != NULL; } -bool CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { - return false; + return FALSE; } CFX_WideString strMode; FXCRT_GetFileModeString(dwMode, strMode); @@ -128,45 +128,45 @@ size_t CFXCRT_FileAccess_CRT::WritePos(const void* pBuffer, size_t szBuffer, FX_ FXSYS_fseek(m_hFile, pos, FXSYS_SEEK_SET); return FXSYS_fwrite(pBuffer, 1, szBuffer, m_hFile); } -bool CFXCRT_FileAccess_CRT::Flush() +FX_BOOL CFXCRT_FileAccess_CRT::Flush() { if (!m_hFile) { - return false; + return FALSE; } return !FXSYS_fflush(m_hFile); } -bool CFXCRT_FileAccess_CRT::Truncate(FX_FILESIZE szFile) +FX_BOOL CFXCRT_FileAccess_CRT::Truncate(FX_FILESIZE szFile) { - return false; + return FALSE; } -bool FX_File_Exist(const CFX_ByteStringC& fileName) +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { return access(fileName.GetCStr(), F_OK) > -1; } -bool FX_File_Exist(const CFX_WideStringC& fileName) +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { return FX_File_Exist(FX_UTF8Encode(fileName)); } -bool FX_File_Delete(const CFX_ByteStringC& fileName) +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return remove(fileName.GetCStr()) > -1; } -bool FX_File_Delete(const CFX_WideStringC& fileName) +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return FX_File_Delete(FX_UTF8Encode(fileName)); } -bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { CFXCRT_FileAccess_CRT src, dst; if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) { - return false; + return FALSE; } FX_FILESIZE size = src.GetSize(); if (!size) { - return false; + return FALSE; } if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) { - return false; + return FALSE; } FX_FILESIZE num = 0; uint8_t* pBuffer = FX_Alloc(uint8_t, 32768); @@ -176,17 +176,17 @@ bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fil } } FX_Free(pBuffer); - return true; + return TRUE; } -bool FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } -bool FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); } -bool FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } diff --git a/core/src/fxcrt/fxcrt_platforms.h b/core/src/fxcrt/fxcrt_platforms.h index d95ae4f376..4fd0588c94 100644 --- a/core/src/fxcrt/fxcrt_platforms.h +++ b/core/src/fxcrt/fxcrt_platforms.h @@ -17,8 +17,8 @@ class CFXCRT_FileAccess_CRT : public IFXCRT_FileAccess public: CFXCRT_FileAccess_CRT(); virtual ~CFXCRT_FileAccess_CRT(); - virtual bool Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); - virtual bool Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); virtual void Close(); virtual void Release(); virtual FX_FILESIZE GetSize() const; @@ -28,8 +28,8 @@ public: virtual size_t Write(const void* pBuffer, size_t szBuffer); virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos); virtual size_t WritePos(const void* pBuffer, size_t szBuffer, FX_FILESIZE pos); - virtual bool Flush(); - virtual bool Truncate(FX_FILESIZE szFile); + virtual FX_BOOL Flush(); + virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: FXSYS_FILE* m_hFile; }; diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index eb7213e5b0..84646efd5c 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -34,17 +34,17 @@ CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix() { Close(); } -bool CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_nFD > -1) { - return false; + return FALSE; } int32_t nFlags, nMasks; FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks); m_nFD = open(fileName.GetCStr(), nFlags, nMasks); return m_nFD > -1; } -bool CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { return Open(FX_UTF8Encode(fileName), dwMode); } @@ -121,48 +121,48 @@ size_t CFXCRT_FileAccess_Posix::WritePos(const void* pBuffer, size_t szBuffer, F } return Write(pBuffer, szBuffer); } -bool CFXCRT_FileAccess_Posix::Flush() +FX_BOOL CFXCRT_FileAccess_Posix::Flush() { if (m_nFD < 0) { - return false; + return FALSE; } return fsync(m_nFD) > -1; } -bool CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) +FX_BOOL CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) { if (m_nFD < 0) { - return false; + return FALSE; } return !ftruncate(m_nFD, szFile); } -bool FX_File_Exist(const CFX_ByteStringC& fileName) +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { return access(fileName.GetCStr(), F_OK) > -1; } -bool FX_File_Exist(const CFX_WideStringC& fileName) +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { return FX_File_Exist(FX_UTF8Encode(fileName)); } -bool FX_File_Delete(const CFX_ByteStringC& fileName) +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return remove(fileName.GetCStr()) > -1; } -bool FX_File_Delete(const CFX_WideStringC& fileName) +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return FX_File_Delete(FX_UTF8Encode(fileName)); } -bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { CFXCRT_FileAccess_Posix src, dst; if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) { - return false; + return FALSE; } FX_FILESIZE size = src.GetSize(); if (!size) { - return false; + return FALSE; } if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) { - return false; + return FALSE; } size_t num = 0; uint8_t* pBuffer = FX_Alloc(uint8_t, 32768); @@ -174,17 +174,17 @@ bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fil num = src.Read(pBuffer, 32768); } FX_Free(pBuffer); - return true; + return TRUE; } -bool FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } -bool FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); } -bool FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } diff --git a/core/src/fxcrt/fxcrt_posix.h b/core/src/fxcrt/fxcrt_posix.h index 653a150aa8..39df1c8507 100644 --- a/core/src/fxcrt/fxcrt_posix.h +++ b/core/src/fxcrt/fxcrt_posix.h @@ -15,8 +15,8 @@ class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess public: CFXCRT_FileAccess_Posix(); virtual ~CFXCRT_FileAccess_Posix(); - virtual bool Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); - virtual bool Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); virtual void Close(); virtual void Release(); virtual FX_FILESIZE GetSize() const; @@ -26,8 +26,8 @@ public: virtual size_t Write(const void* pBuffer, size_t szBuffer); virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos); virtual size_t WritePos(const void* pBuffer, size_t szBuffer, FX_FILESIZE pos); - virtual bool Flush(); - virtual bool Truncate(FX_FILESIZE szFile); + virtual FX_BOOL Flush(); + virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: int32_t m_nFD; }; diff --git a/core/src/fxcrt/fxcrt_windows.cpp b/core/src/fxcrt/fxcrt_windows.cpp index 7effab6919..d4e3830cf2 100644 --- a/core/src/fxcrt/fxcrt_windows.cpp +++ b/core/src/fxcrt/fxcrt_windows.cpp @@ -8,19 +8,19 @@ #include "fxcrt_windows.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -bool FX_File_Exist(const CFX_ByteStringC& fileName) +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { FX_DWORD dwAttri = ::GetFileAttributesA(fileName.GetCStr()); if (dwAttri == -1) { - return false; + return FALSE; } return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; } -bool FX_File_Exist(const CFX_WideStringC& fileName) +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { FX_DWORD dwAttri = ::GetFileAttributesW((LPCWSTR)fileName.GetPtr()); if (dwAttri == -1) { - return false; + return FALSE; } return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; } @@ -55,10 +55,10 @@ CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { Close(); } -bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { - return false; + return FALSE; } FX_DWORD dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); @@ -68,10 +68,10 @@ bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, FX_DWORD dwM } return m_hFile != NULL; } -bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { - return false; + return FALSE; } FX_DWORD dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); @@ -174,41 +174,41 @@ size_t CFXCRT_FileAccess_Win64::WritePos(const void* pBuffer, size_t szBuffer, F } return Write(pBuffer, szBuffer); } -bool CFXCRT_FileAccess_Win64::Flush() +FX_BOOL CFXCRT_FileAccess_Win64::Flush() { if (!m_hFile) { - return false; + return FALSE; } return ::FlushFileBuffers(m_hFile); } -bool CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) +FX_BOOL CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) { if (SetPosition(szFile) == (FX_FILESIZE) - 1) { - return false; + return FALSE; } return ::SetEndOfFile(m_hFile); } -bool FX_File_Delete(const CFX_ByteStringC& fileName) +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return ::DeleteFileA(fileName.GetCStr()); } -bool FX_File_Delete(const CFX_WideStringC& fileName) +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return ::DeleteFileW((LPCWSTR)fileName.GetPtr()); } -bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { - return ::CopyFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr(), false); + return ::CopyFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr(), FALSE); } -bool FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { - return ::CopyFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr(), false); + return ::CopyFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr(), FALSE); } -bool FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return ::MoveFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); } -bool FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return ::MoveFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr()); } diff --git a/core/src/fxcrt/fxcrt_windows.h b/core/src/fxcrt/fxcrt_windows.h index 414b863a50..8dd2cddc82 100644 --- a/core/src/fxcrt/fxcrt_windows.h +++ b/core/src/fxcrt/fxcrt_windows.h @@ -15,8 +15,8 @@ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess public: CFXCRT_FileAccess_Win64(); virtual ~CFXCRT_FileAccess_Win64(); - virtual bool Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); - virtual bool Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); virtual void Close(); virtual void Release(); virtual FX_FILESIZE GetSize() const; @@ -26,8 +26,8 @@ public: virtual size_t Write(const void* pBuffer, size_t szBuffer); virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos); virtual size_t WritePos(const void* pBuffer, size_t szBuffer, FX_FILESIZE pos); - virtual bool Flush(); - virtual bool Truncate(FX_FILESIZE szFile); + virtual FX_BOOL Flush(); + virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: void* m_hFile; }; diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index ec8bdc2850..109c7a43d2 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -23,7 +23,7 @@ public: { delete this; } - virtual bool IsEOF() + virtual FX_BOOL IsEOF() { return m_dwCurPos >= m_dwSize; } @@ -35,16 +35,16 @@ public: { return 0; } - virtual bool ReadNextBlock(bool bRestart = false) + virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) { if (bRestart) { m_dwCurPos = 0; } if (m_dwCurPos < m_dwSize) { m_dwCurPos = m_dwSize; - return true; + return TRUE; } - return false; + return FALSE; } virtual const uint8_t* GetBlockBuffer() { @@ -85,7 +85,7 @@ public: { delete this; } - virtual bool IsEOF() + virtual FX_BOOL IsEOF() { return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize(); } @@ -97,7 +97,7 @@ public: { return 0; } - virtual bool ReadNextBlock(bool bRestart = false) + virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) { if (bRestart) { m_nStart = 0; @@ -105,7 +105,7 @@ public: FX_FILESIZE nLength = m_pFileRead->GetSize(); m_nStart += (FX_FILESIZE)m_dwSize; if (m_nStart >= nLength) { - return false; + return FALSE; } m_dwSize = (size_t)FX_MIN(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart); if (!m_pBuffer) { @@ -136,28 +136,28 @@ class CXML_Parser public: ~CXML_Parser(); IFX_BufferRead* m_pDataAcc; - bool m_bOwnedStream; + FX_BOOL m_bOwnedStream; FX_FILESIZE m_nOffset; - bool m_bSaveSpaceChars; + FX_BOOL m_bSaveSpaceChars; const uint8_t* m_pBuffer; size_t m_dwBufferSize; FX_FILESIZE m_nBufferOffset; size_t m_dwIndex; - bool Init(uint8_t* pBuffer, size_t size); - bool Init(IFX_FileRead *pFileRead); - bool Init(IFX_BufferRead *pBuffer); - bool Init(bool bOwndedStream); - bool ReadNextBlock(); - bool IsEOF(); - bool HaveAvailData(); + FX_BOOL Init(uint8_t* pBuffer, size_t size); + FX_BOOL Init(IFX_FileRead *pFileRead); + FX_BOOL Init(IFX_BufferRead *pBuffer); + FX_BOOL Init(FX_BOOL bOwndedStream); + FX_BOOL ReadNextBlock(); + FX_BOOL IsEOF(); + FX_BOOL HaveAvailData(); void SkipWhiteSpaces(); void GetName(CFX_ByteString& space, CFX_ByteString& name); void GetAttrValue(CFX_WideString &value); FX_DWORD GetCharRef(); - void GetTagName(CFX_ByteString &space, CFX_ByteString &name, bool &bEndTag, bool bStartTag = false); + void GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOOL &bEndTag, FX_BOOL bStartTag = FALSE); void SkipLiterals(const CFX_ByteStringC& str); - CXML_Element* ParseElement(CXML_Element* pParent, bool bStartTag = false); - void InsertContentSegment(bool bCDATA, const CFX_WideStringC& content, CXML_Element* pElement); + CXML_Element* ParseElement(CXML_Element* pParent, FX_BOOL bStartTag = FALSE); + void InsertContentSegment(FX_BOOL bCDATA, const CFX_WideStringC& content, CXML_Element* pElement); void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); }; void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteStringC &bsSpace, CFX_ByteStringC &bsName); |