diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-27 12:08:12 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-27 12:08:12 -0700 |
commit | 8d2aae7ee320da3a8ffe01c57e38b3f98443257d (patch) | |
tree | e694c6f82ec72fa46e6172b4475996b30d3f6a3a /core/include/fxcrt | |
parent | ff46aaf499edcf153ee2f57c7016587aa96dcfa0 (diff) | |
download | pdfium-8d2aae7ee320da3a8ffe01c57e38b3f98443257d.tar.xz |
Revert "FX Bool considered harmful, part 3"
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1255293002 .
Diffstat (limited to 'core/include/fxcrt')
-rw-r--r-- | core/include/fxcrt/fx_arb.h | 6 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 118 | ||||
-rw-r--r-- | core/include/fxcrt/fx_coordinates.h | 70 | ||||
-rw-r--r-- | core/include/fxcrt/fx_ext.h | 8 | ||||
-rw-r--r-- | core/include/fxcrt/fx_stream.h | 66 | ||||
-rw-r--r-- | core/include/fxcrt/fx_string.h | 4 | ||||
-rw-r--r-- | core/include/fxcrt/fx_system.h | 9 | ||||
-rw-r--r-- | core/include/fxcrt/fx_ucd.h | 12 | ||||
-rw-r--r-- | core/include/fxcrt/fx_xml.h | 30 |
9 files changed, 166 insertions, 157 deletions
diff --git a/core/include/fxcrt/fx_arb.h b/core/include/fxcrt/fx_arb.h index 5c4173822e..7ce21e5086 100644 --- a/core/include/fxcrt/fx_arb.h +++ b/core/include/fxcrt/fx_arb.h @@ -15,9 +15,9 @@ public: static IFX_BidiChar* Create(); virtual ~IFX_BidiChar() {} - virtual void SetPolicy(bool bSeparateNeutral = true) = 0; - virtual bool AppendChar(FX_WCHAR wch) = 0; - virtual bool EndChar() = 0; + virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) = 0; + virtual FX_BOOL AppendChar(FX_WCHAR wch) = 0; + virtual FX_BOOL EndChar() = 0; virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) = 0; virtual void Reset() = 0; }; diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index c272eb54ec..d575df6e67 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -218,9 +218,9 @@ public: CFX_ArchiveLoader& operator >> (CFX_WideString& wstr); - bool IsEOF(); + FX_BOOL IsEOF(); - bool Read(void* pBuf, FX_DWORD dwSize); + FX_BOOL Read(void* pBuf, FX_DWORD dwSize); protected: FX_DWORD m_LoadingPos; @@ -239,7 +239,7 @@ public: virtual void Clear(); - bool Flush(); + FX_BOOL Flush(); int32_t AppendBlock(const void* pBuf, size_t size); @@ -252,7 +252,7 @@ public: protected: - virtual bool DoWork(const void* pBuf, size_t size) = 0; + virtual FX_BOOL DoWork(const void* pBuf, size_t size) = 0; FX_STRSIZE m_BufSize; @@ -269,18 +269,18 @@ public: void Clear() override; - bool AttachFile(IFX_StreamWrite *pFile, bool bTakeover = false); + FX_BOOL AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover = FALSE); - bool AttachFile(const FX_WCHAR* filename); + FX_BOOL AttachFile(const FX_WCHAR* filename); - bool AttachFile(const FX_CHAR* filename); + FX_BOOL AttachFile(const FX_CHAR* filename); private: - bool DoWork(const void* pBuf, size_t size) override; + FX_BOOL DoWork(const void* pBuf, size_t size) override; IFX_StreamWrite* m_pFile; - bool m_bTakeover; + FX_BOOL m_bTakeover; }; struct CFX_CharMap { @@ -362,17 +362,17 @@ protected: ~CFX_BasicArray(); - bool SetSize(int nNewSize); + FX_BOOL SetSize(int nNewSize); - bool Append(const CFX_BasicArray& src); + FX_BOOL Append(const CFX_BasicArray& src); - bool Copy(const CFX_BasicArray& src); + FX_BOOL Copy(const CFX_BasicArray& src); uint8_t* InsertSpaceAt(int nIndex, int nCount); - bool RemoveAt(int nIndex, int nCount); + FX_BOOL RemoveAt(int nIndex, int nCount); - bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); + FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); const void* GetDataPtr(int index) const; protected: @@ -401,7 +401,7 @@ public: return m_nSize - 1; } - bool SetSize(int nNewSize) + FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } @@ -419,13 +419,13 @@ public: return ((const TYPE*)m_pData)[nIndex]; } - bool SetAt(int nIndex, TYPE newElement) + FX_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) @@ -446,36 +446,36 @@ public: return (TYPE*)m_pData; } - bool SetAtGrow(int nIndex, TYPE newElement) + FX_BOOL SetAtGrow(int nIndex, TYPE newElement) { if (nIndex < 0) { - return false; + return FALSE; } if (nIndex >= m_nSize) if (!SetSize(nIndex + 1)) { - return false; + return FALSE; } ((TYPE*)m_pData)[nIndex] = newElement; - return true; + return TRUE; } - bool Add(TYPE newElement) + FX_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; } - bool Append(const CFX_ArrayTemplate& src) + FX_BOOL Append(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Append(src); } - bool Copy(const CFX_ArrayTemplate& src) + FX_BOOL Copy(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Copy(src); } @@ -511,23 +511,23 @@ public: return ((TYPE*)m_pData)[nIndex]; } - bool InsertAt(int nIndex, TYPE newElement, int nCount = 1) + FX_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; } - bool RemoveAt(int nIndex, int nCount = 1) + FX_BOOL RemoveAt(int nIndex, int nCount = 1) { return CFX_BasicArray::RemoveAt(nIndex, nCount); } - bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) + FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) { return CFX_BasicArray::InsertAt(nStartIndex, pNewArray); } @@ -700,7 +700,7 @@ public: return m_UnitSize; } - void* Iterate(bool (*callback)(void* param, void* pData), void* param) const; + void* Iterate(FX_BOOL (*callback)(void* param, void* pData), void* param) const; private: int m_UnitSize; @@ -715,8 +715,8 @@ private: void* m_pIndex; void** GetIndex(int seg_index) const; - void* IterateIndex(int level, int& start, void** pIndex, bool (*callback)(void* param, void* pData), void* param) const; - void* IterateSegment(const uint8_t* pSegment, int count, bool (*callback)(void* param, void* pData), void* param) const; + void* IterateIndex(int level, int& start, void** pIndex, FX_BOOL (*callback)(void* param, void* pData), void* param) const; + void* IterateSegment(const uint8_t* pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const; }; template <class ElementType> class CFX_SegmentedArray : public CFX_BaseSegmentedArray @@ -798,12 +798,12 @@ public: return m_nCount; } - bool IsEmpty() const + FX_BOOL IsEmpty() const { return m_nCount == 0; } - bool Lookup(void* key, void*& rValue) const; + FX_BOOL Lookup(void* key, void*& rValue) const; void* GetValueAt(void* key) const; @@ -814,7 +814,7 @@ public: (*this)[key] = newValue; } - bool RemoveKey(void* key); + FX_BOOL RemoveKey(void* key); void RemoveAll(); @@ -830,7 +830,7 @@ public: return m_nHashTableSize; } - void InitHashTable(FX_DWORD hashSize, bool bAllocNow = true); + void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); protected: CAssoc** m_pHashTable; @@ -858,7 +858,7 @@ class CFX_CMapDWordToDWord { public: - bool Lookup(FX_DWORD key, FX_DWORD& value) const; + FX_BOOL Lookup(FX_DWORD key, FX_DWORD& value) const; void SetAt(FX_DWORD key, FX_DWORD value); @@ -893,12 +893,12 @@ public: return m_nCount; } - bool IsEmpty() const + FX_BOOL IsEmpty() const { return m_nCount == 0; } - bool Lookup(const CFX_ByteStringC& key, void*& rValue) const; + FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; void*& operator[](const CFX_ByteStringC& key); @@ -907,7 +907,7 @@ public: (*this)[key] = newValue; } - bool RemoveKey(const CFX_ByteStringC& key); + FX_BOOL RemoveKey(const CFX_ByteStringC& key); void RemoveAll(); @@ -925,7 +925,7 @@ public: return m_nHashTableSize; } - void InitHashTable(FX_DWORD hashSize, bool bAllocNow = true); + void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); FX_DWORD HashKey(const CFX_ByteStringC& key) const; protected: @@ -966,7 +966,7 @@ public: void* GetNextValue(FX_POSITION& rNextPosition) const; - bool Lookup(const CFX_ByteStringC& key, void*& rValue) const; + FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; void SetAt(const CFX_ByteStringC& key, void* value); @@ -1090,7 +1090,7 @@ struct FX_PRIVATEDATA { PD_CALLBACK_FREEDATA m_pCallback; - bool m_bSelfDestruct; + FX_BOOL m_bSelfDestruct; }; class CFX_PrivateData { @@ -1106,27 +1106,27 @@ public: void* GetPrivateData(void* module_id); - bool LookupPrivateData(void* module_id, void* &pData) const + FX_BOOL LookupPrivateData(void* module_id, void* &pData) const { if (!module_id) { - return false; + return FALSE; } FX_DWORD nCount = m_DataList.GetSize(); for (FX_DWORD n = 0; n < nCount; n ++) { if (m_DataList[n].m_pModuleId == module_id) { pData = m_DataList[n].m_pData; - return true; + return TRUE; } } - return false; + return FALSE; } - bool RemovePrivateData(void* module_id); + FX_BOOL RemovePrivateData(void* module_id); protected: CFX_ArrayTemplate<FX_PRIVATEDATA> m_DataList; - void AddData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback, bool bSelfDestruct); + void AddData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); }; class CFX_BitStream { @@ -1139,7 +1139,7 @@ public: void ByteAlign(); - bool IsEOF() + FX_BOOL IsEOF() { return m_BitPos >= m_BitSize; } @@ -1252,12 +1252,12 @@ public: return m_pObject; } - bool IsNull() const + FX_BOOL IsNull() const { return m_pObject == NULL; } - bool NotNull() const + FX_BOOL NotNull() const { return m_pObject != NULL; } @@ -1288,7 +1288,7 @@ public: m_pObject = NULL; } - bool operator == (const Ref& ref) const + FX_BOOL operator == (const Ref& ref) const { return m_pObject == ref.m_pObject; } @@ -1300,7 +1300,7 @@ class IFX_Pause { public: virtual ~IFX_Pause() { } - virtual bool NeedToPauseNow() = 0; + virtual FX_BOOL NeedToPauseNow() = 0; }; class CFX_DataFilter { @@ -1310,7 +1310,7 @@ public: void SetDestFilter(CFX_DataFilter* pFilter); - bool IsEOF() const + FX_BOOL IsEOF() const { return m_bEOF; } @@ -1330,7 +1330,7 @@ protected: virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) = 0; void ReportEOF(FX_DWORD left_input); - bool m_bEOF; + FX_BOOL m_bEOF; FX_DWORD m_SrcPos; diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 6edaf53f0b..3689a4b270 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -68,11 +68,11 @@ public: y /= lamda; return *this; } - friend bool operator == (const FXT_PSV &obj1, const FXT_PSV &obj2) + friend FX_BOOL operator == (const FXT_PSV &obj1, const FXT_PSV &obj2) { return obj1.x == obj2.x && obj1.y == obj2.y; } - friend bool operator != (const FXT_PSV &obj1, const FXT_PSV &obj2) + friend FX_BOOL operator != (const FXT_PSV &obj1, const FXT_PSV &obj2) { return obj1.x != obj2.x || obj1.y != obj2.y; } @@ -174,21 +174,21 @@ public: { return FXT_PSV::x * v.x + FXT_PSV::y * v.y; } - bool IsParallel(baseType otherx, baseType othery) const + FX_BOOL IsParallel(baseType otherx, baseType othery) const { baseType t = FXT_PSV::x * othery - FXT_PSV::y * otherx; return FXSYS_fabs(t) < 0x0001f; } - bool IsParallel(const FXT_VECTOR &v) const + FX_BOOL IsParallel(const FXT_VECTOR &v) const { return IsParallel(v.x, v.y); } - bool IsPerpendicular(baseType otherx, baseType othery) const + FX_BOOL IsPerpendicular(baseType otherx, baseType othery) const { baseType t = DotProduct(otherx, othery); return FXSYS_fabs(t) < 0x0001f; } - bool IsPerpendicular(const FXT_VECTOR &v) const + FX_BOOL IsPerpendicular(const FXT_VECTOR &v) const { return IsPerpendicular(v.x, v.y); } @@ -340,11 +340,11 @@ public: { Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height); } - bool IsEmpty() const + FX_BOOL IsEmpty() const { return width <= 0 || height <= 0; } - bool IsEmpty(FX_FLOAT fEpsilon) const + FX_BOOL IsEmpty(FX_FLOAT fEpsilon) const { return width <= fEpsilon || height <= fEpsilon; } @@ -352,15 +352,15 @@ public: { width = height = 0; } - bool Contains(baseType x, baseType y) const + FX_BOOL Contains(baseType x, baseType y) const { return x >= left && x < left + width && y >= top && y < top + height; } - bool Contains(const FXT_POINT &p) const + FX_BOOL Contains(const FXT_POINT &p) const { return Contains(p.x, p.y); } - bool Contains(const FXT_RECT &rt) const + FX_BOOL Contains(const FXT_RECT &rt) const { return rt.left >= left && rt.right() <= right() && rt.top >= top && rt.bottom() <= bottom(); } @@ -501,23 +501,23 @@ public: width = r - left; height = b - top; } - bool IntersectWith(const FXT_RECT &rt) const + FX_BOOL IntersectWith(const FXT_RECT &rt) const { FXT_RECT rect = rt; rect.Intersect(*this); return !rect.IsEmpty(); } - bool IntersectWith(const FXT_RECT &rt, FX_FLOAT fEpsilon) const + FX_BOOL IntersectWith(const FXT_RECT &rt, FX_FLOAT fEpsilon) const { FXT_RECT rect = rt; rect.Intersect(*this); return !rect.IsEmpty(fEpsilon); } - friend bool operator == (const FXT_RECT &rc1, const FXT_RECT &rc2) + friend FX_BOOL operator == (const FXT_RECT &rc1, const FXT_RECT &rc2) { return rc1.left == rc2.left && rc1.top == rc2.top && rc1.width == rc2.width && rc1.height == rc2.height; } - friend bool operator != (const FXT_RECT &rc1, const FXT_RECT &rc2) + friend FX_BOOL operator != (const FXT_RECT &rc1, const FXT_RECT &rc2) { return rc1.left != rc2.left || rc1.top != rc2.top || rc1.width != rc2.width || rc1.height != rc2.height; } @@ -561,7 +561,7 @@ struct FX_RECT { return bottom - top; } - bool IsEmpty() const + FX_BOOL IsEmpty() const { return right <= left || bottom <= top; } @@ -577,7 +577,7 @@ struct FX_RECT { void Union(const FX_RECT& other_rect); - bool operator == (const FX_RECT& src) const + FX_BOOL operator == (const FX_RECT& src) const { return left == src.left && right == src.right && top == src.top && bottom == src.bottom; } @@ -590,12 +590,12 @@ struct FX_RECT { bottom += dy; } - bool Contains(const FX_RECT& other_rect) const + FX_BOOL Contains(const FX_RECT& other_rect) const { return other_rect.left >= left && other_rect.right <= right && other_rect.top >= top && other_rect.bottom <= bottom; } - bool Contains(int x, int y) const + FX_BOOL Contains(int x, int y) const { return x >= left && x < right && y >= top && y < bottom; } @@ -637,7 +637,7 @@ public: CFX_FloatRect(const FX_RECT& rect); - bool IsEmpty() const + FX_BOOL IsEmpty() const { return left >= right || bottom >= top; } @@ -649,9 +649,9 @@ public: left = right = bottom = top = 0; } - bool Contains(const CFX_FloatRect& other_rect) const; + FX_BOOL Contains(const CFX_FloatRect& other_rect) const; - bool Contains(FX_FLOAT x, FX_FLOAT y) const; + FX_BOOL Contains(FX_FLOAT x, FX_FLOAT y) const; void Transform(const CFX_Matrix* pMatrix); @@ -786,11 +786,11 @@ public: void SetReverse(const CFX_Matrix &m); - void Concat(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, bool bPrepended = false); + void Concat(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, FX_BOOL bPrepended = FALSE); - void Concat(const CFX_Matrix &m, bool bPrepended = false); + void Concat(const CFX_Matrix &m, FX_BOOL bPrepended = FALSE); - void ConcatInverse(const CFX_Matrix& m, bool bPrepended = false); + void ConcatInverse(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); void Reset() { SetIdentity(); @@ -801,30 +801,30 @@ public: *this = m; } - bool IsIdentity() const + FX_BOOL IsIdentity() const { return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0; } - bool IsInvertible() const; + FX_BOOL IsInvertible() const; - bool Is90Rotated() const; + FX_BOOL Is90Rotated() const; - bool IsScaled() const; + FX_BOOL IsScaled() const; - void Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended = false); + void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); - void TranslateI(int32_t x, int32_t y, bool bPrepended = false) + void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) { Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); } - void Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended = false); + void Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended = FALSE); - void Rotate(FX_FLOAT fRadian, bool bPrepended = false); + void Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended = FALSE); - void RotateAt(FX_FLOAT fRadian, FX_FLOAT x, FX_FLOAT y, bool bPrepended = false); + void RotateAt(FX_FLOAT fRadian, FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); - void Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, bool bPrepended = false); + void Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, FX_BOOL bPrepended = FALSE); void MatchRect(const CFX_FloatRect &dest, const CFX_FloatRect &src); diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index a04fc529be..f24f4549a3 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -21,11 +21,11 @@ FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count) int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); -inline bool FXSYS_islower(int32_t ch) +inline FX_BOOL FXSYS_islower(int32_t ch) { return ch >= 'a' && ch <= 'z'; } -inline bool FXSYS_isupper(int32_t ch) +inline FX_BOOL FXSYS_isupper(int32_t ch) { return ch >= 'A' && ch <= 'Z'; } @@ -38,8 +38,8 @@ inline int32_t FXSYS_toupper(int32_t ch) return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); } -FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, bool bIgnoreCase = false); -FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, bool bIgnoreCase = false); +FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); #ifdef __cplusplus } diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index b05e84d83c..fdd7b11fee 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -11,8 +11,8 @@ void* FX_OpenFolder(const FX_CHAR* path); void* FX_OpenFolder(const FX_WCHAR* path); -bool FX_GetNextFile(void* handle, CFX_ByteString& filename, bool& bFolder); -bool FX_GetNextFile(void* handle, CFX_WideString& filename, bool& bFolder); +FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder); +FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder); void FX_CloseFolder(void* handle); FX_WCHAR FX_GetFolderSeparator(); typedef struct FX_HFILE_ { @@ -53,23 +53,23 @@ size_t FX_File_Read(FX_HFILE hFile, void* pBuffer, size_t szBuffer); size_t FX_File_ReadPos(FX_HFILE hFile, void* pBuffer, size_t szBuffer, FX_FILESIZE pos); size_t FX_File_Write(FX_HFILE hFile, const void* pBuffer, size_t szBuffer); size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szBuffer, FX_FILESIZE pos); -bool FX_File_Flush(FX_HFILE hFile); -bool FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile); -bool FX_File_Exist(const CFX_ByteStringC& fileName); -bool FX_File_Exist(const CFX_WideStringC& fileName); -bool FX_File_Delete(const CFX_ByteStringC& fileName); -bool FX_File_Delete(const CFX_WideStringC& fileName); -bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); -bool FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); -bool FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); -bool FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); +FX_BOOL FX_File_Flush(FX_HFILE hFile); +FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile); +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName); +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName); +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName); +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName); +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); class IFX_StreamWrite { public: virtual ~IFX_StreamWrite() { } virtual void Release() = 0; - virtual bool WriteBlock(const void* pData, size_t size) = 0; + virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0; }; class IFX_FileWrite : public IFX_StreamWrite { @@ -79,10 +79,10 @@ public: virtual FX_FILESIZE GetSize() = 0; - virtual bool Flush() = 0; + virtual FX_BOOL Flush() = 0; - virtual bool WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) = 0; - virtual bool WriteBlock(const void* pData, size_t size) + virtual FX_BOOL WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) = 0; + virtual FX_BOOL WriteBlock(const void* pData, size_t size) { return WriteBlock(pData, GetSize(), size); } @@ -96,7 +96,7 @@ public: virtual void Release() = 0; - virtual bool IsEOF() = 0; + virtual FX_BOOL IsEOF() = 0; virtual FX_FILESIZE GetPosition() = 0; @@ -109,9 +109,9 @@ public: virtual FX_FILESIZE GetSize() = 0; - virtual bool IsEOF() + virtual FX_BOOL IsEOF() { - return false; + return FALSE; } virtual FX_FILESIZE GetPosition() @@ -119,14 +119,14 @@ public: return 0; } - virtual bool SetRange(FX_FILESIZE offset, FX_FILESIZE size) + virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) { - return false; + return FALSE; } virtual void ClearRange() {} - virtual bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0; + virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0; virtual size_t ReadBlock(void* buffer, size_t size) { @@ -145,21 +145,21 @@ public: virtual FX_FILESIZE GetSize() = 0; - virtual bool IsEOF() = 0; + virtual FX_BOOL IsEOF() = 0; virtual FX_FILESIZE GetPosition() = 0; - virtual bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0; + virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0; virtual size_t ReadBlock(void* buffer, size_t size) = 0; - virtual bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) = 0; - virtual bool WriteBlock(const void* buffer, size_t size) + virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) = 0; + virtual FX_BOOL WriteBlock(const void* buffer, size_t size) { return WriteBlock(buffer, GetSize(), size); } - virtual bool Flush() = 0; + virtual FX_BOOL Flush() = 0; }; IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes); IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes); @@ -167,31 +167,31 @@ class IFX_MemoryStream : public IFX_FileStream { public: - virtual bool IsConsecutive() const = 0; + virtual FX_BOOL IsConsecutive() const = 0; virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0; virtual uint8_t* GetBuffer() const = 0; - virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, bool bTakeOver = false) = 0; + virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_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); +IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE); +IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE); class IFX_BufferRead : public IFX_StreamRead { public: virtual void Release() = 0; - virtual bool IsEOF() = 0; + virtual FX_BOOL IsEOF() = 0; virtual FX_FILESIZE GetPosition() = 0; virtual size_t ReadBlock(void* buffer, size_t size) = 0; - virtual bool ReadNextBlock(bool bRestart = false) = 0; + virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; virtual const uint8_t* GetBlockBuffer() = 0; diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 736aa32239..8d73555814 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -670,7 +670,7 @@ public: void Empty(); - bool IsEmpty() const + FX_BOOL IsEmpty() const { return !GetLength(); } @@ -895,7 +895,7 @@ inline bool operator!= (const CFX_WideStringC& lhs, const CFX_WideString& rhs) { return rhs != lhs; } FX_FLOAT FX_atof(const CFX_ByteStringC& str); -void FX_atonum(const CFX_ByteStringC& str, bool& bInteger, void* pData); +void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len); inline CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index 9fcaf171bc..8bc2b4ab2a 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -71,6 +71,7 @@ typedef void* FX_POSITION; // Keep until fxcrt containers gone typedef unsigned short FX_WORD; // Keep - "an efficient small type" typedef unsigned int FX_DWORD; // Keep - "an efficient type" typedef float FX_FLOAT; // Keep, allow upgrade to doubles. +typedef int FX_BOOL; // Keep, sadly not always 0 or 1. typedef char FX_CHAR; // Keep, questionable signedness. typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. @@ -83,6 +84,14 @@ typedef int FX_STRSIZE; #define _DEBUG #endif +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + #ifndef NULL #define NULL 0 #endif diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h index d9b57811c6..7b730bb81a 100644 --- a/core/include/fxcrt/fx_ucd.h +++ b/core/include/fxcrt/fx_ucd.h @@ -92,11 +92,11 @@ enum FX_CHARTYPE { FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), }; FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch); -bool FX_IsCtrlCode(FX_WCHAR ch); -bool FX_IsRotationCode(FX_WCHAR ch); -bool FX_IsCombinationChar(FX_WCHAR wch); -bool FX_IsBidiChar(FX_WCHAR wch); -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical); -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, bool bRTL, bool bVertical); +FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); +FX_BOOL FX_IsRotationCode(FX_WCHAR ch); +FX_BOOL FX_IsCombinationChar(FX_WCHAR wch); +FX_BOOL FX_IsBidiChar(FX_WCHAR wch); +FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical); +FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, FX_BOOL bRTL, FX_BOOL bVertical); #endif // CORE_INCLUDE_FXCRT_FX_UCD_H_ diff --git a/core/include/fxcrt/fx_xml.h b/core/include/fxcrt/fx_xml.h index 233a8f9bb6..ba33b2083a 100644 --- a/core/include/fxcrt/fx_xml.h +++ b/core/include/fxcrt/fx_xml.h @@ -38,21 +38,21 @@ public: class CXML_Content { public: - CXML_Content() : m_bCDATA(false), m_Content() {} - void Set(bool bCDATA, const CFX_WideStringC& content) + CXML_Content() : m_bCDATA(FALSE), m_Content() {} + void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) { m_bCDATA = bCDATA; m_Content = content; } - bool m_bCDATA; + FX_BOOL m_bCDATA; CFX_WideString m_Content; }; class CXML_Element { public: - static CXML_Element* Parse(const void* pBuffer, size_t size, bool bSaveSpaceChars = false, FX_FILESIZE* pParsedSize = NULL); - static CXML_Element* Parse(IFX_FileRead *pFile, bool bSaveSpaceChars = false, FX_FILESIZE* pParsedSize = NULL); - static CXML_Element* Parse(IFX_BufferRead *pBuffer, bool bSaveSpaceChars = false, FX_FILESIZE* pParsedSize = NULL); + static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); + static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); + static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); CXML_Element(const CFX_ByteStringC& qTagName); CXML_Element(); @@ -63,9 +63,9 @@ public: - CFX_ByteString GetTagName(bool bQualified = false) const; + CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; - CFX_ByteString GetNamespace(bool bQualified = false) const; + CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; @@ -81,9 +81,9 @@ public: void GetAttrByIndex(int index, CFX_ByteString &space, CFX_ByteString &name, CFX_WideString &value) const; - bool HasAttr(const CFX_ByteStringC& qName) const; + FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; - bool GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const; + FX_BOOL GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const; CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { CFX_WideString attr; @@ -91,7 +91,7 @@ public: return attr; } - bool GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const; + FX_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,7 +99,7 @@ public: return attr; } - bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const; + FX_BOOL GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const; int GetAttrInteger(const CFX_ByteStringC& name) const { int attr = 0; @@ -107,7 +107,7 @@ public: return attr; } - bool GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name, int& attribute) const; + FX_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; @@ -115,7 +115,7 @@ public: return attr; } - bool GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + FX_BOOL GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; @@ -123,7 +123,7 @@ public: return attr; } - bool GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + FX_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; |