diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:17:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:17:30 -0700 |
commit | 12f3e4a58f05850b93af35619cb04f0231d86acc (patch) | |
tree | 9851d8e46e5c168f5d148864caa2eebf814529dd /core/fxcrt | |
parent | 3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (diff) | |
download | pdfium-12f3e4a58f05850b93af35619cb04f0231d86acc.tar.xz |
Remove FX_BOOL from core
Review-Url: https://codereview.chromium.org/2477443002
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/extension.h | 16 | ||||
-rw-r--r-- | core/fxcrt/fx_arabic.cpp | 28 | ||||
-rw-r--r-- | core/fxcrt/fx_arabic.h | 4 | ||||
-rw-r--r-- | core/fxcrt/fx_basic.h | 66 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_array.cpp | 40 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_bstring.cpp | 4 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_coords.cpp | 38 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_maps.cpp | 16 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_util.cpp | 2 | ||||
-rw-r--r-- | core/fxcrt/fx_basic_wstring.cpp | 4 | ||||
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 34 | ||||
-rw-r--r-- | core/fxcrt/fx_ext.h | 2 | ||||
-rw-r--r-- | core/fxcrt/fx_extension.cpp | 34 | ||||
-rw-r--r-- | core/fxcrt/fx_stream.h | 8 | ||||
-rw-r--r-- | core/fxcrt/fx_ucd.h | 8 | ||||
-rw-r--r-- | core/fxcrt/fx_unicode.cpp | 8 | ||||
-rw-r--r-- | core/fxcrt/fx_xml.h | 44 | ||||
-rw-r--r-- | core/fxcrt/fx_xml_parser.cpp | 91 | ||||
-rw-r--r-- | core/fxcrt/fxcrt_stream.cpp | 2 | ||||
-rw-r--r-- | core/fxcrt/fxcrt_windows.cpp | 4 | ||||
-rw-r--r-- | core/fxcrt/xml_int.h | 14 |
21 files changed, 232 insertions, 235 deletions
diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h index 5b1801bb1b..ca2fc3c5b7 100644 --- a/core/fxcrt/extension.h +++ b/core/fxcrt/extension.h @@ -46,7 +46,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { void GetPath(CFX_WideString& wsPath) override; IFX_SeekableStream* CreateFileStream(uint32_t dwModes) override; - FX_BOOL Init(const CFX_WideStringC& wsPath); + bool Init(const CFX_WideStringC& wsPath); protected: CFX_WideString m_path; @@ -81,8 +81,8 @@ class CFX_CRTFileStream final : public IFX_SeekableStream { class CFX_MemoryStream final : public IFX_MemoryStream { public: - explicit CFX_MemoryStream(FX_BOOL bConsecutive); - CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver); + explicit CFX_MemoryStream(bool bConsecutive); + CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver); ~CFX_MemoryStream() override; // IFX_MemoryStream @@ -100,7 +100,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { uint8_t* GetBuffer() const override; void AttachBuffer(uint8_t* pBuffer, size_t nSize, - bool bTakeOver = FALSE) override; + bool bTakeOver = false) override; void DetachBuffer() override; protected: @@ -111,7 +111,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { size_t m_nCurPos; size_t m_nGrowSize; uint32_t m_dwFlags; - FX_BOOL ExpandBlocks(size_t size); + bool ExpandBlocks(size_t size); }; #ifdef __cplusplus @@ -125,14 +125,14 @@ extern "C" { struct FX_MTRANDOMCONTEXT { FX_MTRANDOMCONTEXT() { mti = MT_N + 1; - bHaveSeed = FALSE; + bHaveSeed = false; } uint32_t mti; - FX_BOOL bHaveSeed; + bool bHaveSeed; uint32_t mt[MT_N]; }; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); +bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index ee04f40ac8..d6b3c6522d 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -376,7 +376,7 @@ int32_t FX_BidiReorderLevel(int32_t iBaseLevel, CFX_WideString& wsText, const CFX_Int32Array& levels, int32_t iStart, - FX_BOOL bReverse) { + bool bReverse) { ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); ASSERT(wsText.GetLength() == levels.GetSize()); ASSERT(iStart >= 0 && iStart < wsText.GetLength()); @@ -412,7 +412,7 @@ void FX_BidiReorder(int32_t iBaseLevel, } int32_t i = 0; while (i < iSize) { - i += FX_BidiReorderLevel(iBaseLevel, wsText, levels, i, FALSE); + i += FX_BidiReorderLevel(iBaseLevel, wsText, levels, i, false); } } @@ -435,7 +435,7 @@ class CFX_BidiLineTemplate { } } void FX_BidiSetDeferredRun(CFX_ArrayTemplate<baseType>& chars, - FX_BOOL bClass, + bool bClass, int32_t iStart, int32_t iCount, int32_t iValue) { @@ -457,7 +457,7 @@ class CFX_BidiLineTemplate { } void FX_BidiClassify(CFX_ArrayTemplate<baseType>& chars, int32_t iCount, - FX_BOOL bWS) { + bool bWS) { ASSERT(iCount > -1 && iCount <= chars.GetSize()); baseType* pTC; if (bWS) { @@ -541,7 +541,7 @@ class CFX_BidiLineTemplate { iAction = gc_FX_BidiWeakActions[iState][iClsCur]; iClsRun = FX_BidiGetDeferredType(iAction); if (iClsRun != FX_BIDIWEAKACTION_XX && iNum > 0) { - FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun); + FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun); iNum = 0; } iClsNew = FX_BidiGetResolvedType(iAction); @@ -557,7 +557,7 @@ class CFX_BidiLineTemplate { iClsCur = FX_BidiDirection(iBaseLevel); iClsRun = FX_BidiGetDeferredType(gc_FX_BidiWeakActions[iState][iClsCur]); if (iClsRun != FX_BIDIWEAKACTION_XX) { - FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun); + FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun); } } } @@ -587,7 +587,7 @@ class CFX_BidiLineTemplate { iAction = gc_FX_BidiNeutralActions[iState][iClsCur]; iClsRun = FX_BidiGetDeferredNeutrals(iAction, iLevel); if (iClsRun != FX_BIDICLASS_N && iNum > 0) { - FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun); + FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun); iNum = 0; } iClsNew = FX_BidiGetResolvedNeutrals(iAction); @@ -605,7 +605,7 @@ class CFX_BidiLineTemplate { iClsRun = FX_BidiGetDeferredNeutrals( gc_FX_BidiNeutralActions[iState][iClsCur], iLevel); if (iClsRun != FX_BIDICLASS_N) { - FX_BidiSetDeferredRun(chars, TRUE, i, iNum, iClsRun); + FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun); } } } @@ -656,7 +656,7 @@ class CFX_BidiLineTemplate { case FX_BIDICLASS_S: case FX_BIDICLASS_B: if (iNum > 0) { - FX_BidiSetDeferredRun(chars, FALSE, i, iNum, iBaseLevel); + FX_BidiSetDeferredRun(chars, false, i, iNum, iBaseLevel); } pTC->m_iBidiLevel = (int16_t)iBaseLevel; iNum = 0; @@ -668,14 +668,14 @@ class CFX_BidiLineTemplate { iLevel = pTC->m_iBidiLevel; } if (iNum > 0) { - FX_BidiSetDeferredRun(chars, FALSE, i, iNum, iBaseLevel); + FX_BidiSetDeferredRun(chars, false, i, iNum, iBaseLevel); } } int32_t FX_BidiReorderLevel(CFX_ArrayTemplate<baseType>& chars, int32_t iCount, int32_t iBaseLevel, int32_t iStart, - FX_BOOL bReverse) { + bool bReverse) { ASSERT(iCount > -1 && iCount <= chars.GetSize()); ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); ASSERT(iStart >= 0 && iStart < iCount); @@ -708,7 +708,7 @@ class CFX_BidiLineTemplate { ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); int32_t i = 0; while (i < iCount) { - i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, FALSE); + i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, false); } } void FX_BidiPosition(CFX_ArrayTemplate<baseType>& chars, int32_t iCount) { @@ -729,12 +729,12 @@ class CFX_BidiLineTemplate { if (iCount < 2) { return; } - FX_BidiClassify(chars, iCount, FALSE); + FX_BidiClassify(chars, iCount, false); FX_BidiResolveExplicit(chars, iCount, iBaseLevel); FX_BidiResolveWeak(chars, iCount, iBaseLevel); FX_BidiResolveNeutrals(chars, iCount, iBaseLevel); FX_BidiResolveImplicit(chars, iCount); - FX_BidiClassify(chars, iCount, TRUE); + FX_BidiClassify(chars, iCount, true); FX_BidiResolveWhitespace(chars, iCount, iBaseLevel); FX_BidiReorder(chars, iCount, iBaseLevel); FX_BidiPosition(chars, iCount); diff --git a/core/fxcrt/fx_arabic.h b/core/fxcrt/fx_arabic.h index e20a261b00..1f4d38b888 100644 --- a/core/fxcrt/fx_arabic.h +++ b/core/fxcrt/fx_arabic.h @@ -36,7 +36,7 @@ void FX_BidiSetDeferredRun(CFX_Int32Array& values, int32_t iValue); void FX_BidiClassify(const CFX_WideString& wsText, CFX_Int32Array& classes, - FX_BOOL bWS = FALSE); + bool bWS = false); int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, int32_t iDirection, CFX_Int32Array& classes, @@ -180,7 +180,7 @@ int32_t FX_BidiReorderLevel(int32_t iBaseLevel, CFX_WideString& wsText, const CFX_Int32Array& levels, int32_t iStart, - FX_BOOL bReverse = FALSE); + bool bReverse = false); void FX_BidiReorder(int32_t iBaseLevel, CFX_WideString& wsText, const CFX_Int32Array& levels); diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 6643d33dce..9c8b4e146e 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -182,12 +182,12 @@ class CFX_BasicArray { CFX_BasicArray(const CFX_BasicArray&) = delete; ~CFX_BasicArray(); - FX_BOOL SetSize(int nNewSize); - FX_BOOL Append(const CFX_BasicArray& src); - FX_BOOL Copy(const CFX_BasicArray& src); + bool SetSize(int nNewSize); + bool Append(const CFX_BasicArray& src); + bool Copy(const CFX_BasicArray& src); uint8_t* InsertSpaceAt(int nIndex, int nCount); - FX_BOOL RemoveAt(int nIndex, int nCount); - FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); + bool RemoveAt(int nIndex, int nCount); + bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); const void* GetDataPtr(int index) const; protected: @@ -206,7 +206,7 @@ class CFX_ArrayTemplate : public CFX_BasicArray { int GetUpperBound() const { return m_nSize - 1; } - FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } + bool SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } void RemoveAll() { SetSize(0); } @@ -217,12 +217,12 @@ class CFX_ArrayTemplate : public CFX_BasicArray { return ((const TYPE*)m_pData)[nIndex]; } - FX_BOOL SetAt(int nIndex, TYPE newElement) { + bool SetAt(int nIndex, TYPE newElement) { if (nIndex < 0 || nIndex >= m_nSize) { - return FALSE; + return false; } ((TYPE*)m_pData)[nIndex] = newElement; - return TRUE; + return true; } TYPE& ElementAt(int nIndex) { @@ -236,34 +236,32 @@ class CFX_ArrayTemplate : public CFX_BasicArray { TYPE* GetData() { return (TYPE*)m_pData; } - FX_BOOL SetAtGrow(int nIndex, TYPE newElement) { + bool SetAtGrow(int nIndex, TYPE newElement) { if (nIndex < 0) - return FALSE; + return false; if (nIndex >= m_nSize && !SetSize(nIndex + 1)) - return FALSE; + return false; ((TYPE*)m_pData)[nIndex] = newElement; - return TRUE; + return true; } - FX_BOOL Add(TYPE newElement) { + bool Add(TYPE newElement) { if (m_nSize < m_nMaxSize) { m_nSize++; } else if (!SetSize(m_nSize + 1)) { - return FALSE; + return false; } ((TYPE*)m_pData)[m_nSize - 1] = newElement; - return TRUE; + return true; } - FX_BOOL Append(const CFX_ArrayTemplate& src) { + bool Append(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Append(src); } - FX_BOOL Copy(const CFX_ArrayTemplate& src) { - return CFX_BasicArray::Copy(src); - } + bool Copy(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Copy(src); } TYPE* GetDataPtr(int index) { return (TYPE*)CFX_BasicArray::GetDataPtr(index); @@ -289,21 +287,21 @@ class CFX_ArrayTemplate : public CFX_BasicArray { return ((TYPE*)m_pData)[nIndex]; } - FX_BOOL InsertAt(int nIndex, TYPE newElement, int nCount = 1) { + bool InsertAt(int nIndex, TYPE newElement, int nCount = 1) { if (!InsertSpaceAt(nIndex, nCount)) { - return FALSE; + return false; } while (nCount--) { ((TYPE*)m_pData)[nIndex++] = newElement; } - return TRUE; + return true; } - FX_BOOL RemoveAt(int nIndex, int nCount = 1) { + bool RemoveAt(int nIndex, int nCount = 1) { return CFX_BasicArray::RemoveAt(nIndex, nCount); } - FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) { + bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) { return CFX_BasicArray::InsertAt(nStartIndex, pNewArray); } @@ -463,7 +461,7 @@ class CFX_MapPtrToPtr { int GetCount() const { return m_nCount; } bool IsEmpty() const { return m_nCount == 0; } - FX_BOOL Lookup(void* key, void*& rValue) const; + bool Lookup(void* key, void*& rValue) const; void* GetValueAt(void* key) const; @@ -471,7 +469,7 @@ class CFX_MapPtrToPtr { void SetAt(void* key, void* newValue) { (*this)[key] = newValue; } - FX_BOOL RemoveKey(void* key); + bool RemoveKey(void* key); void RemoveAll(); @@ -485,7 +483,7 @@ class CFX_MapPtrToPtr { uint32_t GetHashTableSize() const { return m_nHashTableSize; } - void InitHashTable(uint32_t hashSize, FX_BOOL bAllocNow = TRUE); + void InitHashTable(uint32_t hashSize, bool bAllocNow = true); protected: CAssoc** m_pHashTable; @@ -514,13 +512,13 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { public: CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {} - FX_BOOL Lookup(KeyType key, ValueType& rValue) const { + bool Lookup(KeyType key, ValueType& rValue) const { void* pValue = nullptr; if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { - return FALSE; + return false; } rValue = (ValueType)(uintptr_t)pValue; - return TRUE; + return true; } ValueType& operator[](KeyType key) { @@ -531,7 +529,7 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); } - FX_BOOL RemoveKey(KeyType key) { + bool RemoveKey(KeyType key) { return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); } @@ -629,7 +627,7 @@ class CFX_BitStream { void ByteAlign(); - FX_BOOL IsEOF() { return m_BitPos >= m_BitSize; } + bool IsEOF() { return m_BitPos >= m_BitSize; } void SkipBits(uint32_t nBits) { m_BitPos += nBits; } @@ -652,7 +650,7 @@ class CFX_BitStream { class IFX_Pause { public: virtual ~IFX_Pause() {} - virtual FX_BOOL NeedToPauseNow() = 0; + virtual bool NeedToPauseNow() = 0; }; template <typename T> diff --git a/core/fxcrt/fx_basic_array.cpp b/core/fxcrt/fx_basic_array.cpp index 2d1a7bdf31..92df0e00f8 100644 --- a/core/fxcrt/fx_basic_array.cpp +++ b/core/fxcrt/fx_basic_array.cpp @@ -18,7 +18,7 @@ CFX_BasicArray::CFX_BasicArray(int unit_size) CFX_BasicArray::~CFX_BasicArray() { FX_Free(m_pData); } -FX_BOOL CFX_BasicArray::SetSize(int nNewSize) { +bool CFX_BasicArray::SetSize(int nNewSize) { if (nNewSize <= 0) { FX_Free(m_pData); m_pData = nullptr; @@ -31,7 +31,7 @@ FX_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; @@ -46,11 +46,11 @@ FX_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) { - return FALSE; + return false; } FXSYS_memset(pNewData + m_nSize * m_nUnitSize, 0, (nNewMax - m_nSize) * m_nUnitSize); @@ -58,27 +58,27 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) { m_nSize = nNewSize; m_nMaxSize = nNewMax; } - return TRUE; + return true; } -FX_BOOL CFX_BasicArray::Append(const CFX_BasicArray& src) { +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; } -FX_BOOL CFX_BasicArray::Copy(const CFX_BasicArray& src) { +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) { if (nIndex < 0 || nCount <= 0) { @@ -100,9 +100,9 @@ uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) { } return m_pData + nIndex * m_nUnitSize; } -FX_BOOL CFX_BasicArray::RemoveAt(int nIndex, int nCount) { +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) { @@ -111,22 +111,22 @@ FX_BOOL CFX_BasicArray::RemoveAt(int nIndex, int nCount) { nMoveCount * m_nUnitSize); } m_nSize -= nCount; - return TRUE; + return true; } -FX_BOOL CFX_BasicArray::InsertAt(int nStartIndex, - const CFX_BasicArray* pNewArray) { +bool CFX_BasicArray::InsertAt(int nStartIndex, + const CFX_BasicArray* pNewArray) { if (!pNewArray) { - 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 { if (index < 0 || index >= m_nSize || !m_pData) { diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 23f13c1207..2669474f00 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -965,9 +965,9 @@ FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) { if (d == 0.0f) { return 1; } - FX_BOOL bNegative = FALSE; + bool bNegative = false; if (d < 0) { - bNegative = TRUE; + bNegative = true; d = -d; } int scale = 1; diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index 1184370fa7..d2bcc2b3ed 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -42,18 +42,18 @@ void FX_RECT::Union(const FX_RECT& other_rect) { bottom = bottom > other.bottom ? bottom : other.bottom; top = top < other.top ? top : other.top; } -FX_BOOL GetIntersection(FX_FLOAT low1, - FX_FLOAT high1, - FX_FLOAT low2, - FX_FLOAT high2, - FX_FLOAT& interlow, - FX_FLOAT& interhigh) { +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) { if (d < (FX_FLOAT)INT_MIN) { @@ -290,35 +290,35 @@ void CFX_Matrix::Concat(FX_FLOAT a_in, FX_FLOAT d_in, FX_FLOAT e_in, FX_FLOAT f_in, - FX_BOOL bPrepended) { + bool bPrepended) { CFX_Matrix m; m.Set(a_in, b_in, c_in, d_in, e_in, f_in); Concat(m, bPrepended); } -void CFX_Matrix::Concat(const CFX_Matrix& m, FX_BOOL bPrepended) { +void CFX_Matrix::Concat(const CFX_Matrix& m, bool bPrepended) { if (bPrepended) { FXCRT_Matrix_Concat(*this, m, *this); } else { FXCRT_Matrix_Concat(*this, *this, m); } } -void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, FX_BOOL bPrepended) { +void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, bool bPrepended) { CFX_Matrix m; m.SetReverse(src); Concat(m, bPrepended); } -FX_BOOL CFX_Matrix::IsInvertible() const { +bool CFX_Matrix::IsInvertible() const { return FXSYS_fabs(a * d - b * c) >= 0.0001f; } -FX_BOOL CFX_Matrix::Is90Rotated() const { +bool CFX_Matrix::Is90Rotated() const { return FXSYS_fabs(a * 1000) < FXSYS_fabs(b) && FXSYS_fabs(d * 1000) < FXSYS_fabs(c); } -FX_BOOL CFX_Matrix::IsScaled() const { +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, FX_BOOL bPrepended) { +void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) { if (bPrepended) { e += x * a + y * c; f += y * d + x * b; @@ -326,7 +326,7 @@ void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended) { e += x, f += y; } } -void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended) { +void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) { a *= sx, d *= sy; if (bPrepended) { b *= sx; @@ -338,7 +338,7 @@ void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended) { f *= sy; } } -void CFX_Matrix::Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended) { +void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) { FX_FLOAT cosValue = FXSYS_cos(fRadian); FX_FLOAT sinValue = FXSYS_sin(fRadian); CFX_Matrix m; @@ -352,14 +352,14 @@ void CFX_Matrix::Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended) { void CFX_Matrix::RotateAt(FX_FLOAT fRadian, FX_FLOAT dx, FX_FLOAT dy, - FX_BOOL bPrepended) { + bool bPrepended) { Translate(dx, dy, bPrepended); Rotate(fRadian, bPrepended); Translate(-dx, -dy, bPrepended); } void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, - FX_BOOL bPrepended) { + bool bPrepended) { CFX_Matrix m; m.Set(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0); if (bPrepended) { diff --git a/core/fxcrt/fx_basic_maps.cpp b/core/fxcrt/fx_basic_maps.cpp index 48fb97082d..149951aa2e 100644 --- a/core/fxcrt/fx_basic_maps.cpp +++ b/core/fxcrt/fx_basic_maps.cpp @@ -58,14 +58,14 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, rKey = pAssocRet->key; rValue = pAssocRet->value; } -FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { +bool CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { uint32_t nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (!pAssoc) { - return FALSE; + return false; } rValue = pAssoc->value; - return TRUE; + return true; } void* CFX_MapPtrToPtr::GetValueAt(void* key) const { @@ -120,7 +120,7 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() { pAssoc->value = 0; return pAssoc; } -void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, FX_BOOL bAllocNow) { +void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, bool bAllocNow) { ASSERT(m_nCount == 0); ASSERT(nHashSize > 0); FX_Free(m_pHashTable); @@ -130,9 +130,9 @@ void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, FX_BOOL bAllocNow) { } m_nHashTableSize = nHashSize; } -FX_BOOL CFX_MapPtrToPtr::RemoveKey(void* key) { +bool CFX_MapPtrToPtr::RemoveKey(void* key) { if (!m_pHashTable) { - return FALSE; + return false; } CAssoc** ppAssocPrev; ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize]; @@ -141,11 +141,11 @@ FX_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) { pAssoc->pNext = m_pFreeList; diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index df22d4bf24..e52ff2ecee 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -97,7 +97,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { if (strc[0] == '+') { cc++; } else if (strc[0] == '-') { - bNegative = TRUE; + bNegative = true; cc++; } while (cc < len) { diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp index 099d0ecd43..e779621e60 100644 --- a/core/fxcrt/fx_basic_wstring.cpp +++ b/core/fxcrt/fx_basic_wstring.cpp @@ -952,11 +952,11 @@ FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) { return 0.0; } int cc = 0; - FX_BOOL bNegative = FALSE; + bool bNegative = false; if (str[0] == '+') { cc++; } else if (str[0] == '-') { - bNegative = TRUE; + bNegative = true; cc++; } int integer = 0; diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index d10f7b0c57..19abde1921 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -300,8 +300,8 @@ class CFX_RTemplate { void Deflate(const FXT_RECT& rt) { Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height); } - FX_BOOL IsEmpty() const { return width <= 0 || height <= 0; } - FX_BOOL IsEmpty(FX_FLOAT fEpsilon) const { + bool IsEmpty() const { return width <= 0 || height <= 0; } + bool IsEmpty(FX_FLOAT fEpsilon) const { return width <= fEpsilon || height <= fEpsilon; } void Empty() { width = height = 0; } @@ -410,12 +410,12 @@ class CFX_RTemplate { width = r - left; height = b - top; } - FX_BOOL IntersectWith(const FXT_RECT& rt) const { + bool IntersectWith(const FXT_RECT& rt) const { FXT_RECT rect = rt; rect.Intersect(*this); return !rect.IsEmpty(); } - FX_BOOL IntersectWith(const FXT_RECT& rt, FX_FLOAT fEpsilon) const { + bool IntersectWith(const FXT_RECT& rt, FX_FLOAT fEpsilon) const { FXT_RECT rect = rt; rect.Intersect(*this); return !rect.IsEmpty(fEpsilon); @@ -588,33 +588,33 @@ class CFX_Matrix { FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, - FX_BOOL bPrepended = FALSE); - void Concat(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); - void ConcatInverse(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); + bool bPrepended = false); + void Concat(const CFX_Matrix& m, bool bPrepended = false); + void ConcatInverse(const CFX_Matrix& m, bool bPrepended = false); - FX_BOOL IsIdentity() const { + bool IsIdentity() const { return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0; } - FX_BOOL IsInvertible() const; - FX_BOOL Is90Rotated() const; - FX_BOOL IsScaled() const; + bool IsInvertible() const; + bool Is90Rotated() const; + bool IsScaled() const; - void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); - void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) { + void Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended = false); + void TranslateI(int32_t x, int32_t y, bool bPrepended = false) { Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); } - void Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended = FALSE); - void Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended = FALSE); + void Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended = false); + void Rotate(FX_FLOAT fRadian, bool bPrepended = false); void RotateAt(FX_FLOAT fRadian, FX_FLOAT x, FX_FLOAT y, - FX_BOOL bPrepended = FALSE); + bool bPrepended = false); void Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, - FX_BOOL bPrepended = FALSE); + bool bPrepended = false); void MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src); FX_FLOAT GetXUnit() const; diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h index cca80b1142..b7fd6f67f7 100644 --- a/core/fxcrt/fx_ext.h +++ b/core/fxcrt/fx_ext.h @@ -101,7 +101,7 @@ typedef FX_GUID const* FX_LPCGUID; void FX_GUID_CreateV4(FX_LPGUID pGUID); void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString& bsStr, - FX_BOOL bSeparator = TRUE); + bool bSeparator = true); #endif // PDF_ENABLE_XFA template <class baseType> diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 186d98b858..0a378f32e5 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -41,10 +41,10 @@ IFX_SeekableStream* CFX_CRTFileAccess::CreateFileStream(uint32_t dwModes) { return FX_CreateFileStream(m_path.c_str(), dwModes); } -FX_BOOL CFX_CRTFileAccess::Init(const CFX_WideStringC& wsPath) { +bool CFX_CRTFileAccess::Init(const CFX_WideStringC& wsPath) { m_path = wsPath; m_RefCount = 1; - return TRUE; + return true; } #endif // PDF_ENABLE_XFA @@ -54,7 +54,7 @@ CFX_CRTFileStream::CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA) CFX_CRTFileStream::~CFX_CRTFileStream() {} -CFX_MemoryStream::CFX_MemoryStream(FX_BOOL bConsecutive) +CFX_MemoryStream::CFX_MemoryStream(bool bConsecutive) : m_dwCount(1), m_nTotalSize(0), m_nCurSize(0), @@ -66,7 +66,7 @@ CFX_MemoryStream::CFX_MemoryStream(FX_BOOL bConsecutive) CFX_MemoryStream::CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, - FX_BOOL bTakeOver) + bool bTakeOver) : m_dwCount(1), m_nTotalSize(nSize), m_nCurSize(nSize), @@ -192,11 +192,11 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer, 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; @@ -212,7 +212,7 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer, nStartBlock++; offset = 0; } - return TRUE; + return true; } bool CFX_MemoryStream::Flush() { @@ -263,12 +263,12 @@ void CFX_MemoryStream::DetachBuffer() { m_dwFlags = FX_MEMSTREAM_TakeOver; } -FX_BOOL CFX_MemoryStream::ExpandBlocks(size_t size) { +bool CFX_MemoryStream::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; @@ -278,7 +278,7 @@ FX_BOOL CFX_MemoryStream::ExpandBlocks(size_t size) { m_Blocks.SetAt(iCount++, pBlock); m_nTotalSize += m_nGrowSize; } - return TRUE; + return true; } IFX_SeekableStream* CFX_CRTFileStream::Retain() { @@ -394,10 +394,10 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, return 0.0f; } int32_t iUsedLen = 0; - FX_BOOL bNegtive = FALSE; + bool bNegtive = false; switch (pwsStr[iUsedLen]) { case '-': - bNegtive = TRUE; + bNegtive = true; case '+': iUsedLen++; break; @@ -496,7 +496,7 @@ void* FX_Random_MT_Start(uint32_t 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; } uint32_t FX_Random_MT_Generate(void* pContext) { @@ -575,15 +575,15 @@ void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) { } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) { +bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) { HCRYPTPROV hCP = 0; if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) || !hCP) { - return FALSE; + return false; } ::CryptGenRandom(hCP, iCount * sizeof(uint32_t), (uint8_t*)pBuffer); ::CryptReleaseContext(hCP, 0); - return TRUE; + return true; } #endif void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) { @@ -603,7 +603,7 @@ void FX_GUID_CreateV4(FX_LPGUID pGUID) { const FX_CHAR* gs_FX_pHexChars = "0123456789ABCDEF"; void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString& bsStr, - FX_BOOL bSeparator) { + bool bSeparator) { FX_CHAR* pBuf = bsStr.GetBuffer(40); uint8_t b; for (int32_t i = 0; i < 16; i++) { diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h index 8b1d91f4bc..dc687cf653 100644 --- a/core/fxcrt/fx_stream.h +++ b/core/fxcrt/fx_stream.h @@ -143,14 +143,14 @@ class IFX_MemoryStream : public IFX_SeekableStream { virtual uint8_t* GetBuffer() const = 0; virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, - bool bTakeOver = FALSE) = 0; + bool bTakeOver = false) = 0; virtual void DetachBuffer() = 0; }; IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t nSize, - bool bTakeOver = FALSE); -IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = FALSE); + bool bTakeOver = false); +IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = false); class IFX_BufferRead : public IFX_ReadStream { public: @@ -160,7 +160,7 @@ class IFX_BufferRead : public IFX_ReadStream { FX_FILESIZE GetPosition() override = 0; size_t ReadBlock(void* buffer, size_t size) override = 0; - virtual bool ReadNextBlock(bool bRestart = FALSE) = 0; + virtual bool ReadNextBlock(bool bRestart = false) = 0; virtual const uint8_t* GetBlockBuffer() = 0; virtual size_t GetBlockSize() = 0; virtual FX_FILESIZE GetBlockOffset() = 0; diff --git a/core/fxcrt/fx_ucd.h b/core/fxcrt/fx_ucd.h index 23bacca0f6..d79693b9fd 100644 --- a/core/fxcrt/fx_ucd.h +++ b/core/fxcrt/fx_ucd.h @@ -45,7 +45,7 @@ extern const uint16_t kFXTextLayoutBidiMirror[]; extern const size_t kFXTextLayoutBidiMirrorSize; uint32_t FX_GetUnicodeProperties(FX_WCHAR wch); -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical); +FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical); #ifdef PDF_ENABLE_XFA enum FX_CHARBREAKPROP { @@ -111,11 +111,11 @@ inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK); } -FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); +bool FX_IsCtrlCode(FX_WCHAR ch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, uint32_t dwProps, - FX_BOOL bRTL, - FX_BOOL bVertical); + bool bRTL, + bool bVertical); class CFX_Char { public: CFX_Char() diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp index cfc24b5a0e..e6f423e2af 100644 --- a/core/fxcrt/fx_unicode.cpp +++ b/core/fxcrt/fx_unicode.cpp @@ -14,13 +14,13 @@ uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) { } #ifdef PDF_ENABLE_XFA -FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) { +bool FX_IsCtrlCode(FX_WCHAR ch) { uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; } #endif // PDF_ENABLE_XFA -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { +FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) { uint32_t dwProps = FX_GetUnicodeProperties(wch); uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { @@ -44,8 +44,8 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { #ifdef PDF_ENABLE_XFA FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, uint32_t dwProps, - FX_BOOL bRTL, - FX_BOOL bVertical) { + bool bRTL, + bool bVertical) { uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { size_t idx = dwTemp >> 23; diff --git a/core/fxcrt/fx_xml.h b/core/fxcrt/fx_xml.h index 4ab28f66c5..6c6e6178af 100644 --- a/core/fxcrt/fx_xml.h +++ b/core/fxcrt/fx_xml.h @@ -40,13 +40,13 @@ class CXML_AttrMap { class CXML_Content { public: - CXML_Content() : m_bCDATA(FALSE), m_Content() {} - void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) { + CXML_Content() : m_bCDATA(false), m_Content() {} + void Set(bool bCDATA, const CFX_WideStringC& content) { m_bCDATA = bCDATA; m_Content = content; } - FX_BOOL m_bCDATA; + bool m_bCDATA; CFX_WideString m_Content; }; @@ -56,13 +56,13 @@ class CXML_Element { static CXML_Element* Parse(const void* pBuffer, size_t size, - FX_BOOL bSaveSpaceChars = FALSE, + bool bSaveSpaceChars = false, FX_FILESIZE* pParsedSize = nullptr); static CXML_Element* Parse(IFX_SeekableReadStream* pFile, - FX_BOOL bSaveSpaceChars = FALSE, + bool bSaveSpaceChars = false, FX_FILESIZE* pParsedSize = nullptr); static CXML_Element* Parse(IFX_BufferRead* pBuffer, - FX_BOOL bSaveSpaceChars = FALSE, + bool bSaveSpaceChars = false, FX_FILESIZE* pParsedSize = nullptr); CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); @@ -71,8 +71,8 @@ class CXML_Element { ~CXML_Element(); void Empty(); - CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; - CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; + CFX_ByteString GetTagName(bool bQualified = false) const; + CFX_ByteString GetNamespace(bool bQualified = false) const; CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const; CXML_Element* GetParent() const { return m_pParent; } uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } @@ -80,18 +80,18 @@ class CXML_Element { CFX_ByteString& space, CFX_ByteString& name, CFX_WideString& value) const; - FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; - FX_BOOL GetAttrValue(const CFX_ByteStringC& name, - CFX_WideString& attribute) const; + bool HasAttr(const CFX_ByteStringC& qName) const; + bool GetAttrValue(const CFX_ByteStringC& name, + CFX_WideString& attribute) const; CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { CFX_WideString attr; GetAttrValue(name, attr); return attr; } - FX_BOOL GetAttrValue(const CFX_ByteStringC& space, - const CFX_ByteStringC& name, - CFX_WideString& attribute) const; + bool GetAttrValue(const CFX_ByteStringC& space, + const CFX_ByteStringC& name, + CFX_WideString& attribute) const; CFX_WideString GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { CFX_WideString attr; @@ -99,16 +99,16 @@ class CXML_Element { return attr; } - FX_BOOL GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const; + bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const; int GetAttrInteger(const CFX_ByteStringC& name) const { int attr = 0; GetAttrInteger(name, attr); return attr; } - FX_BOOL GetAttrInteger(const CFX_ByteStringC& space, - const CFX_ByteStringC& name, - int& attribute) const; + bool GetAttrInteger(const CFX_ByteStringC& space, + const CFX_ByteStringC& name, + int& attribute) const; int GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { int attr = 0; @@ -116,16 +116,16 @@ class CXML_Element { return attr; } - FX_BOOL GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + bool GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; GetAttrFloat(name, attr); return attr; } - FX_BOOL GetAttrFloat(const CFX_ByteStringC& space, - const CFX_ByteStringC& name, - FX_FLOAT& attribute) const; + bool GetAttrFloat(const CFX_ByteStringC& space, + const CFX_ByteStringC& name, + FX_FLOAT& attribute) const; FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index f6b81dad93..e1a209a701 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -170,9 +170,9 @@ FX_FILESIZE CXML_DataStmAcc::GetBlockOffset() { CXML_Parser::CXML_Parser() : m_pDataAcc(nullptr), - m_bOwnedStream(FALSE), + m_bOwnedStream(false), m_nOffset(0), - m_bSaveSpaceChars(FALSE), + m_bSaveSpaceChars(false), m_pBuffer(nullptr), m_dwBufferSize(0), m_nBufferOffset(0), @@ -426,13 +426,13 @@ void CXML_Parser::GetAttrValue(CFX_WideString& value) { } void CXML_Parser::GetTagName(CFX_ByteString& space, CFX_ByteString& name, - FX_BOOL& bEndTag, - FX_BOOL bStartTag) { + bool& bEndTag, + 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 { @@ -461,10 +461,10 @@ void CXML_Parser::GetTagName(CFX_ByteString& space, if (ch == '/') { m_dwIndex++; GetName(space, name); - bEndTag = TRUE; + bEndTag = true; } else { GetName(space, name); - bEndTag = FALSE; + bEndTag = false; } return; } @@ -475,14 +475,13 @@ void CXML_Parser::GetTagName(CFX_ByteString& space, } } while (ReadNextBlock()); } -CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, - FX_BOOL bStartTag) { +CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, bool bStartTag) { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { return nullptr; } CFX_ByteString tag_name, tag_space; - FX_BOOL bEndTag; + bool bEndTag; GetTagName(tag_space, tag_name, bEndTag, bStartTag); if (tag_name.IsEmpty() || bEndTag) { return nullptr; @@ -543,7 +542,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, } CFX_UTF8Decoder decoder; CFX_WideTextBuf content; - FX_BOOL bCDATA = FALSE; + bool bCDATA = false; int32_t iState = 0; do { while (m_dwIndex < m_dwBufferSize) { @@ -581,10 +580,10 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, InsertContentSegment(bCDATA, dataStr.AsStringC(), 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) { break; } @@ -625,10 +624,10 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement); content.Clear(); decoder.Clear(); - bCDATA = FALSE; + bCDATA = false; return pElement; } -void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, +void CXML_Parser::InsertContentSegment(bool bCDATA, const CFX_WideStringC& content, CXML_Element* pElement) { if (content.IsEmpty()) { @@ -639,10 +638,10 @@ void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, pElement->m_Children.push_back({CXML_Element::Content, pContent}); } static CXML_Element* XML_ContinueParse(CXML_Parser& parser, - FX_BOOL bSaveSpaceChars, + bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) { parser.m_bSaveSpaceChars = bSaveSpaceChars; - CXML_Element* pElement = parser.ParseElement(nullptr, FALSE); + CXML_Element* pElement = parser.ParseElement(nullptr, false); if (pParsedSize) { *pParsedSize = parser.m_nOffset; } @@ -650,7 +649,7 @@ static CXML_Element* XML_ContinueParse(CXML_Parser& parser, } CXML_Element* CXML_Element::Parse(const void* pBuffer, size_t size, - FX_BOOL bSaveSpaceChars, + bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; if (!parser.Init((uint8_t*)pBuffer, size)) { @@ -659,7 +658,7 @@ CXML_Element* CXML_Element::Parse(const void* pBuffer, return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); } CXML_Element* CXML_Element::Parse(IFX_SeekableReadStream* pFile, - FX_BOOL bSaveSpaceChars, + bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; if (!parser.Init(pFile)) { @@ -668,7 +667,7 @@ CXML_Element* CXML_Element::Parse(IFX_SeekableReadStream* pFile, return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); } CXML_Element* CXML_Element::Parse(IFX_BufferRead* pBuffer, - FX_BOOL bSaveSpaceChars, + bool bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; if (!parser.Init(pBuffer)) { @@ -705,7 +704,7 @@ void CXML_Element::RemoveChildren() { } m_Children.clear(); } -CFX_ByteString CXML_Element::GetTagName(FX_BOOL bQualified) const { +CFX_ByteString CXML_Element::GetTagName(bool bQualified) const { if (!bQualified || m_QSpaceName.IsEmpty()) { return m_TagName; } @@ -715,7 +714,7 @@ CFX_ByteString CXML_Element::GetTagName(FX_BOOL bQualified) const { return bsTag; } -CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const { +CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const { return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName); } @@ -748,32 +747,32 @@ void CXML_Element::GetAttrByIndex(int index, name = item.m_AttrName; value = item.m_Value; } -FX_BOOL CXML_Element::HasAttr(const CFX_ByteStringC& name) const { +bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const { CFX_ByteStringC bsSpace; CFX_ByteStringC bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return !!m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName)); } -FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& name, - CFX_WideString& attribute) const { +bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name, + CFX_WideString& attribute) const { CFX_ByteStringC bsSpace; CFX_ByteStringC bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return GetAttrValue(bsSpace, bsName, attribute); } -FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& space, - const CFX_ByteStringC& name, - CFX_WideString& attribute) const { +bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space, + const CFX_ByteStringC& name, + CFX_WideString& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name)); if (pValue) { attribute = *pValue; - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& name, - int& attribute) const { +bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name, + int& attribute) const { CFX_ByteStringC bsSpace; CFX_ByteStringC bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); @@ -781,37 +780,37 @@ FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& name, m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName)); if (pwsValue) { attribute = pwsValue->GetInteger(); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& space, - const CFX_ByteStringC& name, - int& attribute) const { +bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space, + const CFX_ByteStringC& name, + int& attribute) const { const CFX_WideString* pwsValue = m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name)); if (pwsValue) { attribute = pwsValue->GetInteger(); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& name, - FX_FLOAT& attribute) const { +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); } -FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, - const CFX_ByteStringC& name, - FX_FLOAT& attribute) const { +bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, + const CFX_ByteStringC& name, + FX_FLOAT& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name)); if (pValue) { attribute = pValue->GetFloat(); - return TRUE; + return true; } - return FALSE; + return false; } CXML_Element::ChildType CXML_Element::GetChildType(uint32_t index) const { return index < m_Children.size() ? m_Children[index].type : Invalid; diff --git a/core/fxcrt/fxcrt_stream.cpp b/core/fxcrt/fxcrt_stream.cpp index 48b8a79379..3afe6323b2 100644 --- a/core/fxcrt/fxcrt_stream.cpp +++ b/core/fxcrt/fxcrt_stream.cpp @@ -11,7 +11,7 @@ bool IFX_SeekableWriteStream::WriteBlock(const void* pData, size_t size) { } bool IFX_SeekableReadStream::IsEOF() { - return FALSE; + return false; } FX_FILESIZE IFX_SeekableReadStream::GetPosition() { diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp index 87bbe96a5c..638338706e 100644 --- a/core/fxcrt/fxcrt_windows.cpp +++ b/core/fxcrt/fxcrt_windows.cpp @@ -50,7 +50,7 @@ CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, uint32_t dwMode) { if (m_hFile) - return FALSE; + return false; uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); @@ -65,7 +65,7 @@ bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, uint32_t dwMode) { if (m_hFile) - return FALSE; + return false; uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h index bc9ea3dd48..d65fdad58c 100644 --- a/core/fxcrt/xml_int.h +++ b/core/fxcrt/xml_int.h @@ -24,7 +24,7 @@ class CXML_DataBufAcc : public IFX_BufferRead { bool IsEOF() override; FX_FILESIZE GetPosition() override; size_t ReadBlock(void* buffer, size_t size) override; - bool ReadNextBlock(bool bRestart = FALSE) override; + bool ReadNextBlock(bool bRestart = false) override; const uint8_t* GetBlockBuffer() override; size_t GetBlockSize() override; FX_FILESIZE GetBlockOffset() override; @@ -45,7 +45,7 @@ class CXML_DataStmAcc : public IFX_BufferRead { bool IsEOF() override; FX_FILESIZE GetPosition() override; size_t ReadBlock(void* buffer, size_t size) override; - bool ReadNextBlock(bool bRestart = FALSE) override; + bool ReadNextBlock(bool bRestart = false) override; const uint8_t* GetBlockBuffer() override; size_t GetBlockSize() override; FX_FILESIZE GetBlockOffset() override; @@ -75,11 +75,11 @@ class CXML_Parser { uint32_t GetCharRef(); void GetTagName(CFX_ByteString& space, CFX_ByteString& name, - FX_BOOL& bEndTag, - FX_BOOL bStartTag = FALSE); + bool& bEndTag, + bool bStartTag = false); void SkipLiterals(const CFX_ByteStringC& str); - CXML_Element* ParseElement(CXML_Element* pParent, FX_BOOL bStartTag = FALSE); - void InsertContentSegment(FX_BOOL bCDATA, + CXML_Element* ParseElement(CXML_Element* pParent, bool bStartTag = false); + void InsertContentSegment(bool bCDATA, const CFX_WideStringC& content, CXML_Element* pElement); void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); @@ -87,7 +87,7 @@ class CXML_Parser { IFX_BufferRead* m_pDataAcc; bool m_bOwnedStream; FX_FILESIZE m_nOffset; - FX_BOOL m_bSaveSpaceChars; + bool m_bSaveSpaceChars; const uint8_t* m_pBuffer; size_t m_dwBufferSize; FX_FILESIZE m_nBufferOffset; |