diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:43:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:43:19 -0700 |
commit | d19e912dd469e4bdad9f3020e1f6eb98f10f3470 (patch) | |
tree | 239cb568a80445f14a1ab9b63dcaaddcce67e1cc /xfa/fgas | |
parent | 12f3e4a58f05850b93af35619cb04f0231d86acc (diff) | |
download | pdfium-d19e912dd469e4bdad9f3020e1f6eb98f10f3470.tar.xz |
Remove FX_BOOL from xfa.
Review-Url: https://codereview.chromium.org/2467203003
Diffstat (limited to 'xfa/fgas')
-rw-r--r-- | xfa/fgas/crt/fgas_codepage.cpp | 4 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_codepage.h | 2 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_stream.cpp | 300 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_stream.h | 8 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_utils.cpp | 18 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_utils.h | 30 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_font.h | 2 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.cpp | 114 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.h | 52 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.cpp | 62 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.h | 12 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.cpp | 152 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.h | 36 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_textbreak.cpp | 201 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_textbreak.h | 52 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_unicode.h | 12 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_datetime.cpp | 122 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_datetime.h | 82 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_locale.cpp | 855 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_locale.h | 30 | ||||
-rw-r--r-- | xfa/fgas/localization/fgas_localeimp.h | 86 |
21 files changed, 1097 insertions, 1135 deletions
diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp index 86aeb7b983..36f87a36f3 100644 --- a/xfa/fgas/crt/fgas_codepage.cpp +++ b/xfa/fgas/crt/fgas_codepage.cpp @@ -380,7 +380,7 @@ int32_t FX_DecodeString(uint16_t wCodePage, int32_t* pSrcLen, FX_WCHAR* pDst, int32_t* pDstLen, - FX_BOOL bErrBreak) { + bool bErrBreak) { if (wCodePage == FX_CODEPAGE_UTF8) { return FX_UTF8Decode(pSrc, pSrcLen, pDst, pDstLen); } @@ -399,7 +399,7 @@ int32_t FX_UTF8Decode(const FX_CHAR* pSrc, return 1; } int32_t iDstLen = *pDstLen; - FX_BOOL bValidDst = (pDst && iDstLen > 0); + bool bValidDst = (pDst && iDstLen > 0); uint32_t dwCode = 0; int32_t iPending = 0; int32_t iSrcNum = 0, iDstNum = 0; diff --git a/xfa/fgas/crt/fgas_codepage.h b/xfa/fgas/crt/fgas_codepage.h index 2beed27552..780c20e233 100644 --- a/xfa/fgas/crt/fgas_codepage.h +++ b/xfa/fgas/crt/fgas_codepage.h @@ -144,7 +144,7 @@ int32_t FX_DecodeString(uint16_t wCodePage, int32_t* pSrcLen, FX_WCHAR* pDst, int32_t* pDstLen, - FX_BOOL bErrBreak); + bool bErrBreak); int32_t FX_UTF8Decode(const FX_CHAR* pSrc, int32_t* pSrcLen, FX_WCHAR* pDst, diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 6da4e9ed8c..c3850c00bb 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -25,15 +25,15 @@ class IFX_StreamImp { virtual int32_t GetLength() const = 0; virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0; virtual int32_t GetPosition() = 0; - virtual FX_BOOL IsEOF() const = 0; + virtual bool IsEOF() const = 0; virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) = 0; + bool& bEOS) = 0; virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; virtual void Flush() = 0; - virtual FX_BOOL SetLength(int32_t iLength) = 0; + virtual bool SetLength(int32_t iLength) = 0; protected: IFX_StreamImp(); @@ -50,21 +50,19 @@ class CFX_FileStreamImp : public IFX_StreamImp { CFX_FileStreamImp(); ~CFX_FileStreamImp() override; - FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); + bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); // IFX_StreamImp: int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override; - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override; + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override; - FX_BOOL SetLength(int32_t iLength) override; + bool SetLength(int32_t iLength) override; protected: FXSYS_FILE* m_hFile; @@ -76,21 +74,19 @@ class CFX_BufferStreamImp : public IFX_StreamImp { CFX_BufferStreamImp(); ~CFX_BufferStreamImp() override {} - FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess); + bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess); // IFX_StreamImp: int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override; - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override; + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override {} - FX_BOOL SetLength(int32_t iLength) override { return FALSE; } + bool SetLength(int32_t iLength) override { return false; } protected: uint8_t* m_pData; @@ -104,17 +100,15 @@ class CFX_FileReadStreamImp : public IFX_StreamImp { CFX_FileReadStreamImp(); ~CFX_FileReadStreamImp() override {} - FX_BOOL LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess); + bool LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess); // IFX_StreamImp: int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override { return m_iPosition; } - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override; + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override { return 0; } @@ -122,7 +116,7 @@ class CFX_FileReadStreamImp : public IFX_StreamImp { return 0; } void Flush() override {} - FX_BOOL SetLength(int32_t iLength) override { return FALSE; } + bool SetLength(int32_t iLength) override { return false; } protected: IFX_SeekableReadStream* m_pFileRead; @@ -135,20 +129,18 @@ class CFX_BufferReadStreamImp : public IFX_StreamImp { CFX_BufferReadStreamImp(); ~CFX_BufferReadStreamImp() override; - FX_BOOL LoadBufferRead(IFX_BufferRead* pBufferRead, - int32_t iFileSize, - uint32_t dwAccess, - FX_BOOL bReleaseBufferRead); + bool LoadBufferRead(IFX_BufferRead* pBufferRead, + int32_t iFileSize, + uint32_t dwAccess, + bool bReleaseBufferRead); // IFX_StreamImp: int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override { return m_iPosition; } - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override; + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override { return 0; } @@ -156,11 +148,11 @@ class CFX_BufferReadStreamImp : public IFX_StreamImp { return 0; } void Flush() override {} - FX_BOOL SetLength(int32_t iLength) override { return FALSE; } + bool SetLength(int32_t iLength) override { return false; } private: IFX_BufferRead* m_pBufferRead; - FX_BOOL m_bReleaseBufferRead; + bool m_bReleaseBufferRead; int32_t m_iPosition; int32_t m_iBufferSize; }; @@ -170,23 +162,21 @@ class CFX_FileWriteStreamImp : public IFX_StreamImp { CFX_FileWriteStreamImp(); ~CFX_FileWriteStreamImp() override {} - FX_BOOL LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess); + bool LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess); // IFX_StreamImp: int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override { return m_iPosition; } - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override { return 0; } - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override { + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override { return 0; } int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override; - FX_BOOL SetLength(int32_t iLength) override { return FALSE; } + bool SetLength(int32_t iLength) override { return false; } protected: IFX_SeekableWriteStream* m_pFileWrite; @@ -206,14 +196,14 @@ class CFX_Stream : public IFX_Stream { CFX_Stream(); ~CFX_Stream() override; - FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); - FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess); - FX_BOOL LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess); - FX_BOOL LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess); - FX_BOOL LoadBufferRead(IFX_BufferRead* pBufferRead, - int32_t iFileSize, - uint32_t dwAccess, - FX_BOOL bReleaseBufferRead); + bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); + bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess); + bool LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess); + bool LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess); + bool LoadBufferRead(IFX_BufferRead* pBufferRead, + int32_t iFileSize, + uint32_t dwAccess, + bool bReleaseBufferRead); // IFX_Stream void Release() override; @@ -222,15 +212,13 @@ class CFX_Stream : public IFX_Stream { int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override; - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override; + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override; - FX_BOOL SetLength(int32_t iLength) override; + bool SetLength(int32_t iLength) override; int32_t GetBOM(uint8_t bom[4]) const override; uint16_t GetCodePage() const override; uint16_t SetCodePage(uint16_t wCodePage) override; @@ -251,7 +239,7 @@ class CFX_Stream : public IFX_Stream { class CFX_TextStream : public IFX_Stream { public: - CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream); + CFX_TextStream(IFX_Stream* pStream, bool bDelStream); ~CFX_TextStream() override; // IFX_Stream @@ -261,15 +249,13 @@ class CFX_TextStream : public IFX_Stream { int32_t GetLength() const override; int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; int32_t GetPosition() override; - FX_BOOL IsEOF() const override; + bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) override; + int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; void Flush() override; - FX_BOOL SetLength(int32_t iLength) override; + bool SetLength(int32_t iLength) override; int32_t GetBOM(uint8_t bom[4]) const override; uint16_t GetCodePage() const override; uint16_t SetCodePage(uint16_t wCodePage) override; @@ -283,7 +269,7 @@ class CFX_TextStream : public IFX_Stream { uint32_t m_dwBOM; uint8_t* m_pBuf; int32_t m_iBufSize; - FX_BOOL m_bDelStream; + bool m_bDelStream; IFX_Stream* m_pStreamImp; int32_t m_iRefCount; void InitStream(); @@ -317,7 +303,7 @@ int32_t FileLength(FXSYS_FILE* file) { #endif } -FX_BOOL FileSetSize(FXSYS_FILE* file, int32_t size) { +bool FileSetSize(FXSYS_FILE* file, int32_t size) { ASSERT(file); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ return _chsize(_fileno(file), size) == 0; @@ -325,11 +311,11 @@ FX_BOOL FileSetSize(FXSYS_FILE* file, int32_t size) { HANDLE hFile = _fileno(file); uint32_t dwPos = ::SetFilePointer(hFile, 0, 0, FILE_CURRENT); ::SetFilePointer(hFile, size, 0, FILE_BEGIN); - FX_BOOL bRet = ::SetEndOfFile(hFile); + bool bRet = ::SetEndOfFile(hFile); ::SetFilePointer(hFile, (int32_t)dwPos, 0, FILE_BEGIN); return bRet; #else - return FALSE; + return false; #endif } @@ -344,7 +330,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_SeekableReadStream* pFileRead, return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { - return new CFX_TextStream(pSR, TRUE); + return new CFX_TextStream(pSR, true); } return pSR; } @@ -358,7 +344,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_SeekableWriteStream* pFileWrite, return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { - return new CFX_TextStream(pSR, TRUE); + return new CFX_TextStream(pSR, true); } return pSR; } @@ -373,7 +359,7 @@ IFX_Stream* IFX_Stream::CreateStream(uint8_t* pData, return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { - return new CFX_TextStream(pSR, TRUE); + return new CFX_TextStream(pSR, true); } return pSR; } @@ -387,8 +373,8 @@ CFX_FileStreamImp::~CFX_FileStreamImp() { FXSYS_fclose(m_hFile); } -FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, - uint32_t dwAccess) { +bool CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, + uint32_t dwAccess) { ASSERT(!m_hFile); ASSERT(pszSrcFileName && FXSYS_wcslen(pszSrcFileName) > 0); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ @@ -415,13 +401,13 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, if (!m_hFile) { m_hFile = FXSYS_wfopen(pszSrcFileName, L"r+b"); if (!m_hFile) - return FALSE; + return false; if (dwAccess & FX_STREAMACCESS_Truncate) FileSetSize(m_hFile, 0); } } else { - return FALSE; + return false; } } #else @@ -445,14 +431,14 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, if (!m_hFile) { m_hFile = FXSYS_fopen(szFileName.c_str(), "r+b"); if (!m_hFile) { - return FALSE; + return false; } if (dwAccess & FX_STREAMACCESS_Truncate) { FileSetSize(m_hFile, 0); } } } else { - return FALSE; + return false; } } #endif @@ -463,7 +449,7 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } else { m_iLength = FileLength(m_hFile); } - return TRUE; + return true; } int32_t CFX_FileStreamImp::GetLength() const { ASSERT(m_hFile); @@ -478,7 +464,7 @@ int32_t CFX_FileStreamImp::GetPosition() { ASSERT(m_hFile); return FXSYS_ftell(m_hFile); } -FX_BOOL CFX_FileStreamImp::IsEOF() const { +bool CFX_FileStreamImp::IsEOF() const { ASSERT(m_hFile); return FXSYS_ftell(m_hFile) >= m_iLength; } @@ -489,7 +475,7 @@ int32_t CFX_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { } int32_t CFX_FileStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(m_hFile); ASSERT(pStr && iMaxLength > 0); if (m_iLength <= 0) { @@ -541,23 +527,23 @@ void CFX_FileStreamImp::Flush() { ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0); FXSYS_fflush(m_hFile); } -FX_BOOL CFX_FileStreamImp::SetLength(int32_t iLength) { +bool CFX_FileStreamImp::SetLength(int32_t iLength) { ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0); - FX_BOOL bRet = FileSetSize(m_hFile, iLength); + bool bRet = FileSetSize(m_hFile, iLength); m_iLength = FileLength(m_hFile); return bRet; } CFX_FileReadStreamImp::CFX_FileReadStreamImp() : m_pFileRead(nullptr), m_iPosition(0), m_iLength(0) {} -FX_BOOL CFX_FileReadStreamImp::LoadFileRead(IFX_SeekableReadStream* pFileRead, - uint32_t dwAccess) { +bool CFX_FileReadStreamImp::LoadFileRead(IFX_SeekableReadStream* pFileRead, + uint32_t dwAccess) { ASSERT(!m_pFileRead && pFileRead); if (dwAccess & FX_STREAMACCESS_Write) { - return FALSE; + return false; } m_pFileRead = pFileRead; m_iLength = m_pFileRead->GetSize(); - return TRUE; + return true; } int32_t CFX_FileReadStreamImp::GetLength() const { return m_iLength; @@ -581,7 +567,7 @@ int32_t CFX_FileReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { } return m_iPosition; } -FX_BOOL CFX_FileReadStreamImp::IsEOF() const { +bool CFX_FileReadStreamImp::IsEOF() const { return m_iPosition >= m_iLength; } int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { @@ -598,7 +584,7 @@ int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { } int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(m_pFileRead); ASSERT(pStr && iMaxLength > 0); iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2; @@ -614,7 +600,7 @@ int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr, } CFX_BufferReadStreamImp::CFX_BufferReadStreamImp() : m_pBufferRead(nullptr), - m_bReleaseBufferRead(FALSE), + m_bReleaseBufferRead(false), m_iPosition(0), m_iBufferSize(0) {} CFX_BufferReadStreamImp::~CFX_BufferReadStreamImp() { @@ -622,29 +608,29 @@ CFX_BufferReadStreamImp::~CFX_BufferReadStreamImp() { m_pBufferRead->Release(); } } -FX_BOOL CFX_BufferReadStreamImp::LoadBufferRead(IFX_BufferRead* pBufferRead, - int32_t iFileSize, - uint32_t dwAccess, - FX_BOOL bReleaseBufferRead) { +bool CFX_BufferReadStreamImp::LoadBufferRead(IFX_BufferRead* pBufferRead, + int32_t iFileSize, + uint32_t dwAccess, + bool bReleaseBufferRead) { ASSERT(!m_pBufferRead && pBufferRead); if (dwAccess & FX_STREAMACCESS_Write) { - return FALSE; + return false; } m_bReleaseBufferRead = bReleaseBufferRead; m_pBufferRead = pBufferRead; m_iBufferSize = iFileSize; if (m_iBufferSize >= 0) { - return TRUE; + return true; } - if (!m_pBufferRead->ReadNextBlock(TRUE)) { - return FALSE; + if (!m_pBufferRead->ReadNextBlock(true)) { + return false; } m_iBufferSize = m_pBufferRead->GetBlockSize(); while (!m_pBufferRead->IsEOF()) { - m_pBufferRead->ReadNextBlock(FALSE); + m_pBufferRead->ReadNextBlock(false); m_iBufferSize += m_pBufferRead->GetBlockSize(); } - return TRUE; + return true; } int32_t CFX_BufferReadStreamImp::GetLength() const { return m_iBufferSize; @@ -669,8 +655,8 @@ int32_t CFX_BufferReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { } return m_iPosition; } -FX_BOOL CFX_BufferReadStreamImp::IsEOF() const { - return m_pBufferRead ? m_pBufferRead->IsEOF() : TRUE; +bool CFX_BufferReadStreamImp::IsEOF() const { + return m_pBufferRead ? m_pBufferRead->IsEOF() : true; } int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { @@ -686,7 +672,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, uint32_t dwBlockOffset = m_pBufferRead->GetBlockOffset(); uint32_t dwBlockSize = m_pBufferRead->GetBlockSize(); if (m_iPosition < (int32_t)dwBlockOffset) { - if (!m_pBufferRead->ReadNextBlock(TRUE)) { + if (!m_pBufferRead->ReadNextBlock(true)) { return 0; } dwBlockOffset = m_pBufferRead->GetBlockOffset(); @@ -694,7 +680,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, } while (m_iPosition < (int32_t)dwBlockOffset || m_iPosition >= (int32_t)(dwBlockOffset + dwBlockSize)) { - if (m_pBufferRead->IsEOF() || !m_pBufferRead->ReadNextBlock(FALSE)) { + if (m_pBufferRead->IsEOF() || !m_pBufferRead->ReadNextBlock(false)) { break; } dwBlockOffset = m_pBufferRead->GetBlockOffset(); @@ -712,7 +698,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, dwOffsetTmp = dwCopySize; iBufferSize -= dwCopySize; while (iBufferSize > 0) { - if (!m_pBufferRead->ReadNextBlock(FALSE)) { + if (!m_pBufferRead->ReadNextBlock(false)) { break; } dwBlockOffset = m_pBufferRead->GetBlockOffset(); @@ -728,7 +714,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, } int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(m_pBufferRead); ASSERT(pStr && iMaxLength > 0); iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2; @@ -744,18 +730,17 @@ int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, } CFX_FileWriteStreamImp::CFX_FileWriteStreamImp() : m_pFileWrite(nullptr), m_iPosition(0) {} -FX_BOOL CFX_FileWriteStreamImp::LoadFileWrite( - IFX_SeekableWriteStream* pFileWrite, - uint32_t dwAccess) { +bool CFX_FileWriteStreamImp::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, + uint32_t dwAccess) { ASSERT(!m_pFileWrite && pFileWrite); if (dwAccess & FX_STREAMACCESS_Read) { - return FALSE; + return false; } if (dwAccess & FX_STREAMACCESS_Append) { m_iPosition = pFileWrite->GetSize(); } m_pFileWrite = pFileWrite; - return TRUE; + return true; } int32_t CFX_FileWriteStreamImp::GetLength() const { if (!m_pFileWrite) { @@ -783,7 +768,7 @@ int32_t CFX_FileWriteStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { } return m_iPosition; } -FX_BOOL CFX_FileWriteStreamImp::IsEOF() const { +bool CFX_FileWriteStreamImp::IsEOF() const { return m_iPosition >= GetLength(); } int32_t CFX_FileWriteStreamImp::WriteData(const uint8_t* pBuffer, @@ -808,16 +793,16 @@ void CFX_FileWriteStreamImp::Flush() { CFX_BufferStreamImp::CFX_BufferStreamImp() : m_pData(nullptr), m_iTotalSize(0), m_iPosition(0), m_iLength(0) {} -FX_BOOL CFX_BufferStreamImp::LoadBuffer(uint8_t* pData, - int32_t iTotalSize, - uint32_t dwAccess) { +bool CFX_BufferStreamImp::LoadBuffer(uint8_t* pData, + int32_t iTotalSize, + uint32_t dwAccess) { ASSERT(!m_pData && pData && iTotalSize > 0); SetAccessModes(dwAccess); m_pData = pData; m_iTotalSize = iTotalSize; m_iPosition = 0; m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iTotalSize; - return TRUE; + return true; } int32_t CFX_BufferStreamImp::GetLength() const { ASSERT(m_pData); @@ -844,7 +829,7 @@ int32_t CFX_BufferStreamImp::GetPosition() { ASSERT(m_pData); return m_iPosition; } -FX_BOOL CFX_BufferStreamImp::IsEOF() const { +bool CFX_BufferStreamImp::IsEOF() const { ASSERT(m_pData); return m_iPosition >= m_iLength; } @@ -861,7 +846,7 @@ int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { } int32_t CFX_BufferStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(m_pData); ASSERT(pStr && iMaxLength > 0); int32_t iLen = std::min((m_iLength - m_iPosition) / 2, iMaxLength); @@ -911,12 +896,12 @@ int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr, // static IFX_Stream* IFX_Stream::CreateTextStream(IFX_Stream* pBaseStream, - FX_BOOL bDeleteOnRelease) { + bool bDeleteOnRelease) { ASSERT(pBaseStream); return new CFX_TextStream(pBaseStream, bDeleteOnRelease); } -CFX_TextStream::CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream) +CFX_TextStream::CFX_TextStream(IFX_Stream* pStream, bool bDelStream) : m_wCodePage(FX_CODEPAGE_DefANSI), m_wBOMLength(0), m_dwBOM(0), @@ -1004,7 +989,7 @@ int32_t CFX_TextStream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { int32_t CFX_TextStream::GetPosition() { return m_pStreamImp->GetPosition(); } -FX_BOOL CFX_TextStream::IsEOF() const { +bool CFX_TextStream::IsEOF() const { return m_pStreamImp->IsEOF(); } int32_t CFX_TextStream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { @@ -1016,7 +1001,7 @@ int32_t CFX_TextStream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { void CFX_TextStream::Flush() { m_pStreamImp->Flush(); } -FX_BOOL CFX_TextStream::SetLength(int32_t iLength) { +bool CFX_TextStream::SetLength(int32_t iLength) { return m_pStreamImp->SetLength(iLength); } uint16_t CFX_TextStream::GetCodePage() const { @@ -1031,7 +1016,7 @@ IFX_Stream* CFX_TextStream::CreateSharedStream(uint32_t dwAccess, return nullptr; } if (dwAccess & FX_STREAMACCESS_Text) { - return new CFX_TextStream(pSR, TRUE); + return new CFX_TextStream(pSR, true); } return pSR; } @@ -1052,7 +1037,7 @@ uint16_t CFX_TextStream::SetCodePage(uint16_t wCodePage) { } int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(pStr && iMaxLength > 0); if (!m_pStreamImp) { return -1; @@ -1090,7 +1075,7 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, iLen = m_pStreamImp->ReadData(m_pBuf, iBytes); int32_t iSrc = iLen; int32_t iDecode = FX_DecodeString(m_wCodePage, (const FX_CHAR*)m_pBuf, - &iSrc, pStr, &iMaxLength, TRUE); + &iSrc, pStr, &iMaxLength, true); m_pStreamImp->Seek(FX_STREAMSEEK_Current, iSrc - iLen); if (iDecode < 1) { return -1; @@ -1134,103 +1119,102 @@ CFX_Stream::~CFX_Stream() { delete m_pStreamImp; } -FX_BOOL CFX_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, - uint32_t dwAccess) { +bool CFX_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) - return FALSE; + return false; if (!pszSrcFileName || FXSYS_wcslen(pszSrcFileName) < 1) - return FALSE; + return false; std::unique_ptr<CFX_FileStreamImp> pImp(new CFX_FileStreamImp()); if (!pImp->LoadFile(pszSrcFileName, dwAccess)) - return FALSE; + return false; m_pStreamImp = pImp.release(); m_eStreamType = FX_STREAMTYPE_File; m_dwAccess = dwAccess; m_iLength = m_pStreamImp->GetLength(); - return TRUE; + return true; } -FX_BOOL CFX_Stream::LoadFileRead(IFX_SeekableReadStream* pFileRead, - uint32_t dwAccess) { +bool CFX_Stream::LoadFileRead(IFX_SeekableReadStream* pFileRead, + uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) - return FALSE; + return false; if (!pFileRead) - return FALSE; + return false; std::unique_ptr<CFX_FileReadStreamImp> pImp(new CFX_FileReadStreamImp()); if (!pImp->LoadFileRead(pFileRead, dwAccess)) - return FALSE; + return false; m_pStreamImp = pImp.release(); m_eStreamType = FX_STREAMTYPE_File; m_dwAccess = dwAccess; m_iLength = m_pStreamImp->GetLength(); - return TRUE; + return true; } -FX_BOOL CFX_Stream::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, - uint32_t dwAccess) { +bool CFX_Stream::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, + uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) - return FALSE; + return false; if (!pFileWrite) - return FALSE; + return false; std::unique_ptr<CFX_FileWriteStreamImp> pImp(new CFX_FileWriteStreamImp()); if (!pImp->LoadFileWrite(pFileWrite, dwAccess)) - return FALSE; + return false; m_pStreamImp = pImp.release(); m_eStreamType = FX_STREAMTYPE_File; m_dwAccess = dwAccess; m_iLength = m_pStreamImp->GetLength(); - return TRUE; + return true; } -FX_BOOL CFX_Stream::LoadBuffer(uint8_t* pData, - int32_t iTotalSize, - uint32_t dwAccess) { +bool CFX_Stream::LoadBuffer(uint8_t* pData, + int32_t iTotalSize, + uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) - return FALSE; + return false; if (!pData || iTotalSize < 1) - return FALSE; + return false; std::unique_ptr<CFX_BufferStreamImp> pImp(new CFX_BufferStreamImp()); if (!pImp->LoadBuffer(pData, iTotalSize, dwAccess)) - return FALSE; + return false; m_pStreamImp = pImp.release(); m_eStreamType = FX_STREAMTYPE_Buffer; m_dwAccess = dwAccess; m_iLength = m_pStreamImp->GetLength(); - return TRUE; + return true; } -FX_BOOL CFX_Stream::LoadBufferRead(IFX_BufferRead* pBufferRead, - int32_t iFileSize, - uint32_t dwAccess, - FX_BOOL bReleaseBufferRead) { +bool CFX_Stream::LoadBufferRead(IFX_BufferRead* pBufferRead, + int32_t iFileSize, + uint32_t dwAccess, + bool bReleaseBufferRead) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) - return FALSE; + return false; if (!pBufferRead) - return FALSE; + return false; std::unique_ptr<CFX_BufferReadStreamImp> pImp(new CFX_BufferReadStreamImp); if (!pImp->LoadBufferRead(pBufferRead, iFileSize, dwAccess, bReleaseBufferRead)) - return FALSE; + return false; m_pStreamImp = pImp.release(); m_eStreamType = FX_STREAMTYPE_BufferRead; m_dwAccess = dwAccess; m_iLength = m_pStreamImp->GetLength(); - return TRUE; + return true; } void CFX_Stream::Release() { @@ -1292,9 +1276,9 @@ int32_t CFX_Stream::GetPosition() { } return m_iPosition - m_iStart; } -FX_BOOL CFX_Stream::IsEOF() const { +bool CFX_Stream::IsEOF() const { if (!m_pStreamImp) { - return TRUE; + return true; } if (m_eStreamType == FX_STREAMTYPE_File || m_eStreamType == FX_STREAMTYPE_Buffer) { @@ -1318,9 +1302,7 @@ int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { m_iPosition = m_pStreamImp->GetPosition(); return iLen; } -int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS) { +int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(pStr && iMaxLength > 0); if (!m_pStreamImp) { return -1; @@ -1337,7 +1319,7 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, iLen = m_pStreamImp->ReadString(pStr, iLen, bEOS); m_iPosition = m_pStreamImp->GetPosition(); if (iLen > 0 && m_iPosition >= iEnd) { - bEOS = TRUE; + bEOS = true; } return iLen; } @@ -1403,12 +1385,12 @@ void CFX_Stream::Flush() { } m_pStreamImp->Flush(); } -FX_BOOL CFX_Stream::SetLength(int32_t iLength) { +bool CFX_Stream::SetLength(int32_t iLength) { if (!m_pStreamImp) { - return FALSE; + return false; } if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) { - return FALSE; + return false; } return m_pStreamImp->SetLength(iLength); } @@ -1465,7 +1447,7 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess, pShared->m_iStart = iStart; pShared->m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iLength; if (dwAccess & FX_STREAMACCESS_Text) { - return IFX_Stream::CreateTextStream(pShared, TRUE); + return IFX_Stream::CreateTextStream(pShared, true); } return pShared; } diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h index 34d684f9ca..674007e935 100644 --- a/xfa/fgas/crt/fgas_stream.h +++ b/xfa/fgas/crt/fgas_stream.h @@ -36,7 +36,7 @@ class IFX_Stream { int32_t length, uint32_t dwAccess); static IFX_Stream* CreateTextStream(IFX_Stream* pBaseStream, - FX_BOOL bDeleteOnRelease); + bool bDeleteOnRelease); virtual ~IFX_Stream() {} virtual void Release() = 0; virtual IFX_Stream* Retain() = 0; @@ -49,15 +49,15 @@ class IFX_Stream { virtual int32_t GetLength() const = 0; virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0; virtual int32_t GetPosition() = 0; - virtual FX_BOOL IsEOF() const = 0; + virtual bool IsEOF() const = 0; virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, - FX_BOOL& bEOS) = 0; + bool& bEOS) = 0; virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; virtual void Flush() = 0; - virtual FX_BOOL SetLength(int32_t iLength) = 0; + virtual bool SetLength(int32_t iLength) = 0; virtual int32_t GetBOM(uint8_t bom[4]) const = 0; virtual uint16_t GetCodePage() const = 0; virtual uint16_t SetCodePage(uint16_t wCodePage) = 0; diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp index 150a65af19..0cdbf77d31 100644 --- a/xfa/fgas/crt/fgas_utils.cpp +++ b/xfa/fgas/crt/fgas_utils.cpp @@ -38,7 +38,7 @@ CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) { m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize); } CFX_BaseArray::~CFX_BaseArray() { - RemoveAll(FALSE); + RemoveAll(false); delete m_pData; } int32_t CFX_BaseArray::GetSize() const { @@ -114,7 +114,7 @@ int32_t CFX_BaseArray::Copy(const CFX_BaseArray& src, if (iCount < 1) { return 0; } - RemoveAll(TRUE); + RemoveAll(true); AddSpaceTo(iCount - 1); FXSYS_memcpy(m_pData->pBuffer, src.m_pData->pBuffer + iStart * iBlockSize, iCount * iBlockSize); @@ -130,7 +130,7 @@ int32_t CFX_BaseArray::RemoveLast(int32_t iCount) { } return iCount; } -void CFX_BaseArray::RemoveAll(FX_BOOL bLeaveMemory) { +void CFX_BaseArray::RemoveAll(bool bLeaveMemory) { if (!bLeaveMemory) { uint8_t*& pBuffer = m_pData->pBuffer; if (pBuffer) { @@ -153,7 +153,7 @@ CFX_BaseMassArrayImp::CFX_BaseMassArrayImp(int32_t iChunkSize, m_pData->SetSize(16); } CFX_BaseMassArrayImp::~CFX_BaseMassArrayImp() { - RemoveAll(FALSE); + RemoveAll(false); delete m_pData; } uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) { @@ -163,7 +163,7 @@ uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) { pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); } else { int32_t iMemSize = m_iChunkSize * m_iBlockSize; - while (TRUE) { + while (true) { if (index < m_iChunkCount * m_iChunkSize) { pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); break; @@ -218,7 +218,7 @@ int32_t CFX_BaseMassArrayImp::Copy(const CFX_BaseMassArrayImp& src, if (iStart >= iCopied) { return 0; } - RemoveAll(TRUE); + RemoveAll(true); if (iCount < 0) { iCount = iCopied; } @@ -289,7 +289,7 @@ int32_t CFX_BaseMassArrayImp::RemoveLast(int32_t iCount) { } return m_iBlockCount; } -void CFX_BaseMassArrayImp::RemoveAll(FX_BOOL bLeaveMemory) { +void CFX_BaseMassArrayImp::RemoveAll(bool bLeaveMemory) { if (bLeaveMemory) { m_iBlockCount = 0; return; @@ -329,7 +329,7 @@ int32_t CFX_BaseMassArray::Copy(const CFX_BaseMassArray& src, int32_t CFX_BaseMassArray::RemoveLast(int32_t iCount) { return m_pData->RemoveLast(iCount); } -void CFX_BaseMassArray::RemoveAll(FX_BOOL bLeaveMemory) { +void CFX_BaseMassArray::RemoveAll(bool bLeaveMemory) { m_pData->RemoveAll(bLeaveMemory); } @@ -427,6 +427,6 @@ int32_t CFX_BaseStack::GetSize() const { uint8_t* CFX_BaseStack::GetAt(int32_t index) const { return m_pData->GetAt(index); } -void CFX_BaseStack::RemoveAll(FX_BOOL bLeaveMemory) { +void CFX_BaseStack::RemoveAll(bool bLeaveMemory) { m_pData->RemoveAll(bLeaveMemory); } diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h index c45f42405f..5565733c26 100644 --- a/xfa/fgas/crt/fgas_utils.h +++ b/xfa/fgas/crt/fgas_utils.h @@ -25,7 +25,7 @@ class CFX_BaseArray : public CFX_Target { int32_t Append(const CFX_BaseArray& src, int32_t iStart, int32_t iCount); int32_t Copy(const CFX_BaseArray& src, int32_t iStart, int32_t iCount); int32_t RemoveLast(int32_t iCount); - void RemoveAll(FX_BOOL bLeaveMemory); + void RemoveAll(bool bLeaveMemory); FX_BASEARRAYDATA* m_pData; }; @@ -74,9 +74,7 @@ class CFX_BaseArrayTemplate : public CFX_BaseArray { int32_t RemoveLast(int32_t iCount) { return CFX_BaseArray::RemoveLast(iCount); } - void RemoveAll(FX_BOOL bLeaveMemory) { - CFX_BaseArray::RemoveAll(bLeaveMemory); - } + void RemoveAll(bool bLeaveMemory) { CFX_BaseArray::RemoveAll(bLeaveMemory); } }; class CFX_BaseMassArrayImp : public CFX_Target { @@ -92,7 +90,7 @@ class CFX_BaseMassArrayImp : public CFX_Target { int32_t iCount); int32_t Copy(const CFX_BaseMassArrayImp& src, int32_t iStart, int32_t iCount); int32_t RemoveLast(int32_t iCount); - void RemoveAll(FX_BOOL bLeaveMemory); + void RemoveAll(bool bLeaveMemory); int32_t m_iChunkSize; int32_t m_iBlockSize; @@ -118,7 +116,7 @@ class CFX_BaseMassArray : public CFX_Target { int32_t Append(const CFX_BaseMassArray& src, int32_t iStart, int32_t iCount); int32_t Copy(const CFX_BaseMassArray& src, int32_t iStart, int32_t iCount); int32_t RemoveLast(int32_t iCount); - void RemoveAll(FX_BOOL bLeaveMemory); + void RemoveAll(bool bLeaveMemory); CFX_BaseMassArrayImp* m_pData; }; @@ -165,7 +163,7 @@ class CFX_MassArrayTemplate : public CFX_BaseMassArray { int32_t RemoveLast(int32_t iCount) { return CFX_BaseMassArray::RemoveLast(iCount); } - void RemoveAll(FX_BOOL bLeaveMemory) { + void RemoveAll(bool bLeaveMemory) { CFX_BaseMassArray::RemoveAll(bLeaveMemory); } }; @@ -175,7 +173,7 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { public: CFX_ObjectMassArrayTemplate(int32_t iChunkSize) : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} - ~CFX_ObjectMassArrayTemplate() { RemoveAll(FALSE); } + ~CFX_ObjectMassArrayTemplate() { RemoveAll(false); } int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); } int32_t Add(const baseType& element) { @@ -225,7 +223,7 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { if (iEnd > iSize) { iEnd = iSize; } - RemoveAll(TRUE); + RemoveAll(true); for (int32_t i = iStart; i < iEnd; i++) { Add(src.GetAt(i)); } @@ -244,7 +242,7 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { } return CFX_BaseMassArray::RemoveLast(iCount); } - void RemoveAll(FX_BOOL bLeaveMemory) { + void RemoveAll(bool bLeaveMemory) { int32_t iSize = CFX_BaseMassArray::GetSize(); for (int32_t i = 0; i < iSize; i++) { ((baseType*)GetPtrAt(i))->~baseType(); @@ -293,7 +291,7 @@ class CFX_BaseStack : public CFX_Target { uint8_t* GetTopElement() const; int32_t GetSize() const; uint8_t* GetAt(int32_t index) const; - void RemoveAll(FX_BOOL bLeaveMemory); + void RemoveAll(bool bLeaveMemory); CFX_BaseMassArrayImp* m_pData; }; @@ -316,9 +314,7 @@ class CFX_StackTemplate : public CFX_BaseStack { baseType* GetAt(int32_t index) const { return (baseType*)CFX_BaseStack::GetAt(index); } - void RemoveAll(FX_BOOL bLeaveMemory) { - CFX_BaseStack::RemoveAll(bLeaveMemory); - } + void RemoveAll(bool bLeaveMemory) { CFX_BaseStack::RemoveAll(bLeaveMemory); } }; template <class baseType> @@ -326,7 +322,7 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack { public: CFX_ObjectStackTemplate(int32_t iChunkSize) : CFX_BaseStack(iChunkSize, sizeof(baseType)) {} - ~CFX_ObjectStackTemplate() { RemoveAll(FALSE); } + ~CFX_ObjectStackTemplate() { RemoveAll(false); } int32_t Push(const baseType& element) { int32_t index = CFX_BaseStack::GetSize(); @@ -348,7 +344,7 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack { baseType* GetAt(int32_t index) const { return (baseType*)CFX_BaseStack::GetAt(index); } - void RemoveAll(FX_BOOL bLeaveMemory) { + void RemoveAll(bool bLeaveMemory) { int32_t iSize = CFX_BaseStack::GetSize(); for (int32_t i = 0; i < iSize; i++) { ((baseType*)CFX_BaseStack::GetAt(i))->~baseType(); @@ -370,7 +366,7 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack { if (iEnd > iSize) { iEnd = iSize; } - RemoveAll(TRUE); + RemoveAll(true); for (int32_t i = iStart; i < iEnd; i++) { Push(*src.GetAt(i)); } diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index 07bfc1daea..dbc4ec2f3b 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -111,7 +111,7 @@ class IFGAS_FontMgr { const FX_WCHAR* pszFontAlias = nullptr, uint32_t dwFontStyles = 0, uint16_t wCodePage = 0, - FX_BOOL bSaveStream = FALSE) = 0; + bool bSaveStream = false) = 0; virtual CFGAS_GEFont* LoadFont(CFGAS_GEFont* pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) = 0; diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index d83db63343..b78cfe516a 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -73,7 +73,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const uint8_t* pBuffer, // static CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, IFGAS_FontMgr* pFontMgr, - FX_BOOL bSaveStream) { + bool bSaveStream) { CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); if (!pFont->LoadFontInternal(pFontStream, bSaveStream)) { pFont->Release(); @@ -86,7 +86,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr) : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - m_bUseLogFontStyle(FALSE), + m_bUseLogFontStyle(false), m_dwLogFontStyle(0), #endif m_pFont(nullptr), @@ -100,7 +100,7 @@ CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr) CFGAS_GEFont::CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles) : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - m_bUseLogFontStyle(FALSE), + m_bUseLogFontStyle(false), m_dwLogFontStyle(0), #endif m_pFont(nullptr), @@ -156,11 +156,11 @@ CFGAS_GEFont* CFGAS_GEFont::Retain() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +bool CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { if (m_pFont) { - return FALSE; + return false; } CFX_ByteString csFontFamily; if (pszFontFamily) { @@ -198,64 +198,62 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, } else if (dwFlags & FXFONT_ITALIC) { csFontFamily += ",Italic"; } - m_pFont->LoadSubst(csFontFamily, TRUE, dwFlags, iWeight, 0, wCodePage, false); + m_pFont->LoadSubst(csFontFamily, true, dwFlags, iWeight, 0, wCodePage, false); if (!m_pFont->GetFace()) return false; return InitFont(); } -FX_BOOL CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) { +bool CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) { if (m_pFont) - return FALSE; + return false; m_pFont = new CFX_Font; if (!m_pFont->LoadEmbedded(pBuffer, length)) - return FALSE; + return false; return InitFont(); } -FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, - FX_BOOL bSaveStream) { +bool CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream) { if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1) - return FALSE; + return false; if (bSaveStream) m_pStream.reset(pFontStream); - m_pFileRead.reset(FX_CreateFileRead(pFontStream, FALSE)); + m_pFileRead.reset(FX_CreateFileRead(pFontStream, false)); m_pFont = new CFX_Font; if (m_pFont->LoadFile(m_pFileRead.get())) return InitFont(); m_pFileRead.reset(); - return FALSE; + return false; } #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) { +bool CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) { if (m_pFont || !pExternalFont) - return FALSE; + return false; m_pFont = pExternalFont; m_bExternalFont = true; return InitFont(); } -FX_BOOL CFGAS_GEFont::LoadFontInternal( - std::unique_ptr<CFX_Font> pInternalFont) { +bool CFGAS_GEFont::LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont) { if (m_pFont || !pInternalFont) - return FALSE; + return false; m_pFont = pInternalFont.release(); m_bExternalFont = false; return InitFont(); } -FX_BOOL CFGAS_GEFont::InitFont() { +bool CFGAS_GEFont::InitFont() { if (!m_pFont) - return FALSE; + return false; if (!m_pFontEncoding) { m_pFontEncoding.reset(FX_CreateFontEncodingEx(m_pFont)); if (!m_pFontEncoding) - return FALSE; + return false; } if (!m_pCharWidthMap) m_pCharWidthMap.reset(new CFX_DiscreteArrayTemplate<uint16_t>(1024)); @@ -264,7 +262,7 @@ FX_BOOL CFGAS_GEFont::InitFont() { if (!m_pBBoxMap) m_pBBoxMap.reset(new CFX_MapPtrToPtr(16)); - return TRUE; + return true; } CFGAS_GEFont* CFGAS_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { @@ -306,28 +304,28 @@ uint32_t CFGAS_GEFont::GetFontStyles() const { return dwStyles; } -FX_BOOL CFGAS_GEFont::GetCharWidth(FX_WCHAR wUnicode, - int32_t& iWidth, - bool bCharCode) { +bool CFGAS_GEFont::GetCharWidth(FX_WCHAR wUnicode, + int32_t& iWidth, + bool bCharCode) { return GetCharWidthInternal(wUnicode, iWidth, true, bCharCode); } -FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, - int32_t& iWidth, - bool bRecursive, - bool bCharCode) { +bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, + int32_t& iWidth, + bool bRecursive, + bool bCharCode) { ASSERT(m_pCharWidthMap); iWidth = m_pCharWidthMap->GetAt(wUnicode, 0); if (iWidth == 65535) - return FALSE; + return false; if (iWidth > 0) - return TRUE; + return true; if (!m_pProvider || !m_pProvider->GetCharWidth(this, wUnicode, bCharCode, &iWidth)) { CFGAS_GEFont* pFont = nullptr; - int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); + int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont) { if (pFont == this) { iWidth = m_pFont->GetGlyphWidth(iGlyph); @@ -336,7 +334,7 @@ FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, } } else if (pFont->GetCharWidthInternal(wUnicode, iWidth, false, bCharCode)) { - return TRUE; + return true; } } else { iWidth = -1; @@ -346,22 +344,22 @@ FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, return iWidth > 0; } -FX_BOOL CFGAS_GEFont::GetCharBBox(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bCharCode) { - return GetCharBBoxInternal(wUnicode, bbox, TRUE, bCharCode); +bool CFGAS_GEFont::GetCharBBox(FX_WCHAR wUnicode, + CFX_Rect& bbox, + bool bCharCode) { + return GetCharBBoxInternal(wUnicode, bbox, true, bCharCode); } -FX_BOOL CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bRecursive, - FX_BOOL bCharCode) { +bool CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, + CFX_Rect& bbox, + bool bRecursive, + bool bCharCode) { ASSERT(m_pRectArray); ASSERT(m_pBBoxMap); void* pRect = nullptr; if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) { CFGAS_GEFont* pFont = nullptr; - int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); + int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont) { if (pFont == this) { FX_RECT rtBBox; @@ -372,20 +370,20 @@ FX_BOOL CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, pRect = m_pRectArray->GetPtrAt(index); m_pBBoxMap->SetAt((void*)(uintptr_t)wUnicode, pRect); } - } else if (pFont->GetCharBBoxInternal(wUnicode, bbox, FALSE, bCharCode)) { - return TRUE; + } else if (pFont->GetCharBBoxInternal(wUnicode, bbox, false, bCharCode)) { + return true; } } } if (!pRect) - return FALSE; + return false; bbox = *static_cast<const CFX_Rect*>(pRect); - return TRUE; + return true; } -FX_BOOL CFGAS_GEFont::GetBBox(CFX_Rect& bbox) { +bool CFGAS_GEFont::GetBBox(CFX_Rect& bbox) { FX_RECT rt(0, 0, 0, 0); - FX_BOOL bRet = m_pFont->GetBBox(rt); + bool bRet = m_pFont->GetBBox(rt); if (bRet) { bbox.left = rt.left; bbox.width = rt.Width(); @@ -400,13 +398,13 @@ int32_t CFGAS_GEFont::GetItalicAngle() const { } return m_pFont->GetSubstFont()->m_ItalicAngle; } -int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode) { - return GetGlyphIndex(wUnicode, TRUE, nullptr, bCharCode); +int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode) { + return GetGlyphIndex(wUnicode, true, nullptr, bCharCode); } int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, - FX_BOOL bRecursive, + bool bRecursive, CFGAS_GEFont** ppFont, - FX_BOOL bCharCode) { + bool bCharCode) { ASSERT(m_pFontEncoding); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { @@ -426,7 +424,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, auto it = m_FontMapper.find(wUnicode); CFGAS_GEFont* pFont = it != m_FontMapper.end() ? it->second : nullptr; if (pFont && pFont != this) { - iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); + iGlyphIndex = pFont->GetGlyphIndex(wUnicode, false, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { int32_t i = m_SubstFonts.Find(pFont); if (i > -1) { @@ -457,7 +455,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, m_FontMapper[wUnicode] = pFont; int32_t i = m_SubstFonts.GetSize(); m_SubstFonts.Add(pFont); - iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); + iGlyphIndex = pFont->GetGlyphIndex(wUnicode, false, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { iGlyphIndex |= ((i + 1) << 24); if (ppFont) @@ -484,7 +482,7 @@ void CFGAS_GEFont::Reset() { m_pBBoxMap->RemoveAll(); } if (m_pRectArray) { - m_pRectArray->RemoveAll(FALSE); + m_pRectArray->RemoveAll(false); } } CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const { diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h index 7245e836a1..4ce61f3989 100644 --- a/xfa/fgas/font/fgas_gefont.h +++ b/xfa/fgas/font/fgas_gefont.h @@ -34,7 +34,7 @@ class CFGAS_GEFont { IFGAS_FontMgr* pFontMgr); static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, IFGAS_FontMgr* pFontMgr, - FX_BOOL bSaveStream); + bool bSaveStream); #endif ~CFGAS_GEFont(); @@ -44,14 +44,12 @@ class CFGAS_GEFont { CFGAS_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); void GetFamilyName(CFX_WideString& wsFamily) const; uint32_t GetFontStyles() const; - FX_BOOL GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode); - int32_t GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode = FALSE); + bool GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode); + int32_t GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode = false); int32_t GetAscent() const; int32_t GetDescent() const; - FX_BOOL GetCharBBox(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bCharCode = FALSE); - FX_BOOL GetBBox(CFX_Rect& bbox); + bool GetCharBBox(FX_WCHAR wUnicode, CFX_Rect& bbox, bool bCharCode = false); + bool GetBBox(CFX_Rect& bbox); int32_t GetItalicAngle() const; void Reset(); CFGAS_GEFont* GetSubstFont(int32_t iGlyphIndex) const; @@ -59,7 +57,7 @@ class CFGAS_GEFont { void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; } #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ void SetLogicalFontStyle(uint32_t dwLogFontStyle) { - m_bUseLogFontStyle = TRUE; + m_bUseLogFontStyle = true; m_dwLogFontStyle = dwLogFontStyle; } #endif @@ -69,30 +67,30 @@ class CFGAS_GEFont { CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); - FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); + bool LoadFontInternal(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); + bool LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream); #endif - FX_BOOL LoadFontInternal(CFX_Font* pExternalFont); - FX_BOOL LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); - FX_BOOL InitFont(); - FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bRecursive, - FX_BOOL bCharCode = FALSE); - FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, - int32_t& iWidth, - bool bRecursive, - bool bCharCode); + bool LoadFontInternal(CFX_Font* pExternalFont); + bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); + bool InitFont(); + bool GetCharBBoxInternal(FX_WCHAR wUnicode, + CFX_Rect& bbox, + bool bRecursive, + bool bCharCode = false); + bool GetCharWidthInternal(FX_WCHAR wUnicode, + int32_t& iWidth, + bool bRecursive, + bool bCharCode); int32_t GetGlyphIndex(FX_WCHAR wUnicode, - FX_BOOL bRecursive, + bool bRecursive, CFGAS_GEFont** ppFont, - FX_BOOL bCharCode = FALSE); + bool bCharCode = false); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - FX_BOOL m_bUseLogFontStyle; + bool m_bUseLogFontStyle; uint32_t m_dwLogFontStyle; #endif CFX_Font* m_pFont; diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 646eb94696..d4907bb919 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -37,7 +37,7 @@ CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) } CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() { - m_FontFaces.RemoveAll(FALSE); + m_FontFaces.RemoveAll(false); m_CPFonts.RemoveAll(); m_FamilyFonts.RemoveAll(); m_UnicodeFonts.RemoveAll(); @@ -58,11 +58,11 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; } FX_FONTDESCRIPTOR const* pFD = - FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); + FindFont(pszFontFamily, dwFontStyles, true, wCodePage); if (!pFD) - pFD = FindFont(nullptr, dwFontStyles, TRUE, wCodePage); + pFD = FindFont(nullptr, dwFontStyles, true, wCodePage); if (!pFD) - pFD = FindFont(nullptr, dwFontStyles, FALSE, wCodePage); + pFD = FindFont(nullptr, dwFontStyles, false, wCodePage); if (!pFD) return nullptr; @@ -101,10 +101,10 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByUnicode( return pFont ? LoadFont(pFont, dwFontStyles, pRet->wCodePage) : nullptr; FX_FONTDESCRIPTOR const* pFD = - FindFont(pszFontFamily, dwFontStyles, FALSE, pRet->wCodePage, + FindFont(pszFontFamily, dwFontStyles, false, pRet->wCodePage, pRet->wBitField, wUnicode); if (!pFD && pszFontFamily) { - pFD = FindFont(nullptr, dwFontStyles, FALSE, pRet->wCodePage, + pFD = FindFont(nullptr, dwFontStyles, false, pRet->wCodePage, pRet->wBitField, wUnicode); } if (!pFD) @@ -143,9 +143,9 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; } FX_FONTDESCRIPTOR const* pFD = - FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); + FindFont(pszFontFamily, dwFontStyles, true, wCodePage); if (!pFD) - pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage); + pFD = FindFont(pszFontFamily, dwFontStyles, false, wCodePage); if (!pFD) return nullptr; @@ -186,7 +186,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, const FX_WCHAR* pszFontAlias, uint32_t dwFontStyles, uint16_t wCodePage, - FX_BOOL bSaveStream) { + bool bSaveStream) { ASSERT(pFontStream && pFontStream->GetLength() > 0); CFGAS_GEFont* pFont = nullptr; if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { @@ -321,8 +321,7 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors& fonts) { FX_FONTDESCRIPTOR const* pBestFont = nullptr; int32_t iBestSimilar = 0; - FX_BOOL bMatchStyle = - (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; + bool bMatchStyle = (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; int32_t iCount = fonts.GetSize(); for (int32_t i = 0; i < iCount; ++i) { FX_FONTDESCRIPTOR const* pFont = fonts.GetPtrAt(i); @@ -597,15 +596,15 @@ CFGAS_FontMgrImp::~CFGAS_FontMgrImp() { } } -FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFontMapper() { +bool CFGAS_FontMgrImp::EnumFontsFromFontMapper() { CFX_FontMapper* pFontMapper = CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper(); if (!pFontMapper) - return FALSE; + return false; IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); if (!pSystemFontInfo) - return FALSE; + return false; pSystemFontInfo->EnumFontList(pFontMapper); for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { @@ -620,12 +619,12 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFontMapper() { pFontStream->Release(); } if (m_InstalledFonts.GetSize() == 0) - return FALSE; + return false; - return TRUE; + return true; } -FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() { +bool CFGAS_FontMgrImp::EnumFontsFromFiles() { CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary(); FX_POSITION pos = m_pFontSource->GetStartPosition(); IFX_FileAccess* pFontSource = nullptr; @@ -642,13 +641,13 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() { pFontSource->Release(); } if (m_InstalledFonts.GetSize() == 0) - return FALSE; - return TRUE; + return false; + return true; } -FX_BOOL CFGAS_FontMgrImp::EnumFonts() { +bool CFGAS_FontMgrImp::EnumFonts() { if (EnumFontsFromFontMapper()) - return TRUE; + return true; return EnumFontsFromFiles(); } @@ -781,39 +780,38 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( return nullptr; } -FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, - FX_WCHAR wcUnicode) { +bool CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, + FX_WCHAR wcUnicode) { IFX_SeekableReadStream* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) - return FALSE; + return false; FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex); FT_Error retCharmap = FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE); FT_Error retIndex = FXFT_Get_Char_Index(pFace, wcUnicode); pFileRead->Release(); if (!pFace) - return FALSE; + return false; if (FXFT_Get_Face_External_Stream(pFace)) FXFT_Clear_Face_External_Stream(pFace); FXFT_Done_Face(pFace); return !retCharmap && retIndex; } -FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFGAS_GEFont* pFont, - FX_WCHAR wcUnicode) { +bool CFGAS_FontMgrImp::VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode) { if (!pFont) - return FALSE; + return false; FXFT_Face pFace = pFont->GetDevFont()->GetFace(); FXFT_CharMap charmap = FXFT_Get_Face_Charmap(pFace); if (FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE) != 0) - return FALSE; + return false; if (FXFT_Get_Char_Index(pFace, wcUnicode) == 0) { FXFT_Set_Charmap(pFace, charmap); - return FALSE; + return false; } - return TRUE; + return true; } CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByLanguage( @@ -934,7 +932,7 @@ IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream( uint8_t* pBuffer = FX_Alloc(uint8_t, dwFileSize + 1); dwFileSize = pSystemFontInfo->GetFontData(hFont, 0, pBuffer, dwFileSize); - return FX_CreateMemoryStream(pBuffer, dwFileSize, TRUE); + return FX_CreateMemoryStream(pBuffer, dwFileSize, true); } IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream( diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index fd7f9cd318..2c7a1a2fdd 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -52,7 +52,7 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { const FX_WCHAR* pszFontAlias = nullptr, uint32_t dwFontStyles = 0, uint16_t wCodePage = 0, - FX_BOOL bSaveStream = FALSE) override; + bool bSaveStream = false) override; CFGAS_GEFont* LoadFont(CFGAS_GEFont* pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) override; @@ -178,9 +178,9 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { CFGAS_GEFont* LoadFont(const CFX_WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount); - FX_BOOL EnumFonts(); - FX_BOOL EnumFontsFromFontMapper(); - FX_BOOL EnumFontsFromFiles(); + bool EnumFonts(); + bool EnumFontsFromFontMapper(); + bool EnumFontsFromFiles(); protected: void RegisterFace(FXFT_Face pFace, @@ -191,8 +191,8 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); - FX_BOOL VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); - FX_BOOL VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode); + bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); + bool VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode); int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, uint16_t wCodePage, diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index dfe066f7f4..642fe73bc7 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -28,7 +28,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) m_iFontSize(240), m_iTabWidth(720000), m_PositionedTabs(), - m_bOrphanLine(FALSE), + m_bOrphanLine(false), m_wDefChar(0xFEFF), m_iDefChar(0), m_wLineBreakChar(L'\n'), @@ -38,9 +38,9 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) m_iCharRotation(0), m_iRotation(0), m_iCharSpace(0), - m_bWordSpace(FALSE), + m_bWordSpace(false), m_iWordSpace(0), - m_bRTL(FALSE), + m_bRTL(false), m_iAlignment(FX_RTFLINEALIGNMENT_Left), m_pUserData(nullptr), m_eCharType(FX_CHARTYPE_Unknown), @@ -105,7 +105,7 @@ void CFX_RTFBreak::SetFont(CFGAS_GEFont* pFont) { if (m_pFont) { m_iFontHeight = m_iFontSize; if (m_wDefChar != 0xFEFF) { - m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); + m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false); m_iDefChar *= m_iFontSize; } } @@ -121,7 +121,7 @@ void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) { if (m_pFont) { m_iFontHeight = m_iFontSize; if (m_wDefChar != 0xFEFF) { - m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); + m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false); m_iDefChar *= m_iFontSize; } } @@ -149,7 +149,7 @@ void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) { if (m_dwPolicies & FX_RTFBREAKPOLICY_OrphanPositionedTab) { m_bOrphanLine = GetLastPositionedTab() >= iLineEnd; } else { - m_bOrphanLine = FALSE; + m_bOrphanLine = false; } } void CFX_RTFBreak::SetPositionedTabs(const CFX_FloatArray& tabs) { @@ -168,18 +168,18 @@ void CFX_RTFBreak::SetPositionedTabs(const CFX_FloatArray& tabs) { if (m_dwPolicies & FX_RTFBREAKPOLICY_OrphanPositionedTab) { m_bOrphanLine = GetLastPositionedTab() >= iLineEnd; } else { - m_bOrphanLine = FALSE; + m_bOrphanLine = false; } } void CFX_RTFBreak::ClearPositionedTabs() { m_PositionedTabs.RemoveAll(); - m_bOrphanLine = FALSE; + m_bOrphanLine = false; } void CFX_RTFBreak::SetDefaultChar(FX_WCHAR wch) { m_wDefChar = wch; m_iDefChar = 0; if (m_wDefChar != 0xFEFF && m_pFont) { - m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); + m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false); if (m_iDefChar < 0) { m_iDefChar = 0; } else { @@ -233,11 +233,11 @@ void CFX_RTFBreak::SetCharRotation(int32_t iCharRotation) { void CFX_RTFBreak::SetCharSpace(FX_FLOAT fCharSpace) { m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f); } -void CFX_RTFBreak::SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace) { +void CFX_RTFBreak::SetWordSpace(bool bDefault, FX_FLOAT fWordSpace) { m_bWordSpace = !bDefault; m_iWordSpace = FXSYS_round(fWordSpace * 20000.0f); } -void CFX_RTFBreak::SetReadingOrder(FX_BOOL bRTL) { +void CFX_RTFBreak::SetReadingOrder(bool bRTL) { m_bRTL = bRTL; } void CFX_RTFBreak::SetAlignment(int32_t iAlignment) { @@ -292,7 +292,7 @@ CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const { } return nullptr; } -CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const { +CFX_RTFLine* CFX_RTFBreak::GetRTFLine(bool bReady) const { if (bReady) { if (m_iReady == 1) { return (CFX_RTFLine*)&m_RTFLine1; @@ -305,7 +305,7 @@ CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const { ASSERT(m_pCurLine); return m_pCurLine; } -CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces(FX_BOOL bReady) const { +CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces(bool bReady) const { CFX_RTFLine* pRTFLine = GetRTFLine(bReady); return pRTFLine ? &pRTFLine->m_LinePieces : nullptr; } @@ -320,15 +320,15 @@ int32_t CFX_RTFBreak::GetLastPositionedTab() const { } return m_PositionedTabs[iCount - 1]; } -FX_BOOL CFX_RTFBreak::GetPositionedTab(int32_t& iTabPos) const { +bool CFX_RTFBreak::GetPositionedTab(int32_t& iTabPos) const { int32_t iCount = m_PositionedTabs.GetSize(); for (int32_t i = 0; i < iCount; i++) { if (m_PositionedTabs[i] > iTabPos) { iTabPos = m_PositionedTabs[i]; - return TRUE; + return true; } } - return FALSE; + return false; } typedef uint32_t (CFX_RTFBreak::*FX_RTFBreak_LPFAppendChar)( CFX_RTFChar* pCurChar, @@ -420,7 +420,7 @@ uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) { if (m_bVertical != FX_IsOdd(m_iRotation)) { iCharWidth = 1000; } else { - if (!m_pFont->GetCharWidth(wch, iCharWidth, TRUE)) { + if (!m_pFont->GetCharWidth(wch, iCharWidth, true)) { iCharWidth = m_iDefChar; } } @@ -465,7 +465,7 @@ uint32_t CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar, uint32_t CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation) { if (m_dwLayoutStyles & FX_RTFLAYOUTSTYLE_ExpandTab) { - FX_BOOL bBreak = FALSE; + bool bBreak = false; if ((m_dwPolicies & FX_RTFBREAKPOLICY_TabBreak) != 0) { bBreak = (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance); } @@ -518,7 +518,7 @@ uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t& iLineWidth = m_pCurLine->m_iWidth; int32_t iCharWidth = 0; FX_WCHAR wForm; - FX_BOOL bAlef = FALSE; + bool bAlef = false; if (m_eCharType >= FX_CHARTYPE_ArabicAlef && m_eCharType <= FX_CHARTYPE_ArabicDistortion) { pLastChar = GetLastChar(1); @@ -625,7 +625,7 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) { return dwStatus; } - CFX_RTFLine* pLastLine = GetRTFLine(TRUE); + CFX_RTFLine* pLastLine = GetRTFLine(true); if (pLastLine) { pCurPieces = &pLastLine->m_LinePieces; iCount = pCurPieces->GetSize(); @@ -651,7 +651,7 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) { m_iReady = (m_pCurLine == &m_RTFLine1) ? 1 : 2; CFX_RTFLine* pNextLine = (m_pCurLine == &m_RTFLine1) ? &m_RTFLine2 : &m_RTFLine1; - FX_BOOL bAllChars = (m_iAlignment > FX_RTFLINEALIGNMENT_Right); + bool bAllChars = (m_iAlignment > FX_RTFLINEALIGNMENT_Right); CFX_TPOArray tpos(100); if (!EndBreak_SplitLine(pNextLine, bAllChars, dwStatus)) { if (!m_bCharCode) @@ -668,10 +668,10 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) { return dwStatus; } -FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, - FX_BOOL bAllChars, - uint32_t dwStatus) { - FX_BOOL bDone = FALSE; +bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, + bool bAllChars, + uint32_t dwStatus) { + bool bDone = false; if (!m_bSingleLine && !m_bOrphanLine && m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) { CFX_RTFChar& tc = m_pCurLine->GetChar(m_pCurLine->CountChars() - 1); @@ -679,7 +679,7 @@ FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, case FX_CHARTYPE_Tab: if ((m_dwPolicies & FX_RTFBREAKPOLICY_TabBreak) != 0) { SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); - bDone = TRUE; + bDone = true; } break; case FX_CHARTYPE_Control: @@ -687,12 +687,12 @@ FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, case FX_CHARTYPE_Space: if ((m_dwPolicies & FX_RTFBREAKPOLICY_SpaceBreak) != 0) { SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); - bDone = TRUE; + bDone = true; } break; default: SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); - bDone = TRUE; + bDone = true; break; } } @@ -702,7 +702,7 @@ FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces; CFX_RTFPiece tp; tp.m_pChars = &m_pCurLine->m_LineChars; - FX_BOOL bNew = TRUE; + bool bNew = true; uint32_t dwIdentity = (uint32_t)-1; int32_t iLast = m_pCurLine->CountChars() - 1, j = 0; for (int32_t i = 0; i <= iLast;) { @@ -721,7 +721,7 @@ FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, tp.m_dwIdentity = dwIdentity; tp.m_pUserData = pTC->m_pUserData; j = i; - bNew = FALSE; + bNew = false; } if (i == iLast || pTC->m_dwStatus != FX_RTFBREAK_None || pTC->m_dwIdentity != dwIdentity) { @@ -733,19 +733,19 @@ FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, i++; } pCurPieces->Add(tp); - bNew = TRUE; + bNew = true; } else { tp.m_iWidth += pTC->m_iCharWidth; i++; } } - return TRUE; + return true; } if (bAllChars && !bDone) { int32_t iEndPos = m_pCurLine->GetLineEnd(); - GetBreakPos(m_pCurLine->m_LineChars, iEndPos, bAllChars, TRUE); + GetBreakPos(m_pCurLine->m_LineChars, iEndPos, bAllChars, true); } - return FALSE; + return false; } void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { FX_TPO tpo; @@ -754,8 +754,8 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { int32_t i, j; CFX_RTFCharArray& chars = m_pCurLine->m_LineChars; int32_t iCount = m_pCurLine->CountChars(); - FX_BOOL bDone = (!m_bPagination && !m_bCharCode && - (m_pCurLine->m_iArabicChars > 0 || m_bRTL)); + bool bDone = (!m_bPagination && !m_bCharCode && + (m_pCurLine->m_iArabicChars > 0 || m_bRTL)); if (bDone) { int32_t iBidiNum = 0; for (i = 0; i < iCount; i++) { @@ -844,12 +844,12 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { } } void CFX_RTFBreak::EndBreak_Alignment(CFX_TPOArray& tpos, - FX_BOOL bAllChars, + bool bAllChars, uint32_t dwStatus) { CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces; int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth; int32_t iCount = pCurPieces->GetSize(); - FX_BOOL bFind = FALSE; + bool bFind = false; uint32_t dwCharType; int32_t i, j; FX_TPO tpo; @@ -859,7 +859,7 @@ void CFX_RTFBreak::EndBreak_Alignment(CFX_TPOArray& tpos, if (!bFind) { iNetWidth = ttp.GetEndPos(); } - FX_BOOL bArabic = FX_IsOdd(ttp.m_iBidiLevel); + bool bArabic = FX_IsOdd(ttp.m_iBidiLevel); j = bArabic ? 0 : ttp.m_iChars - 1; while (j > -1 && j < ttp.m_iChars) { const CFX_RTFChar& tc = ttp.GetChar(j); @@ -877,7 +877,7 @@ void CFX_RTFBreak::EndBreak_Alignment(CFX_TPOArray& tpos, } } } else { - bFind = TRUE; + bFind = true; if (!bAllChars) { break; } @@ -936,8 +936,8 @@ void CFX_RTFBreak::EndBreak_Alignment(CFX_TPOArray& tpos, int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca, int32_t& iEndPos, - FX_BOOL bAllChars, - FX_BOOL bOnlyBrk) { + bool bAllChars, + bool bOnlyBrk) { int32_t iLength = tca.GetSize() - 1; if (iLength < 1) return iLength; @@ -966,10 +966,10 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca, } return iLength; } - FX_BOOL bSpaceBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_SpaceBreak) != 0; - FX_BOOL bTabBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_TabBreak) != 0; - FX_BOOL bNumberBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_NumberBreak) != 0; - FX_BOOL bInfixBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_InfixBreak) != 0; + bool bSpaceBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_SpaceBreak) != 0; + bool bTabBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_TabBreak) != 0; + bool bNumberBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_NumberBreak) != 0; + bool bInfixBreak = (m_dwPolicies & FX_RTFBREAKPOLICY_InfixBreak) != 0; FX_LINEBREAKTYPE eType; uint32_t nCodeProp, nCur, nNext; CFX_RTFChar* pCur = pCharArray + iLength--; @@ -986,7 +986,7 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca, pCur = pCharArray + iLength; nCodeProp = pCur->m_dwCharProps; nCur = nCodeProp & 0x003F; - FX_BOOL bNeedBreak = FALSE; + bool bNeedBreak = false; if (nCur == FX_CBP_SP) { bNeedBreak = !bSpaceBreak; if (nNext == FX_CBP_SP) { @@ -1016,7 +1016,7 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca, } if (!bOnlyBrk) { iCharWidth = pCur->m_iCharWidth; - FX_BOOL bBreak = FALSE; + bool bBreak = false; if (nCur == FX_CBP_TB && bTabBreak) { bBreak = iCharWidth > 0 && iEndPos - iCharWidth <= m_iBoundaryEnd; } else { @@ -1065,7 +1065,7 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca, void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, CFX_RTFLine* pNextLine, - FX_BOOL bAllChars) { + bool bAllChars) { ASSERT(pCurLine && pNextLine); int32_t iCount = pCurLine->CountChars(); if (iCount < 2) { @@ -1073,13 +1073,13 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, } int32_t iEndPos = pCurLine->GetLineEnd(); CFX_RTFCharArray& curChars = pCurLine->m_LineChars; - int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, FALSE); + int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, false); if (iCharPos < 0) { iCharPos = 0; } iCharPos++; if (iCharPos >= iCount) { - pNextLine->RemoveAll(TRUE); + pNextLine->RemoveAll(true); CFX_Char* pTC = curChars.GetDataPtr(iCharPos - 1); pTC->m_nBreakType = FX_LBT_UNKNOWN; return; @@ -1113,12 +1113,12 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine, } int32_t CFX_RTFBreak::CountBreakPieces() const { - CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(TRUE); + CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(true); return pRTFPieces ? pRTFPieces->GetSize() : 0; } const CFX_RTFPiece* CFX_RTFBreak::GetBreakPiece(int32_t index) const { - CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(TRUE); + CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(true); if (!pRTFPieces) return nullptr; @@ -1130,7 +1130,7 @@ const CFX_RTFPiece* CFX_RTFBreak::GetBreakPiece(int32_t index) const { void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const { rect.top = 0; - CFX_RTFLine* pRTFLine = GetRTFLine(TRUE); + CFX_RTFLine* pRTFLine = GetRTFLine(true); if (!pRTFLine) { rect.left = ((FX_FLOAT)m_iBoundaryStart) / 20000.0f; rect.width = rect.height = 0; @@ -1160,20 +1160,20 @@ void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const { rect.height = ((FX_FLOAT)iLineHeight) / 20.0f; } void CFX_RTFBreak::ClearBreakPieces() { - CFX_RTFLine* pRTFLine = GetRTFLine(TRUE); + CFX_RTFLine* pRTFLine = GetRTFLine(true); if (pRTFLine) { - pRTFLine->RemoveAll(TRUE); + pRTFLine->RemoveAll(true); } m_iReady = 0; } void CFX_RTFBreak::Reset() { m_eCharType = FX_CHARTYPE_Unknown; - m_RTFLine1.RemoveAll(TRUE); - m_RTFLine2.RemoveAll(TRUE); + m_RTFLine1.RemoveAll(true); + m_RTFLine2.RemoveAll(true); } int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode, + bool bCharCode, CFX_WideString* pWSForms, FX_AdjustCharDisplayPos pAdjustPos) const { if (!pText || pText->iLength < 1) { @@ -1186,7 +1186,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, CFGAS_GEFont* pFont = pText->pFont; uint32_t dwStyles = pText->dwLayoutStyles; CFX_RectF rtText(*pText->pRect); - FX_BOOL bRTLPiece = FX_IsOdd(pText->iBidiLevel); + bool bRTLPiece = FX_IsOdd(pText->iBidiLevel); FX_FLOAT fFontSize = pText->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); int32_t iAscent = pFont->GetAscent(); @@ -1195,10 +1195,10 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, FX_FLOAT fFontHeight = fFontSize; FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight; FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight; - FX_BOOL bVerticalDoc = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0; - FX_BOOL bVerticalChar = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalChars) != 0; - FX_BOOL bArabicNumber = (dwStyles & FX_RTFLAYOUTSTYLE_ArabicNumber) != 0; - FX_BOOL bMBCSCode = (dwStyles & FX_RTFLAYOUTSTYLE_MBCSCode) != 0; + bool bVerticalDoc = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0; + bool bVerticalChar = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalChars) != 0; + bool bArabicNumber = (dwStyles & FX_RTFLAYOUTSTYLE_ArabicNumber) != 0; + bool bMBCSCode = (dwStyles & FX_RTFLAYOUTSTYLE_MBCSCode) != 0; int32_t iRotation = GetLineRotation(dwStyles) + pText->iCharRotation; int32_t iCharRotation; FX_WCHAR wch, wPrev = 0xFEFF, wNext, wForm; @@ -1206,7 +1206,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, FX_FLOAT fX, fY, fCharWidth, fCharHeight; int32_t iHorScale = pText->iHorizontalScale; int32_t iVerScale = pText->iVerticalScale; - FX_BOOL bEmptyChar; + bool bEmptyChar; uint32_t dwProps, dwCharType; fX = rtText.left; fY = rtText.top; @@ -1245,7 +1245,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, bEmptyChar = (dwCharType >= FX_CHARTYPE_Tab && dwCharType <= FX_CHARTYPE_Control); } else { - bEmptyChar = FALSE; + bEmptyChar = false; } if (!bEmptyChar) { iCount++; @@ -1312,7 +1312,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, } if (!bEmptyChar) { CFX_PointF ptOffset; - FX_BOOL bAdjusted = FALSE; + bool bAdjusted = false; if (pAdjustPos) { bAdjusted = pAdjustPos(wForm, bMBCSCode, pFont, fFontSize, bVerticalChar, ptOffset); @@ -1336,7 +1336,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, } } if (!bEmptyChar) { - pCharPos->m_bGlyphAdjust = TRUE; + pCharPos->m_bGlyphAdjust = true; if (bVerticalDoc) { if (iCharRotation == 0) { pCharPos->m_AdjustMatrix[0] = -1; @@ -1417,7 +1417,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, } int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, CFX_RectFArray& rtArray, - FX_BOOL bCharBBox) const { + bool bCharBBox) const { if (!pText || pText->iLength < 1) { return 0; } @@ -1426,13 +1426,13 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, int32_t* pWidths = pText->pWidths; int32_t iLength = pText->iLength; CFX_RectF rect(*pText->pRect); - FX_BOOL bRTLPiece = FX_IsOdd(pText->iBidiLevel); + bool bRTLPiece = FX_IsOdd(pText->iBidiLevel); FX_FLOAT fFontSize = pText->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); FX_FLOAT fScale = fFontSize / 1000.0f; CFGAS_GEFont* pFont = pText->pFont; if (!pFont) { - bCharBBox = FALSE; + bCharBBox = false; } CFX_Rect bbox; bbox.Set(0, 0, 0, 0); @@ -1444,9 +1444,9 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, rtArray.RemoveAll(); rtArray.SetSize(iLength); uint32_t dwStyles = pText->dwLayoutStyles; - FX_BOOL bVertical = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0; - FX_BOOL bSingleLine = (dwStyles & FX_RTFLAYOUTSTYLE_SingleLine) != 0; - FX_BOOL bCombText = (dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; + bool bVertical = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0; + bool bSingleLine = (dwStyles & FX_RTFLAYOUTSTYLE_SingleLine) != 0; + bool bCombText = (dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; FX_WCHAR wch, wLineBreakChar = pText->wLineBreakChar; int32_t iCharSize; FX_FLOAT fCharSize, fStart; @@ -1459,10 +1459,10 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, wch = *pStr++; iCharSize = *pWidths++; fCharSize = (FX_FLOAT)iCharSize / 20000.0f; - FX_BOOL bRet = (!bSingleLine && FX_IsCtrlCode(wch)); + bool bRet = (!bSingleLine && FX_IsCtrlCode(wch)); if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 || (wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) { - bRet = FALSE; + bRet = false; } if (bRet) { iCharSize = iFontSize * 500; diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 3b8551b72c..d75bbc1d31 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -188,7 +188,7 @@ class CFX_RTFLine { return m_LinePieces.GetPtrAt(index); } int32_t GetLineEnd() const { return m_iStart + m_iWidth; } - void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { + void RemoveAll(bool bLeaveMemory = false) { CFX_RTFChar* pChar; int32_t iCount = m_LineChars.GetSize(); for (int32_t i = 0; i < iCount; i++) { @@ -233,8 +233,8 @@ class CFX_RTFBreak { void SetVerticalScale(int32_t iScale); void SetCharRotation(int32_t iCharRotation); void SetCharSpace(FX_FLOAT fCharSpace); - void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace); - void SetReadingOrder(FX_BOOL bRTL = FALSE); + void SetWordSpace(bool bDefault, FX_FLOAT fWordSpace); + void SetReadingOrder(bool bRTL = false); void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left); void SetUserData(IFX_Retainable* pUserData); uint32_t AppendChar(FX_WCHAR wch); @@ -246,12 +246,12 @@ class CFX_RTFBreak { void Reset(); int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode = FALSE, + bool bCharCode = false, CFX_WideString* pWSForms = nullptr, FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; int32_t GetCharRects(const FX_RTFTEXTOBJ* pText, CFX_RectFArray& rtArray, - FX_BOOL bCharBBox = FALSE) const; + bool bCharBBox = false) const; uint32_t AppendChar_CharCode(FX_WCHAR wch); uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation); uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation); @@ -263,25 +263,25 @@ class CFX_RTFBreak { int32_t GetLineRotation(uint32_t dwStyles) const; void SetBreakStatus(); CFX_RTFChar* GetLastChar(int32_t index) const; - CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const; - CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const; + CFX_RTFLine* GetRTFLine(bool bReady) const; + CFX_RTFPieceArray* GetRTFPieces(bool bReady) const; FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; int32_t GetLastPositionedTab() const; - FX_BOOL GetPositionedTab(int32_t& iTabPos) const; + bool GetPositionedTab(int32_t& iTabPos) const; int32_t GetBreakPos(CFX_RTFCharArray& tca, int32_t& iEndPos, - FX_BOOL bAllChars = FALSE, - FX_BOOL bOnlyBrk = FALSE); + bool bAllChars = false, + bool bOnlyBrk = false); void SplitTextLine(CFX_RTFLine* pCurLine, CFX_RTFLine* pNextLine, - FX_BOOL bAllChars = FALSE); - FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine, - FX_BOOL bAllChars, - uint32_t dwStatus); + bool bAllChars = false); + bool EndBreak_SplitLine(CFX_RTFLine* pNextLine, + bool bAllChars, + uint32_t dwStatus); void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus); void EndBreak_Alignment(CFX_TPOArray& tpos, - FX_BOOL bAllChars, + bool bAllChars, uint32_t dwStatus); uint32_t m_dwPolicies; @@ -297,7 +297,7 @@ class CFX_RTFBreak { int32_t m_iFontSize; int32_t m_iTabWidth; CFX_Int32Array m_PositionedTabs; - FX_BOOL m_bOrphanLine; + bool m_bOrphanLine; FX_WCHAR m_wDefChar; int32_t m_iDefChar; FX_WCHAR m_wLineBreakChar; @@ -307,9 +307,9 @@ class CFX_RTFBreak { int32_t m_iCharRotation; int32_t m_iRotation; int32_t m_iCharSpace; - FX_BOOL m_bWordSpace; + bool m_bWordSpace; int32_t m_iWordSpace; - FX_BOOL m_bRTL; + bool m_bRTL; int32_t m_iAlignment; IFX_Retainable* m_pUserData; FX_CHARTYPE m_eCharType; diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index d9a0e22e8b..4551809463 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -37,17 +37,17 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) : m_dwPolicies(dwPolicies), m_iLineWidth(2000000), m_dwLayoutStyles(0), - m_bVertical(FALSE), - m_bArabicContext(FALSE), - m_bArabicShapes(FALSE), - m_bRTL(FALSE), - m_bSingleLine(FALSE), - m_bCombText(FALSE), + m_bVertical(false), + m_bArabicContext(false), + m_bArabicShapes(false), + m_bRTL(false), + m_bSingleLine(false), + m_bCombText(false), m_iArabicContext(1), m_iCurArabicContext(1), m_pFont(nullptr), m_iFontSize(240), - m_bEquidistant(TRUE), + m_bEquidistant(true), m_iTabWidth(720000), m_wDefChar(0xFEFF), m_wParagBreakChar(L'\n'), @@ -60,8 +60,8 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) m_iCombWidth(360000), m_pUserData(nullptr), m_eCharType(FX_CHARTYPE_Unknown), - m_bArabicNumber(FALSE), - m_bArabicComma(FALSE), + m_bArabicNumber(false), + m_bArabicComma(false), m_pCurLine(nullptr), m_iReady(0), m_iTolerance(0), @@ -122,7 +122,7 @@ void CFX_TxtBreak::SetFont(CFGAS_GEFont* pFont) { m_pFont = pFont; m_iDefChar = 0; if (m_wDefChar != 0xFEFF && m_pFont) { - m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); + m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false); m_iDefChar *= m_iFontSize; } } @@ -136,12 +136,12 @@ void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) { m_iFontSize = iFontSize; m_iDefChar = 0; if (m_wDefChar != 0xFEFF && m_pFont) { - m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); + m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false); m_iDefChar *= m_iFontSize; } } -void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { +void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) { m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f); if (m_iTabWidth < FX_TXTBREAK_MinimumTabWidth) { m_iTabWidth = FX_TXTBREAK_MinimumTabWidth; @@ -153,7 +153,7 @@ void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) { m_wDefChar = wch; m_iDefChar = 0; if (m_wDefChar != 0xFEFF && m_pFont) { - m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); + m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false); if (m_iDefChar < 0) { m_iDefChar = 0; } else { @@ -279,7 +279,7 @@ int32_t CFX_TxtBreak::GetLineRotation(uint32_t dwStyles) const { return gs_FX_TxtLineRotations[(dwStyles & 0x0E) >> 1]; } -CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const { +CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, bool bOmitChar) const { CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars.get(); int32_t iCount = ca.GetSize(); if (index < 0 || index >= iCount) { @@ -299,7 +299,7 @@ CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const { return nullptr; } -CFX_TxtLine* CFX_TxtBreak::GetTxtLine(FX_BOOL bReady) const { +CFX_TxtLine* CFX_TxtBreak::GetTxtLine(bool bReady) const { if (!bReady) return m_pCurLine; if (m_iReady == 1) @@ -309,7 +309,7 @@ CFX_TxtLine* CFX_TxtBreak::GetTxtLine(FX_BOOL bReady) const { return nullptr; } -CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const { +CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(bool bReady) const { CFX_TxtLine* pTxtLine = GetTxtLine(bReady); if (!pTxtLine) { return nullptr; @@ -331,7 +331,7 @@ void CFX_TxtBreak::ResetArabicContext() { m_bArabicNumber = m_iArabicContext >= 1 && m_bArabicShapes; } else { if (m_bPagination) { - m_bCurRTL = FALSE; + m_bCurRTL = false; m_iCurAlignment = 0; } else { m_bCurRTL = m_bRTL; @@ -368,7 +368,7 @@ void CFX_TxtBreak::AppendChar_PageLoad(CFX_TxtChar* pCurChar, } ResetArabicContext(); if (!m_bPagination) { - CFX_TxtChar* pLastChar = GetLastChar(1, FALSE); + CFX_TxtChar* pLastChar = GetLastChar(1, false); if (pLastChar && pLastChar->m_dwStatus < 1) { pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak; } @@ -392,20 +392,20 @@ uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar, } else { wForm = wch; if (!m_bPagination) { - CFX_TxtChar* pLastChar = GetLastChar(0, FALSE); + CFX_TxtChar* pLastChar = GetLastChar(0, false); if (pLastChar && (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) { - FX_BOOL bShadda = FALSE; + bool bShadda = false; if (wch == 0x0651) { FX_WCHAR wLast = pLastChar->m_wCharCode; if (wLast >= 0x064C && wLast <= 0x0650) { wForm = FX_GetArabicFromShaddaTable(wLast); - bShadda = TRUE; + bShadda = true; } } else if (wch >= 0x064C && wch <= 0x0650) { if (pLastChar->m_wCharCode == 0x0651) { wForm = FX_GetArabicFromShaddaTable(wch); - bShadda = TRUE; + bShadda = true; } } if (bShadda) { @@ -415,7 +415,7 @@ uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar, } } } - if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { + if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) { iCharWidth = 0; } } @@ -492,7 +492,7 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar, FX_WCHAR wForm; int32_t iCharWidth = 0; CFX_Char* pLastChar = nullptr; - FX_BOOL bAlef = FALSE; + bool bAlef = false; if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef && m_eCharType <= FX_CHARTYPE_ArabicDistortion) { pLastChar = GetLastChar(1); @@ -512,7 +512,7 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar, if (m_bVertical != FX_IsOdd(iLastRotation)) { iCharWidth = 1000; } else { - m_pFont->GetCharWidth(wForm, iCharWidth, FALSE); + m_pFont->GetCharWidth(wForm, iCharWidth, false); } if (wForm == 0xFEFF) { iCharWidth = m_iDefChar; @@ -533,7 +533,7 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar, if (m_bVertical != FX_IsOdd(iRotation)) { iCharWidth = 1000; } else { - m_pFont->GetCharWidth(wForm, iCharWidth, FALSE); + m_pFont->GetCharWidth(wForm, iCharWidth, false); } if (wForm == 0xFEFF) { iCharWidth = m_iDefChar; @@ -577,7 +577,7 @@ uint32_t CFX_TxtBreak::AppendChar_Others(CFX_TxtChar* pCurChar, } else { if (m_bVertical != FX_IsOdd(iRotation)) { iCharWidth = 1000; - } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { + } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) { iCharWidth = m_iDefChar; } iCharWidth *= m_iFontSize; @@ -586,8 +586,8 @@ uint32_t CFX_TxtBreak::AppendChar_Others(CFX_TxtChar* pCurChar, iCharWidth += m_iCharSpace; pCurChar->m_iCharWidth = iCharWidth; iLineWidth += iCharWidth; - FX_BOOL bBreak = (chartype != FX_CHARTYPE_Space || - (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0); + bool bBreak = (chartype != FX_CHARTYPE_Space || + (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0); if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance) { return EndBreak(FX_TXTBREAK_LineBreak); } @@ -644,10 +644,10 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { } int32_t& iLineWidth = m_pCurLine->m_iWidth; CFX_Char* pCur = m_pCurLine->GetCharPtr(0); - FX_BOOL bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; + bool bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; pCur = m_pCurLine->GetCharPtr(1); FX_WCHAR wch, wForm; - FX_BOOL bNextNum; + bool bNextNum; int32_t i = 1; int32_t iCharWidth; int32_t iRotation; @@ -659,7 +659,7 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; } else { pNext = nullptr; - bNextNum = FALSE; + bNextNum = false; } wch = pCur->m_wCharCode; if (wch == L'.') { @@ -675,7 +675,7 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { } else { if (m_bVertical != FX_IsOdd(iRotation)) { iCharWidth = 1000; - } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { + } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) { iCharWidth = m_iDefChar; } iCharWidth *= m_iFontSize; @@ -690,11 +690,11 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { } while (i < iCount); } -FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, - FX_BOOL bAllChars, - uint32_t dwStatus) { +bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, + bool bAllChars, + uint32_t dwStatus) { int32_t iCount = m_pCurLine->CountChars(); - FX_BOOL bDone = FALSE; + bool bDone = false; CFX_Char* pTC; if (!m_bSingleLine && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance) { pTC = m_pCurLine->GetCharPtr(iCount - 1); @@ -705,12 +705,12 @@ FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, case FX_CHARTYPE_Space: if ((m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0) { SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); - bDone = TRUE; + bDone = true; } break; default: SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); - bDone = TRUE; + bDone = true; break; } } @@ -732,13 +732,13 @@ FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, pCurPieces->Add(tp); m_pCurLine = pNextLine; m_eCharType = FX_CHARTYPE_Unknown; - return TRUE; + return true; } if (bAllChars && !bDone) { int32_t iEndPos = m_pCurLine->m_iWidth; - GetBreakPos(*m_pCurLine->m_pLineChars.get(), iEndPos, bAllChars, TRUE); + GetBreakPos(*m_pCurLine->m_pLineChars.get(), iEndPos, bAllChars, true); } - return FALSE; + return false; } void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { @@ -748,7 +748,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { int32_t i, j; CFX_TxtCharArray& chars = *m_pCurLine->m_pLineChars.get(); int32_t iCount = m_pCurLine->CountChars(); - FX_BOOL bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL); + bool bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL); if (!m_bPagination && bDone) { int32_t iBidiNum = 0; for (i = 0; i < iCount; i++) { @@ -851,12 +851,12 @@ void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { } void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, - FX_BOOL bAllChars, + bool bAllChars, uint32_t dwStatus) { int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth; CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get(); int32_t i, j, iCount = pCurPieces->GetSize(); - FX_BOOL bFind = FALSE; + bool bFind = false; FX_TPO tpo; CFX_TxtChar* pTC; FX_CHARTYPE chartype; @@ -866,7 +866,7 @@ void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, if (!bFind) { iNetWidth = ttp.GetEndPos(); } - FX_BOOL bArabic = FX_IsOdd(ttp.m_iBidiLevel); + bool bArabic = FX_IsOdd(ttp.m_iBidiLevel); j = bArabic ? 0 : ttp.m_iChars - 1; while (j > -1 && j < ttp.m_iChars) { pTC = ttp.GetCharPtr(j); @@ -883,7 +883,7 @@ void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, } } } else { - bFind = TRUE; + bFind = true; if (!bAllChars) { break; } @@ -954,7 +954,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) { } return dwStatus; } else { - CFX_TxtLine* pLastLine = GetTxtLine(TRUE); + CFX_TxtLine* pLastLine = GetTxtLine(true); if (pLastLine) { pCurPieces = pLastLine->m_pLinePieces.get(); iCount = pCurPieces->GetSize(); @@ -984,7 +984,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) { m_iReady = (m_pCurLine == m_pTxtLine1.get()) ? 1 : 2; CFX_TxtLine* pNextLine = (m_pCurLine == m_pTxtLine1.get()) ? m_pTxtLine2.get() : m_pTxtLine1.get(); - FX_BOOL bAllChars = (m_iCurAlignment > FX_TXTLINEALIGNMENT_Right); + bool bAllChars = (m_iCurAlignment > FX_TXTLINEALIGNMENT_Right); CFX_TPOArray tpos(100); CFX_Char* pTC; if (m_bArabicShapes) { @@ -999,7 +999,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) { } EndBreak_Ret: m_pCurLine = pNextLine; - pTC = GetLastChar(0, FALSE); + pTC = GetLastChar(0, false); m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown; if (dwStatus == FX_TXTBREAK_ParagraphBreak) { m_iArabicContext = m_iCurArabicContext = 1; @@ -1010,8 +1010,8 @@ EndBreak_Ret: int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca, int32_t& iEndPos, - FX_BOOL bAllChars, - FX_BOOL bOnlyBrk) { + bool bAllChars, + bool bOnlyBrk) { int32_t iLength = ca.GetSize() - 1; if (iLength < 1) { return iLength; @@ -1025,8 +1025,8 @@ int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca, iBreak = iLength; iBreakPos = iEndPos; } - FX_BOOL bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0; - FX_BOOL bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0; + bool bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0; + bool bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0; FX_LINEBREAKTYPE eType; uint32_t nCodeProp, nCur, nNext; CFX_Char* pCur = ca.GetDataPtr(iLength--); @@ -1107,7 +1107,7 @@ int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca, void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine, CFX_TxtLine* pNextLine, - FX_BOOL bAllChars) { + bool bAllChars) { ASSERT(pCurLine && pNextLine); int32_t iCount = pCurLine->CountChars(); if (iCount < 2) { @@ -1115,13 +1115,13 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine, } int32_t iEndPos = pCurLine->m_iWidth; CFX_TxtCharArray& curChars = *pCurLine->m_pLineChars.get(); - int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, FALSE); + int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, false); if (iCharPos < 0) { iCharPos = 0; } iCharPos++; if (iCharPos >= iCount) { - pNextLine->RemoveAll(TRUE); + pNextLine->RemoveAll(true); CFX_Char* pTC = curChars.GetDataPtr(iCharPos - 1); pTC->m_nBreakType = FX_LBT_UNKNOWN; return; @@ -1158,17 +1158,17 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine, } int32_t CFX_TxtBreak::CountBreakChars() const { - CFX_TxtLine* pTxtLine = GetTxtLine(TRUE); + CFX_TxtLine* pTxtLine = GetTxtLine(true); return pTxtLine ? pTxtLine->CountChars() : 0; } int32_t CFX_TxtBreak::CountBreakPieces() const { - CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE); + CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(true); return pTxtPieces ? pTxtPieces->GetSize() : 0; } const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const { - CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE); + CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(true); if (!pTxtPieces) { return nullptr; } @@ -1179,9 +1179,9 @@ const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const { } void CFX_TxtBreak::ClearBreakPieces() { - CFX_TxtLine* pTxtLine = GetTxtLine(TRUE); + CFX_TxtLine* pTxtLine = GetTxtLine(true); if (pTxtLine) { - pTxtLine->RemoveAll(TRUE); + pTxtLine->RemoveAll(true); } m_iReady = 0; } @@ -1190,8 +1190,8 @@ void CFX_TxtBreak::Reset() { m_eCharType = FX_CHARTYPE_Unknown; m_iArabicContext = m_iCurArabicContext = 1; ResetArabicContext(); - m_pTxtLine1->RemoveAll(TRUE); - m_pTxtLine2->RemoveAll(TRUE); + m_pTxtLine1->RemoveAll(true); + m_pTxtLine2->RemoveAll(true); } struct FX_FORMCHAR { @@ -1202,7 +1202,7 @@ struct FX_FORMCHAR { int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode, + bool bCharCode, CFX_WideString* pWSForms, FX_AdjustCharDisplayPos pAdjustPos) const { if (!pTxtRun || pTxtRun->iLength < 1) { @@ -1216,11 +1216,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, CFGAS_GEFont* pFont = pTxtRun->pFont; uint32_t dwStyles = pTxtRun->dwStyles; CFX_RectF rtText(*pTxtRun->pRect); - FX_BOOL bRTLPiece = - (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; - FX_BOOL bArabicNumber = + bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; + bool bArabicNumber = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0; - FX_BOOL bArabicComma = + bool bArabicComma = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0; FX_FLOAT fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); @@ -1230,13 +1229,13 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, FX_FLOAT fFontHeight = fFontSize; FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight; FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight; - FX_BOOL bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; - FX_BOOL bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0; + bool bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; + bool bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0; int32_t iRotation = GetLineRotation(dwStyles) + pTxtRun->iCharRotation; FX_FLOAT fX, fY, fCharWidth, fCharHeight; int32_t iHorScale = pTxtRun->iHorizontalScale; int32_t iVerScale = pTxtRun->iVerticalScale; - FX_BOOL bSkipSpace = pTxtRun->bSkipSpace; + bool bSkipSpace = pTxtRun->bSkipSpace; FX_FORMCHAR formChars[3]; FX_FLOAT fYBase; fX = rtText.left; @@ -1257,8 +1256,8 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, FX_WCHAR wNext = 0xFEFF; FX_WCHAR wForm = 0xFEFF; FX_WCHAR wLast = 0xFEFF; - FX_BOOL bShadda = FALSE; - FX_BOOL bLam = FALSE; + bool bShadda = false; + bool bLam = false; for (int32_t i = 0; i <= iLength; i++) { int32_t iWidth; FX_WCHAR wch; @@ -1315,7 +1314,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (wch >= 0x064C && wch <= 0x0651) { if (bShadda) { wForm = 0xFEFF; - bShadda = FALSE; + bShadda = false; } else { wNext = 0xFEFF; if (pAccess) { @@ -1331,17 +1330,17 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (wch == 0x0651) { if (wNext >= 0x064C && wNext <= 0x0650) { wForm = FX_GetArabicFromShaddaTable(wNext); - bShadda = TRUE; + bShadda = true; } } else { if (wNext == 0x0651) { wForm = FX_GetArabicFromShaddaTable(wch); - bShadda = TRUE; + bShadda = true; } } } } else { - bShadda = FALSE; + bShadda = false; } } else if (chartype == FX_CHARTYPE_Numeric) { wForm = wch; @@ -1377,10 +1376,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, wForm = wch; } if (chartype != FX_CHARTYPE_Combination) { - bShadda = FALSE; + bShadda = false; } if (chartype < FX_CHARTYPE_ArabicAlef) { - bLam = FALSE; + bLam = false; } dwProps = FX_GetUnicodeProperties(wForm); int32_t iCharRotation = iRotation; @@ -1388,10 +1387,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, iCharRotation++; } iCharRotation %= 4; - FX_BOOL bEmptyChar = + bool bEmptyChar = (chartype >= FX_CHARTYPE_Tab && chartype <= FX_CHARTYPE_Control); if (wForm == 0xFEFF) { - bEmptyChar = TRUE; + bEmptyChar = true; } int32_t iForms = bLam ? 3 : 1; iCount += (bEmptyChar && bSkipSpace) ? 0 : iForms; @@ -1413,11 +1412,11 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (bLam) { formChars[1].wForm = 0x0651; iCharWidth = 0; - pFont->GetCharWidth(0x0651, iCharWidth, FALSE); + pFont->GetCharWidth(0x0651, iCharWidth, false); formChars[1].iWidth = iCharWidth; formChars[2].wForm = 0x0670; iCharWidth = 0; - pFont->GetCharWidth(0x0670, iCharWidth, FALSE); + pFont->GetCharWidth(0x0670, iCharWidth, false); formChars[2].iWidth = iCharWidth; } for (int32_t j = 0; j < iForms; j++) { @@ -1430,7 +1429,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { pCharPos->m_GlyphIndex = - bCharCode ? wch : pFont->GetGlyphIndex(wForm, FALSE); + bCharCode ? wch : pFont->GetGlyphIndex(wForm, false); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ pCharPos->m_ExtGID = pCharPos->m_GlyphIndex; #endif @@ -1460,7 +1459,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, pCharPos->m_OriginY = fY; if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) { int32_t iFormWidth = iCharWidth; - pFont->GetCharWidth(wForm, iFormWidth, FALSE); + pFont->GetCharWidth(wForm, iFormWidth, false); FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; if (bVerticalDoc) { pCharPos->m_OriginY += fOffset; @@ -1471,7 +1470,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (chartype == FX_CHARTYPE_Combination) { CFX_Rect rtBBox; rtBBox.Reset(); - if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) { + if (pFont->GetCharBBox(wForm, rtBBox, false)) { pCharPos->m_OriginY = fYBase + fFontSize - fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; @@ -1482,14 +1481,14 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, FX_CHARTYPE_Combination) { CFX_Rect rtBox; rtBox.Reset(); - if (pFont->GetCharBBox(wLast, rtBox, FALSE)) { + if (pFont->GetCharBBox(wLast, rtBox, false)) { pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; } } } } CFX_PointF ptOffset; - FX_BOOL bAdjusted = FALSE; + bool bAdjusted = false; if (pAdjustPos) { bAdjusted = pAdjustPos(wForm, bCharCode, pFont, fFontSize, bVerticalChar, ptOffset); @@ -1497,7 +1496,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) { CFX_Rect rtBBox; rtBBox.Reset(); - if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) { + if (pFont->GetCharBBox(wForm, rtBBox, false)) { ptOffset.x = fFontSize * (850 - rtBBox.right()) / iMaxHeight; ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight; } @@ -1513,7 +1512,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } } if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { - pCharPos->m_bGlyphAdjust = TRUE; + pCharPos->m_bGlyphAdjust = true; if (bVerticalDoc) { if (iCharRotation == 0) { pCharPos->m_AdjustMatrix[0] = -1; @@ -1592,7 +1591,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, CFX_RectFArray& rtArray, - FX_BOOL bCharBBox) const { + bool bCharBBox) const { if (!pTxtRun || pTxtRun->iLength < 1) { return 0; } @@ -1602,14 +1601,13 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength; CFX_RectF rect(*pTxtRun->pRect); - FX_BOOL bRTLPiece = - (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; + bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; FX_FLOAT fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); FX_FLOAT fScale = fFontSize / 1000.0f; CFGAS_GEFont* pFont = pTxtRun->pFont; if (!pFont) { - bCharBBox = FALSE; + bCharBBox = false; } CFX_Rect bbox; bbox.Set(0, 0, 0, 0); @@ -1620,10 +1618,9 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); rtArray.RemoveAll(); rtArray.SetSize(iLength); - FX_BOOL bVertical = - (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; - FX_BOOL bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0; - FX_BOOL bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; + bool bVertical = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; + bool bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0; + bool bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; FX_WCHAR wch, wLineBreakChar = pTxtRun->wLineBreakChar; int32_t iCharSize; FX_FLOAT fCharSize, fStart; @@ -1641,10 +1638,10 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, iCharSize = *pWidths++; } fCharSize = (FX_FLOAT)iCharSize / 20000.0f; - FX_BOOL bRet = (!bSingleLine && FX_IsCtrlCode(wch)); + bool bRet = (!bSingleLine && FX_IsCtrlCode(wch)); if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 || (wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) { - bRet = FALSE; + bRet = false; } if (bRet) { iCharSize = iFontSize * 500; @@ -1716,7 +1713,7 @@ FX_TXTRUN::FX_TXTRUN() dwCharStyles(0), pRect(nullptr), wLineBreakChar(L'\n'), - bSkipSpace(TRUE) {} + bSkipSpace(true) {} FX_TXTRUN::~FX_TXTRUN() {} diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index d8464ab0cb..4e9238f7bf 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -102,7 +102,7 @@ struct FX_TXTRUN { uint32_t dwCharStyles; const CFX_RectF* pRect; FX_WCHAR wLineBreakChar; - FX_BOOL bSkipSpace; + bool bSkipSpace; }; class CFX_TxtPiece : public CFX_Target { @@ -183,7 +183,7 @@ class CFX_TxtLine { } wsStr.ReleaseBuffer(iCount); } - void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { + void RemoveAll(bool bLeaveMemory = false) { m_pLineChars->RemoveAll(); m_pLinePieces->RemoveAll(bLeaveMemory); m_iWidth = 0; @@ -208,7 +208,7 @@ class CFX_TxtBreak { void SetLayoutStyles(uint32_t dwLayoutStyles); void SetFont(CFGAS_GEFont* pFont); void SetFontSize(FX_FLOAT fFontSize); - void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + void SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant); void SetDefaultChar(FX_WCHAR wch); void SetParagraphBreakChar(FX_WCHAR wch); void SetLineBreakTolerance(FX_FLOAT fTolerance); @@ -230,12 +230,12 @@ class CFX_TxtBreak { void Reset(); int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode = FALSE, + bool bCharCode = false, CFX_WideString* pWSForms = nullptr, FX_AdjustCharDisplayPos pAdjustPos = nullptr) const; int32_t GetCharRects(const FX_TXTRUN* pTxtRun, CFX_RectFArray& rtArray, - FX_BOOL bCharBBox = FALSE) const; + bool bCharBBox = false) const; void AppendChar_PageLoad(CFX_TxtChar* pCurChar, uint32_t dwProps); uint32_t AppendChar_Combination(CFX_TxtChar* pCurChar, int32_t iRotation); uint32_t AppendChar_Tab(CFX_TxtChar* pCurChar, int32_t iRotation); @@ -246,43 +246,43 @@ class CFX_TxtBreak { private: void SetBreakStatus(); int32_t GetLineRotation(uint32_t dwStyles) const; - CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const; - CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const; - CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const; + CFX_TxtChar* GetLastChar(int32_t index, bool bOmitChar = true) const; + CFX_TxtLine* GetTxtLine(bool bReady) const; + CFX_TxtPieceArray* GetTxtPieces(bool bReady) const; FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const; void ResetArabicContext(); void ResetContextCharStyles(); void EndBreak_UpdateArabicShapes(); - FX_BOOL EndBreak_SplitLine(CFX_TxtLine* pNextLine, - FX_BOOL bAllChars, - uint32_t dwStatus); + bool EndBreak_SplitLine(CFX_TxtLine* pNextLine, + bool bAllChars, + uint32_t dwStatus); void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus); void EndBreak_Alignment(CFX_TPOArray& tpos, - FX_BOOL bAllChars, + bool bAllChars, uint32_t dwStatus); int32_t GetBreakPos(CFX_TxtCharArray& ca, int32_t& iEndPos, - FX_BOOL bAllChars = FALSE, - FX_BOOL bOnlyBrk = FALSE); + bool bAllChars = false, + bool bOnlyBrk = false); void SplitTextLine(CFX_TxtLine* pCurLine, CFX_TxtLine* pNextLine, - FX_BOOL bAllChars = FALSE); + bool bAllChars = false); uint32_t m_dwPolicies; - FX_BOOL m_bPagination; + bool m_bPagination; int32_t m_iLineWidth; uint32_t m_dwLayoutStyles; - FX_BOOL m_bVertical; - FX_BOOL m_bArabicContext; - FX_BOOL m_bArabicShapes; - FX_BOOL m_bRTL; - FX_BOOL m_bSingleLine; - FX_BOOL m_bCombText; + bool m_bVertical; + bool m_bArabicContext; + bool m_bArabicShapes; + bool m_bRTL; + bool m_bSingleLine; + bool m_bCombText; int32_t m_iArabicContext; int32_t m_iCurArabicContext; CFGAS_GEFont* m_pFont; int32_t m_iFontSize; - FX_BOOL m_bEquidistant; + bool m_bEquidistant; int32_t m_iTabWidth; FX_WCHAR m_wDefChar; FX_WCHAR m_wParagBreakChar; @@ -295,10 +295,10 @@ class CFX_TxtBreak { int32_t m_iCombWidth; void* m_pUserData; FX_CHARTYPE m_eCharType; - FX_BOOL m_bCurRTL; + bool m_bCurRTL; int32_t m_iCurAlignment; - FX_BOOL m_bArabicNumber; - FX_BOOL m_bArabicComma; + bool m_bArabicNumber; + bool m_bArabicComma; std::unique_ptr<CFX_TxtLine> m_pTxtLine1; std::unique_ptr<CFX_TxtLine> m_pTxtLine2; CFX_TxtLine* m_pCurLine; diff --git a/xfa/fgas/layout/fgas_unicode.h b/xfa/fgas/layout/fgas_unicode.h index 650943a72f..12614a1299 100644 --- a/xfa/fgas/layout/fgas_unicode.h +++ b/xfa/fgas/layout/fgas_unicode.h @@ -18,11 +18,11 @@ typedef CFX_MassArrayTemplate<FX_TPO> CFX_TPOArray; void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd); -typedef FX_BOOL (*FX_AdjustCharDisplayPos)(FX_WCHAR wch, - FX_BOOL bMBCSCode, - CFGAS_GEFont* pFont, - FX_FLOAT fFontSize, - FX_BOOL bVertical, - CFX_PointF& ptOffset); +typedef bool (*FX_AdjustCharDisplayPos)(FX_WCHAR wch, + bool bMBCSCode, + CFGAS_GEFont* pFont, + FX_FLOAT fFontSize, + bool bVertical, + CFX_PointF& ptOffset); #endif // XFA_FGAS_LAYOUT_FGAS_UNICODE_H_ diff --git a/xfa/fgas/localization/fgas_datetime.cpp b/xfa/fgas/localization/fgas_datetime.cpp index 18e30fcb86..83000a4f20 100644 --- a/xfa/fgas/localization/fgas_datetime.cpp +++ b/xfa/fgas/localization/fgas_datetime.cpp @@ -30,7 +30,7 @@ const int64_t g_FXMillisecondsPerSecond = 1000; const int64_t g_FXMillisecondsPerMinute = 60000; const int64_t g_FXMillisecondsPerHour = 3600000; const int64_t g_FXMillisecondsPerDay = 86400000; -FX_BOOL FX_IsLeapYear(int32_t iYear) { +bool FX_IsLeapYear(int32_t iYear) { ASSERT(iYear != 0); return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0; } @@ -55,7 +55,7 @@ static int32_t FX_DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) { static int64_t FX_DateToDays(int32_t iYear, uint8_t iMonth, uint8_t iDay, - FX_BOOL bIncludeThisDay = FALSE) { + bool bIncludeThisDay = false) { ASSERT(iYear != 0); ASSERT(iMonth >= 1 && iMonth <= 12); ASSERT(iDay >= 1 && iDay <= FX_DaysInMonth(iYear, iMonth)); @@ -76,7 +76,7 @@ static void FX_DaysToDate(int64_t iDays, int32_t& iYear, uint8_t& iMonth, uint8_t& iDay) { - FX_BOOL bBC = iDays < 0; + bool bBC = iDays < 0; if (bBC) { iDays = -iDays; } @@ -100,7 +100,7 @@ static void FX_DaysToDate(int64_t iDays, iYear += (int32_t)(iDays / g_FXDaysPer4Years * 4); iDays %= g_FXDaysPer4Years; } - while (TRUE) { + while (true) { int32_t iYearDays = FX_DaysInYear(iYear); if (iDays < iYearDays) { if (bBC) { @@ -112,7 +112,7 @@ static void FX_DaysToDate(int64_t iDays, iYear++; iDays -= iYearDays; } - while (TRUE) { + while (true) { int32_t iMonthDays = FX_DaysInMonth(iYear, iMonth); if (iDays < iMonthDays) { break; @@ -207,7 +207,7 @@ void CFX_Unitime::Set(int32_t year, if (year > 0) { m_iUnitime = m_iUnitime + - FX_DateToDays(year, month, day, FALSE) * g_FXMillisecondsPerDay; + FX_DateToDays(year, month, day, false) * g_FXMillisecondsPerDay; } } void CFX_Unitime::Set(FX_UNITIME t) { @@ -245,7 +245,7 @@ uint16_t CFX_Unitime::GetDayOfYear() const { return FX_DaysBeforeMonthInYear(iYear, iMonth) + iDay; } int64_t CFX_Unitime::GetDayOfAD() const { - FX_BOOL bBC = m_iUnitime < 0; + bool bBC = m_iUnitime < 0; int64_t iDays = m_iUnitime / g_FXMillisecondsPerDay; iDays += bBC ? -1 : 0; if (bBC && (m_iUnitime % g_FXMillisecondsPerDay) == 0) { @@ -281,7 +281,7 @@ uint16_t CFX_Unitime::GetMillisecond() const { } return (uint16_t)v; } -FX_BOOL CFX_Unitime::AddYears(int32_t iYears) { +bool CFX_Unitime::AddYears(int32_t iYears) { FX_UNITIME ut = m_iUnitime; if (ut < 0) { ut = -ut; @@ -295,12 +295,12 @@ FX_BOOL CFX_Unitime::AddYears(int32_t iYears) { iYear = iYears > 0 ? 1 : -1; } m_iUnitime = - FX_DateToDays(iYear, iMonth, iDay, FALSE) * g_FXMillisecondsPerDay; + FX_DateToDays(iYear, iMonth, iDay, false) * g_FXMillisecondsPerDay; m_iUnitime += (iYear < 0) ? -r : r; - return TRUE; + return true; } -FX_BOOL CFX_Unitime::AddMonths(int32_t iMonths) { - FX_BOOL b = iMonths > 0; +bool CFX_Unitime::AddMonths(int32_t iMonths) { + bool b = iMonths > 0; FX_UNITIME ut = m_iUnitime; if (ut < 0) { ut = -ut; @@ -319,38 +319,38 @@ FX_BOOL CFX_Unitime::AddMonths(int32_t iMonths) { if (iYear == 0) { iYear = b ? 1 : -1; } - m_iUnitime = FX_DateToDays(iYear, (uint8_t)iMonths, iDay, FALSE) * + m_iUnitime = FX_DateToDays(iYear, (uint8_t)iMonths, iDay, false) * g_FXMillisecondsPerDay; m_iUnitime += (iYear < 0) ? -r : r; - return TRUE; + return true; } -FX_BOOL CFX_Unitime::AddDays(int32_t iDays) { +bool CFX_Unitime::AddDays(int32_t iDays) { m_iUnitime += (int64_t)iDays * g_FXMillisecondsPerDay; - return TRUE; + return true; } -FX_BOOL CFX_Unitime::AddHours(int32_t iHours) { +bool CFX_Unitime::AddHours(int32_t iHours) { m_iUnitime += (int64_t)iHours * g_FXMillisecondsPerHour; - return TRUE; + return true; } -FX_BOOL CFX_Unitime::AddMinutes(int32_t iMinutes) { +bool CFX_Unitime::AddMinutes(int32_t iMinutes) { m_iUnitime += (int64_t)iMinutes * g_FXMillisecondsPerMinute; - return TRUE; + return true; } -FX_BOOL CFX_Unitime::AddSeconds(int32_t iSeconds) { +bool CFX_Unitime::AddSeconds(int32_t iSeconds) { m_iUnitime += ((int64_t)iSeconds) * g_FXMillisecondsPerSecond; - return TRUE; + return true; } -FX_BOOL CFX_Unitime::AddMilliseconds(int32_t iMilliseconds) { +bool CFX_Unitime::AddMilliseconds(int32_t iMilliseconds) { m_iUnitime += iMilliseconds; - return TRUE; -} -FX_BOOL CFX_DateTime::Set(int32_t year, - uint8_t month, - uint8_t day, - uint8_t hour, - uint8_t minute, - uint8_t second, - uint16_t millisecond) { + return true; +} +bool CFX_DateTime::Set(int32_t year, + uint8_t month, + uint8_t day, + uint8_t hour, + uint8_t minute, + uint8_t second, + uint16_t millisecond) { ASSERT(year != 0); ASSERT(month >= 1 && month <= 12); ASSERT(day >= 1 && day <= FX_DaysInMonth(year, month)); @@ -365,9 +365,9 @@ FX_BOOL CFX_DateTime::Set(int32_t year, m_DateTime.Time.sTime.minute = minute; m_DateTime.Time.sTime.second = second; m_DateTime.Time.sTime.millisecond = millisecond; - return TRUE; + return true; } -FX_BOOL CFX_DateTime::FromUnitime(FX_UNITIME t) { +bool CFX_DateTime::FromUnitime(FX_UNITIME t) { CFX_Unitime ut(t); FX_DaysToDate(ut.GetDayOfAD(), m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month, m_DateTime.Date.sDate.day); @@ -375,7 +375,7 @@ FX_BOOL CFX_DateTime::FromUnitime(FX_UNITIME t) { m_DateTime.Time.sTime.minute = ut.GetMinute(); m_DateTime.Time.sTime.second = ut.GetSecond(); m_DateTime.Time.sTime.millisecond = ut.GetMillisecond(); - return TRUE; + return true; } FX_UNITIME CFX_DateTime::ToUnitime() const { FX_UNITIME v = @@ -384,7 +384,7 @@ FX_UNITIME CFX_DateTime::ToUnitime() const { (int64_t)m_DateTime.Time.sTime.second * g_FXMillisecondsPerSecond + m_DateTime.Time.sTime.millisecond; v += FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month, - m_DateTime.Date.sDate.day, FALSE) * + m_DateTime.Date.sDate.day, false) * g_FXMillisecondsPerDay; return v; } @@ -400,7 +400,7 @@ uint8_t CFX_DateTime::GetDay() const { FX_WEEKDAY CFX_DateTime::GetDayOfWeek() const { int32_t v = (int32_t)(FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month, - m_DateTime.Date.sDate.day, TRUE) % + m_DateTime.Date.sDate.day, true) % 7); if (v < 0) { v += 7; @@ -414,7 +414,7 @@ uint16_t CFX_DateTime::GetDayOfYear() const { } int64_t CFX_DateTime::GetDayOfAD() const { return FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month, - m_DateTime.Date.sDate.day, TRUE); + m_DateTime.Date.sDate.day, true); } uint8_t CFX_DateTime::GetHour() const { return m_DateTime.Date.sDate.day; @@ -428,9 +428,9 @@ uint8_t CFX_DateTime::GetSecond() const { uint16_t CFX_DateTime::GetMillisecond() const { return m_DateTime.Time.sTime.millisecond; } -FX_BOOL CFX_DateTime::AddYears(int32_t iYears) { +bool CFX_DateTime::AddYears(int32_t iYears) { if (iYears == 0) { - return FALSE; + return false; } int32_t v = m_DateTime.Date.sDate.year + iYears; if (v >= 0 && m_DateTime.Date.sDate.year < 0) { @@ -439,13 +439,13 @@ FX_BOOL CFX_DateTime::AddYears(int32_t iYears) { v--; } m_DateTime.Date.sDate.year = v; - return TRUE; + return true; } -FX_BOOL CFX_DateTime::AddMonths(int32_t iMonths) { +bool CFX_DateTime::AddMonths(int32_t iMonths) { if (iMonths == 0) { - return FALSE; + return false; } - FX_BOOL b = iMonths > 0; + bool b = iMonths > 0; iMonths += m_DateTime.Date.sDate.month; while (iMonths < 1) { m_DateTime.Date.sDate.year--; @@ -465,15 +465,15 @@ FX_BOOL CFX_DateTime::AddMonths(int32_t iMonths) { m_DateTime.Date.sDate.year = b ? 1 : -1; } m_DateTime.Date.sDate.month = (uint8_t)iMonths; - return TRUE; + return true; } -FX_BOOL CFX_DateTime::AddDays(int32_t iDays) { +bool CFX_DateTime::AddDays(int32_t iDays) { if (iDays == 0) { - return FALSE; + return false; } int64_t v1 = FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month, - m_DateTime.Date.sDate.day, TRUE); + m_DateTime.Date.sDate.day, true); int64_t v2 = v1 + iDays; if (v2 <= 0 && v1 > 0) { v2--; @@ -482,11 +482,11 @@ FX_BOOL CFX_DateTime::AddDays(int32_t iDays) { } FX_DaysToDate(v2, m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month, m_DateTime.Date.sDate.day); - return TRUE; + return true; } -FX_BOOL CFX_DateTime::AddHours(int32_t iHours) { +bool CFX_DateTime::AddHours(int32_t iHours) { if (iHours == 0) { - return FALSE; + return false; } iHours += m_DateTime.Date.sDate.day; int32_t iDays = iHours / 24; @@ -498,11 +498,11 @@ FX_BOOL CFX_DateTime::AddHours(int32_t iHours) { if (iDays != 0) { AddDays(iDays); } - return TRUE; + return true; } -FX_BOOL CFX_DateTime::AddMinutes(int32_t iMinutes) { +bool CFX_DateTime::AddMinutes(int32_t iMinutes) { if (iMinutes == 0) { - return FALSE; + return false; } iMinutes += m_DateTime.Time.sTime.minute; int32_t iHours = iMinutes / 60; @@ -514,11 +514,11 @@ FX_BOOL CFX_DateTime::AddMinutes(int32_t iMinutes) { if (iHours != 0) { AddHours(iHours); } - return TRUE; + return true; } -FX_BOOL CFX_DateTime::AddSeconds(int32_t iSeconds) { +bool CFX_DateTime::AddSeconds(int32_t iSeconds) { if (iSeconds == 0) { - return FALSE; + return false; } iSeconds += m_DateTime.Time.sTime.second; int32_t iMinutes = iSeconds / 60; @@ -530,11 +530,11 @@ FX_BOOL CFX_DateTime::AddSeconds(int32_t iSeconds) { if (iMinutes != 0) { AddMinutes(iMinutes); } - return TRUE; + return true; } -FX_BOOL CFX_DateTime::AddMilliseconds(int32_t iMilliseconds) { +bool CFX_DateTime::AddMilliseconds(int32_t iMilliseconds) { if (iMilliseconds == 0) { - return FALSE; + return false; } iMilliseconds += m_DateTime.Time.sTime.millisecond; int32_t iSeconds = (int32_t)(iMilliseconds / g_FXMillisecondsPerSecond); @@ -546,5 +546,5 @@ FX_BOOL CFX_DateTime::AddMilliseconds(int32_t iMilliseconds) { if (iSeconds != 0) { AddSeconds(iSeconds); } - return TRUE; + return true; } diff --git a/xfa/fgas/localization/fgas_datetime.h b/xfa/fgas/localization/fgas_datetime.h index 52d665a9c6..3383d45669 100644 --- a/xfa/fgas/localization/fgas_datetime.h +++ b/xfa/fgas/localization/fgas_datetime.h @@ -23,7 +23,7 @@ enum FX_WEEKDAY { FX_Saturday, }; -FX_BOOL FX_IsLeapYear(int32_t iYear); +bool FX_IsLeapYear(int32_t iYear); int32_t FX_DaysInYear(int32_t iYear); uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); @@ -80,13 +80,13 @@ class CFX_Unitime { uint8_t GetMinute() const; uint8_t GetSecond() const; uint16_t GetMillisecond() const; - FX_BOOL AddYears(int32_t iYears); - FX_BOOL AddMonths(int32_t iMonths); - FX_BOOL AddDays(int32_t iDays); - FX_BOOL AddHours(int32_t iHours); - FX_BOOL AddMinutes(int32_t iMinutes); - FX_BOOL AddSeconds(int32_t iSeconds); - FX_BOOL AddMilliseconds(int32_t iMilliseconds); + bool AddYears(int32_t iYears); + bool AddMonths(int32_t iMonths); + bool AddDays(int32_t iDays); + bool AddHours(int32_t iHours); + bool AddMinutes(int32_t iMinutes); + bool AddSeconds(int32_t iSeconds); + bool AddMilliseconds(int32_t iMilliseconds); friend CFX_Unitime operator+(const CFX_Unitime& t1, const CFX_Unitime& t2) { return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime); } @@ -243,14 +243,14 @@ class CFX_DateTime { FromUnitime(ToUnitime() - ((const CFX_DateTime&)dt).ToUnitime()); return *this; } - virtual FX_BOOL Set(int32_t year, - uint8_t month, - uint8_t day, - uint8_t hour = 0, - uint8_t minute = 0, - uint8_t second = 0, - uint16_t millisecond = 0); - virtual FX_BOOL FromUnitime(FX_UNITIME t); + virtual bool Set(int32_t year, + uint8_t month, + uint8_t day, + uint8_t hour = 0, + uint8_t minute = 0, + uint8_t second = 0, + uint16_t millisecond = 0); + virtual bool FromUnitime(FX_UNITIME t); virtual FX_UNITIME ToUnitime() const; virtual int32_t GetYear() const; virtual uint8_t GetMonth() const; @@ -262,13 +262,13 @@ class CFX_DateTime { virtual uint8_t GetMinute() const; virtual uint8_t GetSecond() const; virtual uint16_t GetMillisecond() const; - virtual FX_BOOL AddYears(int32_t iYears); - virtual FX_BOOL AddMonths(int32_t iMonths); - virtual FX_BOOL AddDays(int32_t iDays); - virtual FX_BOOL AddHours(int32_t iHours); - virtual FX_BOOL AddMinutes(int32_t iMinutes); - virtual FX_BOOL AddSeconds(int32_t iSeconds); - virtual FX_BOOL AddMilliseconds(int32_t iMilliseconds); + virtual bool AddYears(int32_t iYears); + virtual bool AddMonths(int32_t iMonths); + virtual bool AddDays(int32_t iDays); + virtual bool AddHours(int32_t iHours); + virtual bool AddMinutes(int32_t iMinutes); + virtual bool AddSeconds(int32_t iSeconds); + virtual bool AddMilliseconds(int32_t iMilliseconds); friend CFX_DateTime operator+(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { CFX_DateTime dt; @@ -305,66 +305,66 @@ class CFX_DateTime { dt.FromUnitime(((const CFX_DateTime&)dt1).ToUnitime() - dt2.ToUnitime()); return dt; } - friend FX_BOOL operator==(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { + friend bool operator==(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), static_cast<const FX_DATETIME*>(dt2), sizeof(FX_DATETIME)) == 0; } - friend FX_BOOL operator==(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { + friend bool operator==(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2, sizeof(FX_DATETIME)) == 0; } - friend FX_BOOL operator==(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { + friend bool operator==(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2), sizeof(FX_DATETIME)) == 0; } - friend FX_BOOL operator!=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { + friend bool operator!=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), static_cast<const FX_DATETIME*>(dt2), sizeof(FX_DATETIME)) != 0; } - friend FX_BOOL operator!=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { + friend bool operator!=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2, sizeof(FX_DATETIME)) != 0; } - friend FX_BOOL operator!=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { + friend bool operator!=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2), sizeof(FX_DATETIME)) != 0; } - friend FX_BOOL operator>(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { + friend bool operator>(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { return dt1.ToUnitime() > dt2.ToUnitime(); } - friend FX_BOOL operator>(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { + friend bool operator>(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { return dt1.ToUnitime() > ((const CFX_DateTime&)dt2).ToUnitime(); } - friend FX_BOOL operator>(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { + friend bool operator>(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { return ((const CFX_DateTime&)dt1).ToUnitime() > dt2.ToUnitime(); } - friend FX_BOOL operator>=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { + friend bool operator>=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { return dt1.ToUnitime() >= dt2.ToUnitime(); } - friend FX_BOOL operator>=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { + friend bool operator>=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { return dt1.ToUnitime() >= ((const CFX_DateTime&)dt2).ToUnitime(); } - friend FX_BOOL operator>=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { + friend bool operator>=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { return ((const CFX_DateTime&)dt1).ToUnitime() >= dt2.ToUnitime(); } - friend FX_BOOL operator<(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { + friend bool operator<(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { return dt1.ToUnitime() < dt2.ToUnitime(); } - friend FX_BOOL operator<(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { + friend bool operator<(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { return dt1.ToUnitime() < ((const CFX_DateTime&)dt2).ToUnitime(); } - friend FX_BOOL operator<(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { + friend bool operator<(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { return ((const CFX_DateTime&)dt1).ToUnitime() < dt2.ToUnitime(); } - friend FX_BOOL operator<=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { + friend bool operator<=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) { return dt1.ToUnitime() <= dt2.ToUnitime(); } - friend FX_BOOL operator<=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { + friend bool operator<=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) { return dt1.ToUnitime() <= ((const CFX_DateTime&)dt2).ToUnitime(); } - friend FX_BOOL operator<=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { + friend bool operator<=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) { return ((const CFX_DateTime&)dt1).ToUnitime() <= dt2.ToUnitime(); } diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index f8715fdf1c..da4acb2a81 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -99,21 +99,21 @@ class CFX_LCNumeric { FX_FLOAT GetFloat() const; double GetDouble() const; CFX_WideString ToString() const; - CFX_WideString ToString(int32_t nTreading, FX_BOOL bTrimTailZeros) const; + CFX_WideString ToString(int32_t nTreading, bool bTrimTailZeros) const; int64_t m_Integral; uint32_t m_Fractional; int32_t m_Exponent; }; -static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, - CFX_LCNumeric& lcnum) { +static bool FX_WStringToNumeric(const CFX_WideString& wsValue, + CFX_LCNumeric& lcnum) { lcnum.m_Integral = 0; lcnum.m_Fractional = 0; lcnum.m_Exponent = 0; if (wsValue.IsEmpty()) - return FALSE; + return false; const int32_t nIntegralMaxLen = 17; int32_t cc = 0; @@ -125,7 +125,7 @@ static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, cc++; if (cc >= len) - return FALSE; + return false; if (str[cc] == '+') { cc++; @@ -141,7 +141,7 @@ static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, if (!FXSYS_isDecimalDigit(str[cc])) { if ((str[cc] == 'E' || str[cc] == 'e')) break; - return FALSE; + return false; } if (nIntegralLen < nIntegralMaxLen) { lcnum.m_Integral = lcnum.m_Integral * 10 + str[cc] - '0'; @@ -166,7 +166,7 @@ static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, if (!FXSYS_isDecimalDigit(str[cc])) { if ((str[cc] == 'E' || str[cc] == 'e')) break; - return FALSE; + return false; } fraction += FXSYS_FractionalScale(scale, FXSYS_toDecimalDigit(str[cc])); scale++; @@ -186,13 +186,13 @@ static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, } while (cc < len) { if (FXSYS_isDecimalDigit(str[cc])) - return FALSE; + return false; lcnum.m_Exponent = lcnum.m_Exponent * 10 + str[cc] - '0'; cc++; } lcnum.m_Exponent = bExpSign ? -lcnum.m_Exponent : lcnum.m_Exponent; } - return TRUE; + return true; } CFX_LCNumeric::CFX_LCNumeric() { @@ -242,11 +242,11 @@ double CFX_LCNumeric::GetDouble() const { } CFX_WideString CFX_LCNumeric::ToString() const { - return ToString(8, TRUE); + return ToString(8, true); } CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading, - FX_BOOL bTrimTailZeros) const { + bool bTrimTailZeros) const { CFX_WideString wsFormat; wsFormat.Format(L"%%.%df", nTreading); CFX_WideString wsResult; @@ -258,7 +258,7 @@ CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading, return wsResult; } -CFX_FormatString::CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, FX_BOOL bUseLCID) +CFX_FormatString::CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, bool bUseLCID) : m_pLocaleMgr(pLocaleMgr), m_bUseLCID(bUseLCID) {} CFX_FormatString::~CFX_FormatString() {} void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString, @@ -267,8 +267,8 @@ void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString, const FX_WCHAR* pStr = wsFormatString.c_str(); const FX_WCHAR* pToken = pStr; const FX_WCHAR* pEnd = pStr + iStrLen; - FX_BOOL iQuote = FALSE; - while (TRUE) { + bool iQuote = false; + while (true) { if (pStr >= pEnd) { CFX_WideString sub(pToken, pStr - pToken); wsPatterns.Add(sub); @@ -376,7 +376,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const FX_WCHAR* pStr = wsPattern.c_str(); - FX_BOOL bBraceOpen = FALSE; + bool bBraceOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -384,7 +384,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( } else if (!bBraceOpen && wsConstChars.Find(pStr[ccf]) == -1) { CFX_WideString wsCategory(pStr[ccf]); ccf++; - while (TRUE) { + while (true) { if (ccf == iLenf) { return eCategory; } @@ -392,7 +392,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( break; } if (pStr[ccf] == '{') { - bBraceOpen = TRUE; + bBraceOpen = true; break; } wsCategory += pStr[ccf]; @@ -421,7 +421,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( return FX_LOCALECATEGORY_Null; } } else if (pStr[ccf] == '}') { - bBraceOpen = FALSE; + bBraceOpen = false; } ccf++; } @@ -464,7 +464,7 @@ IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern, int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const FX_WCHAR* pStr = wsPattern.c_str(); - FX_BOOL bBrackOpen = FALSE; + bool bBrackOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -491,7 +491,7 @@ IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern, } pLocale = GetPatternLocale(wsLCID); } else if (pStr[ccf] == '{') { - bBrackOpen = TRUE; + bBrackOpen = true; break; } ccf++; @@ -521,8 +521,8 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const FX_WCHAR* pStr = wsPattern.c_str(); - FX_BOOL bFindDot = FALSE; - FX_BOOL bBrackOpen = FALSE; + bool bFindDot = false; + bool bBrackOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -538,7 +538,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, ccf++; } if (wsCategory != FX_WSTRC(L"num")) { - bBrackOpen = TRUE; + bBrackOpen = true; ccf = 0; continue; } @@ -551,7 +551,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, } pLocale = GetPatternLocale(wsLCID); } else if (pStr[ccf] == '{') { - bBrackOpen = TRUE; + bBrackOpen = true; break; } else if (pStr[ccf] == '.') { CFX_WideString wsSubCategory; @@ -578,7 +578,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, iDotIndex = wsSubCategory.Find('.'); if (iDotIndex > 0) { iDotIndex += wsPurgePattern.GetLength(); - bFindDot = TRUE; + bFindDot = true; dwStyle |= FX_NUMSTYLE_DotVorv; } wsPurgePattern += wsSubCategory; @@ -600,7 +600,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, } if (!bFindDot) { if (pStr[ccf] == '.' || pStr[ccf] == 'V' || pStr[ccf] == 'v') { - bFindDot = TRUE; + bFindDot = true; iDotIndex = wsPurgePattern.GetLength() - 1; dwStyle |= FX_NUMSTYLE_DotVorv; } @@ -615,9 +615,9 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, } return pLocale; } -static FX_BOOL FX_GetNumericDotIndex(const CFX_WideString& wsNum, - const CFX_WideString& wsDotSymbol, - int32_t& iDotIndex) { +static bool FX_GetNumericDotIndex(const CFX_WideString& wsNum, + const CFX_WideString& wsDotSymbol, + int32_t& iDotIndex) { int32_t ccf = 0; int32_t iLenf = wsNum.GetLength(); const FX_WCHAR* pStr = wsNum.c_str(); @@ -628,28 +628,28 @@ static FX_BOOL FX_GetNumericDotIndex(const CFX_WideString& wsNum, } else if (ccf + iLenDot <= iLenf && !FXSYS_wcsncmp(pStr + ccf, wsDotSymbol.c_str(), iLenDot)) { iDotIndex = ccf; - return TRUE; + return true; } ccf++; } iDotIndex = wsNum.Find('.'); if (iDotIndex < 0) { iDotIndex = iLenf; - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString& wsValue) { +bool CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern, + CFX_WideString& wsValue) { wsValue.clear(); if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat); if (wsTextFormat.IsEmpty()) { - return FALSE; + return false; } int32_t iText = 0, iPattern = 0; const FX_WCHAR* pStrText = wsSrcText.c_str(); @@ -665,7 +665,7 @@ FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { wsValue = wsSrcText; - return FALSE; + return false; } iText += iLiteralLen; iPattern++; @@ -702,7 +702,7 @@ FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, default: if (pStrPattern[iPattern] != pStrText[iText]) { wsValue = wsSrcText; - return FALSE; + return false; } iPattern++; iText++; @@ -711,12 +711,12 @@ FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, } return iPattern == iLenPattern && iText == iLenText; } -FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - FX_FLOAT& fValue) { +bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, + const CFX_WideString& wsPattern, + FX_FLOAT& fValue) { fValue = 0.0f; if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } int32_t dot_index_f = -1; uint32_t dwFormatStyle = 0; @@ -724,7 +724,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, IFX_Locale* pLocale = GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) { - return FALSE; + return false; } int32_t iExponent = 0; CFX_WideString wsDotSymbol; @@ -742,15 +742,15 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int lenf = wsNumFormat.GetLength(); double dbRetValue = 0; double coeff = 1; - FX_BOOL bHavePercentSymbol = FALSE; - FX_BOOL bNeg = FALSE; - FX_BOOL bReverseParse = FALSE; + bool bHavePercentSymbol = false; + bool bNeg = false; + bool bReverseParse = false; int32_t dot_index = 0; if (!FX_GetNumericDotIndex(wsSrcNum, wsDotSymbol, dot_index) && (dwFormatStyle & FX_NUMSTYLE_DotVorv)) { - bReverseParse = TRUE; + bReverseParse = true; } - bReverseParse = FALSE; + bReverseParse = false; if (bReverseParse) { ccf = lenf - 1; cc = len - 1; @@ -762,7 +762,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc -= iLiteralLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc--; ccf--; @@ -770,7 +770,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } case '9': if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1; coeff *= 0.1; @@ -799,10 +799,10 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { cc -= iMinusLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } cc--; - bNeg = TRUE; + bNeg = true; } ccf--; break; @@ -812,18 +812,18 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { cc -= iMinusLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } cc--; - bNeg = TRUE; + bNeg = true; } ccf--; break; case 'E': { if (cc >= dot_index) { - return FALSE; + return false; } - FX_BOOL bExpSign = FALSE; + bool bExpSign = false; while (cc >= 0) { if (str[cc] == 'E' || str[cc] == 'e') { break; @@ -838,10 +838,10 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), iMinusLen)) { - bExpSign = TRUE; + bExpSign = true; cc -= iMinusLen; } else { - return FALSE; + return false; } } cc--; @@ -855,7 +855,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { - return FALSE; + return false; } cc--; ccf--; @@ -863,7 +863,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'r': if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') { if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -876,7 +876,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -887,7 +887,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'b': if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') { if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -900,7 +900,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -911,7 +911,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case '.': case 'V': case 'v': - return FALSE; + return false; case '%': { CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); @@ -919,11 +919,11 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc -= iSysmbolLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { - return FALSE; + return false; } cc--; ccf--; - bHavePercentSymbol = TRUE; + bHavePercentSymbol = true; } break; case '8': while (ccf < lenf && strf[ccf] == '8') { @@ -950,25 +950,25 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '(': if (str[cc] == L'(') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc--; ccf--; break; case ')': if (str[cc] == L')') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc--; ccf--; break; default: if (strf[ccf] != str[cc]) { - return FALSE; + return false; } cc--; ccf--; @@ -986,7 +986,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc--; ccf--; @@ -994,7 +994,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } case '9': if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } dbRetValue = dbRetValue + (str[cc] - '0') * coeff; coeff *= 10; @@ -1027,10 +1027,10 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { cc -= iMinusLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } cc--; - bNeg = TRUE; + bNeg = true; } ccf--; break; @@ -1040,18 +1040,18 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { cc -= iMinusLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } cc--; - bNeg = TRUE; + bNeg = true; } ccf--; break; case 'E': { if (cc >= dot_index) { - return FALSE; + return false; } - FX_BOOL bExpSign = FALSE; + bool bExpSign = false; while (cc >= 0) { if (str[cc] == 'E' || str[cc] == 'e') { break; @@ -1066,10 +1066,10 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), iMinusLen)) { - bExpSign = TRUE; + bExpSign = true; cc -= iMinusLen; } else { - return FALSE; + return false; } } cc--; @@ -1082,7 +1082,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { - return FALSE; + return false; } cc--; ccf--; @@ -1090,7 +1090,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'r': if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') { if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1103,7 +1103,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1114,7 +1114,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'b': if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') { if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1127,7 +1127,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1138,21 +1138,21 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case '.': case 'V': case 'v': - return FALSE; + return false; case '%': { CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { - return FALSE; + return false; } cc--; ccf--; - bHavePercentSymbol = TRUE; + bHavePercentSymbol = true; } break; case '8': - return FALSE; + return false; case ',': { if (cc >= 0) { cc -= iGroupLen - 1; @@ -1167,32 +1167,32 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '(': if (str[cc] == L'(') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc--; ccf--; break; case ')': if (str[cc] == L')') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc--; ccf--; break; default: if (strf[ccf] != str[cc]) { - return FALSE; + return false; } cc--; ccf--; } } if (cc >= 0) { - return FALSE; + return false; } if (!bReverseParse) { ccf = dot_index_f + 1; @@ -1205,7 +1205,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc += iLiteralLen; ccf++; @@ -1213,7 +1213,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } case '9': if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } { dbRetValue = dbRetValue + (str[cc] - '0') * coeff; @@ -1248,9 +1248,9 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } - bNeg = TRUE; + bNeg = true; cc += iMinusLen; } ccf++; @@ -1261,24 +1261,24 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } - bNeg = TRUE; + bNeg = true; cc += iMinusLen; } ccf++; break; case 'E': { if (cc >= len || (str[cc] != 'E' && str[cc] != 'e')) { - return FALSE; + return false; } - FX_BOOL bExpSign = FALSE; + bool bExpSign = false; cc++; if (cc < len) { if (str[cc] == '+') { cc++; } else if (str[cc] == '-') { - bExpSign = TRUE; + bExpSign = true; cc++; } } @@ -1299,7 +1299,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iSymbolLen = wsSymbol.GetLength(); if (cc + iSymbolLen > len || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { - return FALSE; + return false; } cc += iSymbolLen; ccf++; @@ -1307,7 +1307,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'c': if (ccf + 1 < lenf && strf[ccf + 1] == 'r') { if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1318,7 +1318,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1327,7 +1327,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'd': if (ccf + 1 < lenf && strf[ccf + 1] == 'b') { if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1338,7 +1338,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1347,7 +1347,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case '.': case 'V': case 'v': - return FALSE; + return false; case '%': { CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); @@ -1357,7 +1357,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc += iSysmbolLen; } ccf++; - bHavePercentSymbol = TRUE; + bHavePercentSymbol = true; } break; case '8': { while (ccf < lenf && strf[ccf] == '8') { @@ -1378,32 +1378,32 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '(': if (str[cc] == L'(') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc++; ccf++; break; case ')': if (str[cc] == L')') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc++; ccf++; break; default: if (strf[ccf] != str[cc]) { - return FALSE; + return false; } cc++; ccf++; } } if (cc != len) { - return FALSE; + return false; } } if (iExponent) { @@ -1416,15 +1416,15 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, dbRetValue = -dbRetValue; } fValue = (FX_FLOAT)dbRetValue; - return TRUE; + return true; } -FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsValue) { +bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsValue) { wsValue.clear(); if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } int32_t dot_index_f = -1; uint32_t dwFormatStyle = 0; @@ -1432,7 +1432,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, IFX_Locale* pLocale = GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) { - return FALSE; + return false; } int32_t iExponent = 0; CFX_WideString wsDotSymbol; @@ -1448,15 +1448,15 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int len = wsSrcNum.GetLength(); const FX_WCHAR* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); - FX_BOOL bHavePercentSymbol = FALSE; - FX_BOOL bNeg = FALSE; - FX_BOOL bReverseParse = FALSE; + bool bHavePercentSymbol = false; + bool bNeg = false; + bool bReverseParse = false; int32_t dot_index = 0; if (!FX_GetNumericDotIndex(wsSrcNum, wsDotSymbol, dot_index) && (dwFormatStyle & FX_NUMSTYLE_DotVorv)) { - bReverseParse = TRUE; + bReverseParse = true; } - bReverseParse = FALSE; + bReverseParse = false; ccf = dot_index_f - 1; cc = dot_index - 1; while (ccf >= 0 && cc >= 0) { @@ -1466,7 +1466,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc--; ccf--; @@ -1474,7 +1474,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } case '9': if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } wsValue = str[cc] + wsValue; cc--; @@ -1504,10 +1504,10 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { cc -= iMinusLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } cc--; - bNeg = TRUE; + bNeg = true; } ccf--; break; @@ -1517,18 +1517,18 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { cc -= iMinusLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } cc--; - bNeg = TRUE; + bNeg = true; } ccf--; break; case 'E': { if (cc >= dot_index) { - return FALSE; + return false; } - FX_BOOL bExpSign = FALSE; + bool bExpSign = false; while (cc >= 0) { if (str[cc] == 'E' || str[cc] == 'e') { break; @@ -1543,10 +1543,10 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), iMinusLen)) { - bExpSign = TRUE; + bExpSign = true; cc -= iMinusLen; } else { - return FALSE; + return false; } } cc--; @@ -1559,7 +1559,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { - return FALSE; + return false; } cc--; ccf--; @@ -1567,7 +1567,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'r': if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') { if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1580,7 +1580,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1591,7 +1591,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'b': if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') { if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1604,7 +1604,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') { - bNeg = TRUE; + bNeg = true; cc -= 2; } ccf -= 2; @@ -1615,21 +1615,21 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case '.': case 'V': case 'v': - return FALSE; + return false; case '%': { CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { - return FALSE; + return false; } cc--; ccf--; - bHavePercentSymbol = TRUE; + bHavePercentSymbol = true; } break; case '8': - return FALSE; + return false; case ',': { if (cc >= 0) { cc -= iGroupLen - 1; @@ -1644,25 +1644,25 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '(': if (str[cc] == L'(') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc--; ccf--; break; case ')': if (str[cc] == L')') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc--; ccf--; break; default: if (strf[ccf] != str[cc]) { - return FALSE; + return false; } cc--; ccf--; @@ -1670,11 +1670,11 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } if (cc >= 0) { if (str[cc] == '-') { - bNeg = TRUE; + bNeg = true; cc--; } if (cc >= 0) { - return FALSE; + return false; } } if (dot_index < len && (dwFormatStyle & FX_NUMSTYLE_DotVorv)) { @@ -1690,7 +1690,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc += iLiteralLen; ccf++; @@ -1698,7 +1698,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } case '9': if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } { wsValue += str[cc]; } cc++; @@ -1728,9 +1728,9 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } - bNeg = TRUE; + bNeg = true; cc += iMinusLen; } ccf++; @@ -1741,24 +1741,24 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } else { if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { - return FALSE; + return false; } - bNeg = TRUE; + bNeg = true; cc += iMinusLen; } ccf++; break; case 'E': { if (cc >= len || (str[cc] != 'E' && str[cc] != 'e')) { - return FALSE; + return false; } - FX_BOOL bExpSign = FALSE; + bool bExpSign = false; cc++; if (cc < len) { if (str[cc] == '+') { cc++; } else if (str[cc] == '-') { - bExpSign = TRUE; + bExpSign = true; cc++; } } @@ -1779,7 +1779,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iSymbolLen = wsSymbol.GetLength(); if (cc + iSymbolLen > len || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { - return FALSE; + return false; } cc += iSymbolLen; ccf++; @@ -1787,7 +1787,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'c': if (ccf + 1 < lenf && strf[ccf + 1] == 'r') { if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1798,7 +1798,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1807,7 +1807,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'd': if (ccf + 1 < lenf && strf[ccf + 1] == 'b') { if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1818,7 +1818,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (str[cc] == ' ') { cc++; } else if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') { - bNeg = TRUE; + bNeg = true; cc += 2; } ccf += 2; @@ -1827,7 +1827,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case '.': case 'V': case 'v': - return FALSE; + return false; case '%': { CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); @@ -1837,7 +1837,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc += iSysmbolLen; } ccf++; - bHavePercentSymbol = TRUE; + bHavePercentSymbol = true; } break; case '8': { while (ccf < lenf && strf[ccf] == '8') { @@ -1857,32 +1857,32 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '(': if (str[cc] == L'(') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc++; ccf++; break; case ')': if (str[cc] == L')') { - bNeg = TRUE; + bNeg = true; } else if (str[cc] != L' ') { - return FALSE; + return false; } cc++; ccf++; break; default: if (strf[ccf] != str[cc]) { - return FALSE; + return false; } cc++; ccf++; } } if (cc != len) { - return FALSE; + return false; } } if (iExponent || bHavePercentSymbol) { @@ -1898,7 +1898,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (bNeg) { wsValue = L'-' + wsValue; } - return TRUE; + return true; } FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( const CFX_WideString& wsPattern, @@ -1912,7 +1912,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( int32_t iLenf = wsPattern.GetLength(); const FX_WCHAR* pStr = wsPattern.c_str(); int32_t iFindCategory = 0; - FX_BOOL bBraceOpen = FALSE; + bool bBraceOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -1961,7 +1961,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( } pLocale = GetPatternLocale(wsLCID); } else if (pStr[ccf] == '{') { - bBraceOpen = TRUE; + bBraceOpen = true; break; } else if (pStr[ccf] == '.') { CFX_WideString wsSubCategory; @@ -2008,7 +2008,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( ccf++; } } else if (pStr[ccf] == '}') { - bBraceOpen = FALSE; + bBraceOpen = false; if (!wsTempPattern.IsEmpty()) { if (eCategory == FX_LOCALECATEGORY_Time) { wsTimePattern = wsTempPattern; @@ -2038,11 +2038,11 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( } return (FX_DATETIMETYPE)iFindCategory; } -static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, - const CFX_WideString& wsDatePattern, - IFX_Locale* pLocale, - CFX_Unitime& datetime, - int32_t& cc) { +static bool FX_ParseLocaleDate(const CFX_WideString& wsDate, + const CFX_WideString& wsDatePattern, + IFX_Locale* pLocale, + CFX_Unitime& datetime, + int32_t& cc) { int32_t year = 1900; int32_t month = 1; int32_t day = 1; @@ -2058,14 +2058,14 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc += iLiteralLen; ccf++; continue; } else if (wsDateSymbols.Find(strf[ccf]) == -1) { if (strf[ccf] != str[cc]) - return FALSE; + return false; cc++; ccf++; continue; @@ -2079,7 +2079,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } day = str[cc++] - '0'; if (cc < len && FXSYS_isDecimalDigit(str[cc])) { @@ -2087,7 +2087,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, } } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } day = str[cc++] - '0'; if (cc < len) { @@ -2103,7 +2103,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, cc += 3; } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } month = str[cc++] - '0'; if (cc < len && FXSYS_isDecimalDigit(str[cc])) { @@ -2111,7 +2111,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, } } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } month = str[cc++] - '0'; if (cc < len) { @@ -2121,7 +2121,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, CFX_WideString wsMonthNameAbbr; uint16_t i = 0; for (; i < 12; i++) { - pLocale->GetMonthName(i, wsMonthNameAbbr, TRUE); + pLocale->GetMonthName(i, wsMonthNameAbbr, true); if (wsMonthNameAbbr.IsEmpty()) { continue; } @@ -2138,7 +2138,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, CFX_WideString wsMonthName; uint16_t i = 0; for (; i < 12; i++) { - pLocale->GetMonthName(i, wsMonthName, FALSE); + pLocale->GetMonthName(i, wsMonthName, false); if (wsMonthName.IsEmpty()) { continue; } @@ -2157,7 +2157,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, CFX_WideString wsDayNameAbbr; uint16_t i = 0; for (; i < 7; i++) { - pLocale->GetDayName(i, wsDayNameAbbr, TRUE); + pLocale->GetDayName(i, wsDayNameAbbr, true); if (wsDayNameAbbr.IsEmpty()) { continue; } @@ -2173,7 +2173,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, CFX_WideString wsDayName; int32_t i = 0; for (; i < 7; i++) { - pLocale->GetDayName(i, wsDayName, FALSE); + pLocale->GetDayName(i, wsDayName, false); if (wsDayName == L"") { continue; } @@ -2191,14 +2191,14 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, cc += 2; } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) { if (cc + 2 > len) { - return FALSE; + return false; } if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } year = str[cc++] - '0'; if (cc >= len || !FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } year = year * 10 + str[cc++] - '0'; if (year <= 29) { @@ -2210,11 +2210,11 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, int i = 0; year = 0; if (cc + 4 > len) { - return FALSE; + return false; } while (i < 4) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } year = year * 10 + str[cc] - '0'; cc++; @@ -2227,7 +2227,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, } } if (cc < len) { - return FALSE; + return false; } CFX_Unitime ut; ut.Set(year, month, day); @@ -2255,11 +2255,11 @@ static void FX_ResolveZone(uint8_t& wHour, wHour = iMinuteDiff / 60; wMinute = iMinuteDiff % 60; } -static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, - const CFX_WideString& wsTimePattern, - IFX_Locale* pLocale, - CFX_Unitime& datetime, - int32_t& cc) { +static bool FX_ParseLocaleTime(const CFX_WideString& wsTime, + const CFX_WideString& wsTimePattern, + IFX_Locale* pLocale, + CFX_Unitime& datetime, + int32_t& cc) { uint8_t hour = 0; uint8_t minute = 0; uint8_t second = 0; @@ -2269,8 +2269,8 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, int len = wsTime.GetLength(); const FX_WCHAR* strf = wsTimePattern.c_str(); int lenf = wsTimePattern.GetLength(); - FX_BOOL bHasA = FALSE; - FX_BOOL bPM = FALSE; + bool bHasA = false; + bool bPM = false; CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols); while (cc < len && ccf < lenf) { if (strf[ccf] == '\'') { @@ -2278,14 +2278,14 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } cc += iLiteralLen; ccf++; continue; } else if (wsTimeSymbols.Find(strf[ccf]) == -1) { if (strf[ccf] != str[cc]) - return FALSE; + return false; cc++; ccf++; continue; @@ -2302,7 +2302,7 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, dwSymbol == FXBSTR_ID(0, 0, 'h', '1') || dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } hour = str[cc++] - '0'; if (cc < len && FXSYS_isDecimalDigit(str[cc])) { @@ -2316,14 +2316,14 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, dwSymbol == FXBSTR_ID(0, 0, 'h', '2') || dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } hour = str[cc++] - '0'; if (cc >= len) { - return FALSE; + return false; } if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } hour = hour * 10 + str[cc++] - '0'; if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2') && hour == 24) { @@ -2331,7 +2331,7 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, } } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } minute = str[cc++] - '0'; if (cc < len && FXSYS_isDecimalDigit(str[cc])) { @@ -2339,19 +2339,19 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, } } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } minute = str[cc++] - '0'; if (cc >= len) { - return FALSE; + return false; } if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } minute = minute * 10 + str[cc++] - '0'; } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } second = str[cc++] - '0'; if (cc < len && FXSYS_isDecimalDigit(str[cc])) { @@ -2359,42 +2359,42 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, } } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } second = str[cc++] - '0'; if (cc >= len) { - return FALSE; + return false; } if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } second = second * 10 + str[cc++] - '0'; } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) { if (cc + 3 >= len) { - return FALSE; + return false; } int i = 0; while (i < 3) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } millisecond = millisecond * 10 + str[cc++] - '0'; i++; } } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) { CFX_WideString wsAM; - pLocale->GetMeridiemName(wsAM, TRUE); + pLocale->GetMeridiemName(wsAM, true); CFX_WideString wsPM; - pLocale->GetMeridiemName(wsPM, FALSE); + pLocale->GetMeridiemName(wsPM, false); if ((cc + wsAM.GetLength() <= len) && (CFX_WideStringC(str + cc, wsAM.GetLength()) == wsAM)) { cc += wsAM.GetLength(); - bHasA = TRUE; + bHasA = true; } else if ((cc + wsPM.GetLength() <= len) && (CFX_WideStringC(str + cc, wsPM.GetLength()) == wsPM)) { cc += wsPM.GetLength(); - bHasA = TRUE; - bPM = TRUE; + bHasA = true; + bPM = true; } } else if (dwSymbol == FXBSTR_ID(0, 0, 'Z', '1')) { if (cc + 3 > len) { @@ -2452,54 +2452,54 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, return !!cc; } -FX_BOOL CFX_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, - FX_DATETIMETYPE eDateTimeType, - CFX_Unitime& dtValue) { +bool CFX_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, + const CFX_WideString& wsPattern, + FX_DATETIMETYPE eDateTimeType, + CFX_Unitime& dtValue) { dtValue.Set(0); if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsDatePattern, wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale) { - return FALSE; + return false; } if (eCategory == FX_DATETIMETYPE_Unknown) { eCategory = eDateTimeType; } if (eCategory == FX_DATETIMETYPE_Unknown) { - return FALSE; + return false; } if (eCategory == FX_DATETIMETYPE_TimeDate) { int32_t iStart = 0; if (!FX_ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue, iStart)) { - return FALSE; + return false; } if (!FX_ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue, iStart)) { - return FALSE; + return false; } } else { int32_t iStart = 0; if ((eCategory & FX_DATETIMETYPE_Date) && !FX_ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue, iStart)) { - return FALSE; + return false; } if ((eCategory & FX_DATETIMETYPE_Time) && !FX_ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue, iStart)) { - return FALSE; + return false; } } - return TRUE; + return true; } -FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern) { +bool CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern) { CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat); int32_t iText = 0, iPattern = 0; @@ -2514,13 +2514,13 @@ FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } iText += iLiteralLen; iPattern++; continue; } else if (pStrPattern[iPattern] != pStrText[iText]) { - return FALSE; + return false; } else { iText++; iPattern++; @@ -2528,8 +2528,8 @@ FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, } return iPattern == iLenPattern && iText == iLenText; } -FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern) { +bool CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern) { CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat); int32_t iText = 0, iPattern = 0; @@ -2544,13 +2544,13 @@ FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { - return FALSE; + return false; } iText += iLiteralLen; iPattern++; continue; } else if (pStrPattern[iPattern] != pStrText[iText]) { - return FALSE; + return false; } else { iText++; iPattern++; @@ -2558,15 +2558,15 @@ FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, } return iPattern == iLenPattern && iText == iLenText; } -FX_BOOL CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsPattern.IsEmpty()) { - return FALSE; + return false; } int32_t iLenText = wsSrcText.GetLength(); if (iLenText == 0) { - return FALSE; + return false; } CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat); @@ -2583,14 +2583,14 @@ FX_BOOL CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, } case 'A': if (iText >= iLenText || !FXSYS_iswalpha(pStrText[iText])) { - return FALSE; + return false; } wsOutput += pStrText[iText++]; iPattern++; break; case 'X': if (iText >= iLenText) { - return FALSE; + return false; } wsOutput += pStrText[iText++]; iPattern++; @@ -2599,14 +2599,14 @@ FX_BOOL CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, case '0': if (iText >= iLenText || (!FXSYS_isDecimalDigit(pStrText[iText]) && !FXSYS_iswalpha(pStrText[iText]))) { - return FALSE; + return false; } wsOutput += pStrText[iText++]; iPattern++; break; case '9': if (iText >= iLenText || !FXSYS_isDecimalDigit(pStrText[iText])) { - return FALSE; + return false; } wsOutput += pStrText[iText++]; iPattern++; @@ -2620,7 +2620,7 @@ FX_BOOL CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, } static int32_t FX_GetNumTrailingLimit(const CFX_WideString& wsFormat, int iDotPos, - FX_BOOL& bTrimTailZeros) { + bool& bTrimTailZeros) { if (iDotPos < 0) { return 0; } @@ -2630,16 +2630,16 @@ static int32_t FX_GetNumTrailingLimit(const CFX_WideString& wsFormat, FX_WCHAR wc = wsFormat[iDotPos]; if (wc == L'z' || wc == L'9' || wc == 'Z') { iTreading++; - bTrimTailZeros = (wc == L'9' ? FALSE : TRUE); + bTrimTailZeros = (wc == L'9' ? false : true); } } return iTreading; } -FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsInputNum.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } int32_t dot_index_f = -1; uint32_t dwNumStyle = 0; @@ -2647,7 +2647,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, IFX_Locale* pLocale = GetNumericFormat(wsPattern, dot_index_f, dwNumStyle, wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) { - return FALSE; + return false; } int32_t cc = 0, ccf = 0; const FX_WCHAR* strf = wsNumFormat.c_str(); @@ -2700,7 +2700,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, } } } - FX_BOOL bTrimTailZeros = FALSE; + bool bTrimTailZeros = false; int32_t iTreading = FX_GetNumTrailingLimit(wsNumFormat, dot_index_f, bTrimTailZeros); int32_t scale = decimal.GetScale(); @@ -2714,12 +2714,12 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, } CFX_WideString wsGroupSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol); - FX_BOOL bNeg = FALSE; + bool bNeg = false; if (wsSrcNum[0] == '-') { - bNeg = TRUE; + bNeg = true; wsSrcNum.Delete(0, 1); } - FX_BOOL bAddNeg = FALSE; + bool bAddNeg = false; const FX_WCHAR* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); int dot_index = wsSrcNum.Find('.'); @@ -2733,7 +2733,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, case '9': if (cc >= 0) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } wsOutput = str[cc] + wsOutput; cc--; @@ -2745,7 +2745,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, case 'z': if (cc >= 0) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } if (str[0] != '0') { wsOutput = str[cc] + wsOutput; @@ -2757,7 +2757,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, case 'Z': if (cc >= 0) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } if (str[0] == '0') { wsOutput = L' ' + wsOutput; @@ -2775,7 +2775,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, CFX_WideString wsMinusSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol); wsOutput = wsMinusSymbol + wsOutput; - bAddNeg = TRUE; + bAddNeg = true; } else { wsOutput = L' ' + wsOutput; } @@ -2786,7 +2786,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, CFX_WideString wsMinusSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol); wsOutput = wsMinusSymbol + wsOutput; - bAddNeg = TRUE; + bAddNeg = true; } ccf--; break; @@ -2810,7 +2810,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput = L"CR" + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'R': @@ -2821,7 +2821,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput = L" " + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'b': @@ -2830,7 +2830,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput = L"db" + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'B': @@ -2841,7 +2841,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput = L" " + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case '%': { @@ -2863,7 +2863,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, } else { wsOutput = L" " + wsOutput; } - bAddNeg = TRUE; + bAddNeg = true; ccf--; break; case ')': @@ -2903,7 +2903,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol); wsOutput = wsMinusymbol + wsOutput; } - return FALSE; + return false; } if (dot_index_f == wsNumFormat.GetLength()) { if (!bAddNeg && bNeg) { @@ -2911,7 +2911,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol); wsOutput = wsMinusymbol + wsOutput; } - return TRUE; + return true; } CFX_WideString wsDotSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol); @@ -2937,7 +2937,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, case '9': if (cc < len) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } wsOutput += str[cc]; cc++; @@ -2949,7 +2949,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, case 'z': if (cc < len) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } wsOutput += str[cc]; cc++; @@ -2959,7 +2959,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, case 'Z': if (cc < len) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } wsOutput += str[cc]; cc++; @@ -2988,7 +2988,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput += L"CR"; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'C': @@ -2999,7 +2999,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput += L" "; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'd': @@ -3008,7 +3008,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput += L"db"; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'D': @@ -3019,7 +3019,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput += L" "; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case '%': { @@ -3048,7 +3048,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, } else { wsOutput += ' '; } - bAddNeg = TRUE; + bAddNeg = true; ccf++; break; case ')': @@ -3069,18 +3069,18 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput = wsMinusymbol + wsOutput[0] + wsOutput.Mid(1, wsOutput.GetLength() - 1); } - return TRUE; + return true; } -FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { int32_t dot_index_f = -1; uint32_t dwNumStyle = 0; CFX_WideString wsNumFormat; IFX_Locale* pLocale = GetNumericFormat(wsPattern, dot_index_f, dwNumStyle, wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) { - return FALSE; + return false; } int32_t cc = 0, ccf = 0; const FX_WCHAR* strf = wsNumFormat.c_str(); @@ -3131,21 +3131,21 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, if (dwNumStyle & (FX_NUMSTYLE_Percent | FX_NUMSTYLE_Exponent)) { lcNum = CFX_LCNumeric(dbRetValue); } - FX_BOOL bTrimTailZeros = FALSE; + bool bTrimTailZeros = false; int32_t iTreading = FX_GetNumTrailingLimit(wsNumFormat, dot_index_f, bTrimTailZeros); CFX_WideString wsNumeric = lcNum.ToString(iTreading, bTrimTailZeros); if (wsNumeric.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsGroupSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol); - FX_BOOL bNeg = FALSE; + bool bNeg = false; if (wsNumeric[0] == '-') { - bNeg = TRUE; + bNeg = true; wsNumeric.Delete(0, 1); } - FX_BOOL bAddNeg = FALSE; + bool bAddNeg = false; const FX_WCHAR* str = wsNumeric.c_str(); int len = wsNumeric.GetLength(); int dot_index = wsNumeric.Find('.'); @@ -3192,7 +3192,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, CFX_WideString wsMinusSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol); wsOutput = wsMinusSymbol + wsOutput; - bAddNeg = TRUE; + bAddNeg = true; } else { wsOutput = L' ' + wsOutput; } @@ -3203,7 +3203,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, CFX_WideString wsMinusSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol); wsOutput = wsMinusSymbol + wsOutput; - bAddNeg = TRUE; + bAddNeg = true; } ccf--; break; @@ -3227,7 +3227,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput = L"CR" + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'R': @@ -3238,7 +3238,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput = L" " + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'b': @@ -3247,7 +3247,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput = L"db" + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'B': @@ -3258,7 +3258,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput = L" " + wsOutput; } ccf -= 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case '%': { @@ -3280,7 +3280,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, } else { wsOutput = L" " + wsOutput; } - bAddNeg = TRUE; + bAddNeg = true; ccf--; break; case ')': @@ -3320,7 +3320,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol); wsOutput = wsMinusymbol + wsOutput; } - return FALSE; + return false; } if (dot_index_f == wsNumFormat.GetLength()) { if (!bAddNeg && bNeg) { @@ -3328,7 +3328,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol); wsOutput = wsMinusymbol + wsOutput; } - return TRUE; + return true; } CFX_WideString wsDotSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol); @@ -3396,7 +3396,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput += L"CR"; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'C': @@ -3407,7 +3407,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput += L" "; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'd': @@ -3416,7 +3416,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput += L"db"; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case 'D': @@ -3427,7 +3427,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput += L" "; } ccf += 2; - bAddNeg = TRUE; + bAddNeg = true; } break; case '%': { @@ -3456,7 +3456,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, } else { wsOutput += ' '; } - bAddNeg = TRUE; + bAddNeg = true; ccf++; break; case ')': @@ -3477,27 +3477,26 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput = wsOutput[0] + wsMinusymbol + wsOutput.Mid(1, wsOutput.GetLength() - 1); } - return TRUE; + return true; } -FX_BOOL CFX_FormatString::FormatNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatNum(const CFX_WideString& wsSrcNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput); } -FX_BOOL CFX_FormatString::FormatNum(FX_FLOAT fNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatNum(FX_FLOAT fNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_LCNumeric lcNum(fNum); return FormatLCNumeric(lcNum, wsPattern, wsOutput); } -FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, - CFX_Unitime& datetime) { +bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime) { int32_t year = 1900; int32_t month = 1; int32_t day = 1; @@ -3506,17 +3505,17 @@ FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, const FX_WCHAR* str = wsDate.c_str(); int len = wsDate.GetLength(); if (len > 10) { - return FALSE; + return false; } while (cc < len && cc < 4) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } wYear = wYear * 10 + str[cc++] - '0'; } year = wYear; if (cc < 4 || wYear < 1900) { - return FALSE; + return false; } if (cc < len) { if (str[cc] == '-') { @@ -3526,13 +3525,13 @@ FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, uint8_t tmpM = 0; while (cc < len && cc < cc_start + 2) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } tmpM = tmpM * 10 + str[cc++] - '0'; } month = tmpM; if (cc == cc_start + 1 || tmpM > 12 || tmpM < 1) { - return FALSE; + return false; } if (cc < len) { if (str[cc] == '-') { @@ -3542,44 +3541,44 @@ FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, cc_start = cc; while (cc < len && cc < cc_start + 2) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } tmpD = tmpD * 10 + str[cc++] - '0'; } day = tmpD; if (tmpD < 1) { - return FALSE; + return false; } if ((tmpM == 1 || tmpM == 3 || tmpM == 5 || tmpM == 7 || tmpM == 8 || tmpM == 10 || tmpM == 12) && tmpD > 31) { - return FALSE; + return false; } if ((tmpM == 4 || tmpM == 6 || tmpM == 9 || tmpM == 11) && tmpD > 30) { - return FALSE; + return false; } - FX_BOOL iLeapYear; + bool iLeapYear; if ((wYear % 4 == 0 && wYear % 100 != 0) || wYear % 400 == 0) { - iLeapYear = TRUE; + iLeapYear = true; } else { - iLeapYear = FALSE; + iLeapYear = false; } if ((iLeapYear && tmpM == 2 && tmpD > 29) || (!iLeapYear && tmpM == 2 && tmpD > 28)) { - return FALSE; + return false; } } } CFX_Unitime ut; ut.Set(year, month, day); datetime = datetime + ut; - return TRUE; + return true; } -FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, - CFX_Unitime& datetime, - IFX_Locale* pLocale) { +bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, + CFX_Unitime& datetime, + IFX_Locale* pLocale) { if (wsTime.GetLength() == 0) { - return FALSE; + return false; } uint8_t hour = 0; uint8_t minute = 0; @@ -3590,12 +3589,12 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, int len = wsTime.GetLength(); while (cc < len && cc < 2) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } hour = hour * 10 + str[cc++] - '0'; } if (cc < 2 || hour >= 24) { - return FALSE; + return false; } if (cc < len) { if (str[cc] == ':') { @@ -3604,12 +3603,12 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, cc_start = cc; while (cc < len && cc < cc_start + 2) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } minute = minute * 10 + str[cc++] - '0'; } if (cc == cc_start + 1 || minute >= 60) { - return FALSE; + return false; } if (cc < len) { if (str[cc] == ':') { @@ -3618,12 +3617,12 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, cc_start = cc; while (cc < len && cc < cc_start + 2) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } second = second * 10 + str[cc++] - '0'; } if (cc == cc_start + 1 || second >= 60) { - return FALSE; + return false; } if (cc < len) { if (str[cc] == '.') { @@ -3631,12 +3630,12 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, cc_start = cc; while (cc < len && cc < cc_start + 3) { if (!FXSYS_isDecimalDigit(str[cc])) { - return FALSE; + return false; } millisecond = millisecond * 10 + str[cc++] - '0'; } if (cc < cc_start + 3) - return FALSE; + return false; } if (cc < len) { FX_TIMEZONE tzDiff; @@ -3653,7 +3652,7 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, CFX_Unitime ut; ut.Set(0, 0, 0, hour, minute, second, millisecond); datetime = datetime + ut; - return TRUE; + return true; } static uint16_t FX_GetSolarMonthDays(uint16_t year, uint16_t month) { if (month % 2) { @@ -3698,11 +3697,11 @@ static uint16_t FX_GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) { } return week_index; } -static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern, - IFX_Locale* pLocale, - const CFX_Unitime& datetime, - CFX_WideString& wsResult) { - FX_BOOL bRet = TRUE; +static bool FX_DateFormat(const CFX_WideString& wsDatePattern, + IFX_Locale* pLocale, + const CFX_Unitime& datetime, + CFX_WideString& wsResult) { + bool bRet = true; int32_t year = datetime.GetYear(); uint8_t month = datetime.GetMonth(); uint8_t day = datetime.GetDay(); @@ -3762,11 +3761,11 @@ static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern, wsResult += wsMonth; } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) { CFX_WideString wsTemp; - pLocale->GetMonthName(month - 1, wsTemp, TRUE); + pLocale->GetMonthName(month - 1, wsTemp, true); wsResult += wsTemp; } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '4')) { CFX_WideString wsTemp; - pLocale->GetMonthName(month - 1, wsTemp, FALSE); + pLocale->GetMonthName(month - 1, wsTemp, false); wsResult += wsTemp; } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '1')) { uint16_t wWeekDay = FX_GetWeekDay(year, month, day); @@ -3776,13 +3775,13 @@ static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern, } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '3')) { uint16_t wWeekDay = FX_GetWeekDay(year, month, day); CFX_WideString wsTemp; - pLocale->GetDayName(wWeekDay, wsTemp, TRUE); + pLocale->GetDayName(wWeekDay, wsTemp, true); wsResult += wsTemp; } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '4')) { uint16_t wWeekDay = FX_GetWeekDay(year, month, day); if (pLocale) { CFX_WideString wsTemp; - pLocale->GetDayName(wWeekDay, wsTemp, FALSE); + pLocale->GetDayName(wWeekDay, wsTemp, false); wsResult += wsTemp; } } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) { @@ -3816,12 +3815,12 @@ static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern, } return bRet; } -static FX_BOOL FX_TimeFormat(const CFX_WideString& wsTimePattern, - IFX_Locale* pLocale, - const CFX_Unitime& datetime, - CFX_WideString& wsResult) { - FX_BOOL bGMT = FALSE; - FX_BOOL bRet = TRUE; +static bool FX_TimeFormat(const CFX_WideString& wsTimePattern, + IFX_Locale* pLocale, + const CFX_Unitime& datetime, + CFX_WideString& wsResult) { + bool bGMT = false; + bool bRet = true; uint8_t hour = datetime.GetHour(); uint8_t minute = datetime.GetMinute(); uint8_t second = datetime.GetSecond(); @@ -3830,10 +3829,10 @@ static FX_BOOL FX_TimeFormat(const CFX_WideString& wsTimePattern, const FX_WCHAR* strf = wsTimePattern.c_str(); int32_t lenf = wsTimePattern.GetLength(); uint16_t wHour = hour; - FX_BOOL bPM = FALSE; + bool bPM = false; if (wsTimePattern.Find('A') != -1) { if (wHour >= 12) { - bPM = TRUE; + bPM = true; } } CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols); @@ -3952,13 +3951,13 @@ static FX_BOOL FX_TimeFormat(const CFX_WideString& wsTimePattern, } return bRet; } -static FX_BOOL FX_FormatDateTime(const CFX_Unitime& dt, - const CFX_WideString& wsDatePattern, - const CFX_WideString& wsTimePattern, - FX_BOOL bDateFirst, - IFX_Locale* pLocale, - CFX_WideString& wsOutput) { - FX_BOOL bRet = TRUE; +static bool FX_FormatDateTime(const CFX_Unitime& dt, + const CFX_WideString& wsDatePattern, + const CFX_WideString& wsTimePattern, + bool bDateFirst, + IFX_Locale* pLocale, + CFX_WideString& wsOutput) { + bool bRet = true; CFX_WideString wsDateOut, wsTimeOut; if (!wsDatePattern.IsEmpty()) { bRet &= FX_DateFormat(wsDatePattern, pLocale, dt, wsDateOut); @@ -3969,18 +3968,18 @@ static FX_BOOL FX_FormatDateTime(const CFX_Unitime& dt, wsOutput = bDateFirst ? wsDateOut + wsTimeOut : wsTimeOut + wsDateOut; return bRet; } -FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsDatePattern, wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale || eCategory == FX_DATETIMETYPE_Unknown) { - return FALSE; + return false; } CFX_Unitime dt(0); int32_t iT = wsSrcDateTime.Find(L"T"); @@ -4000,19 +3999,19 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, eCategory != FX_DATETIMETYPE_TimeDate, pLocale, wsOutput); } -FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput, - FX_DATETIMETYPE eDateTimeType) { +bool CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput, + FX_DATETIMETYPE eDateTimeType) { if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsDatePattern, wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale) { - return FALSE; + return false; } if (eCategory == FX_DATETIMETYPE_Unknown) { if (eDateTimeType == FX_DATETIMETYPE_Time) { @@ -4022,18 +4021,18 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, eCategory = eDateTimeType; } if (eCategory == FX_DATETIMETYPE_Unknown) { - return FALSE; + return false; } CFX_Unitime dt(0); int32_t iT = wsSrcDateTime.Find(L"T"); if (iT < 0) { if (eCategory == FX_DATETIMETYPE_Date && FX_DateFromCanonical(wsSrcDateTime, dt)) { - return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale, + return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, true, pLocale, wsOutput); } else if (eCategory == FX_DATETIMETYPE_Time && FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), dt, pLocale)) { - return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale, + return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, true, pLocale, wsOutput); } } else { @@ -4041,7 +4040,7 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT + 1, wsSrcDateTime.GetLength() - iT - 1); if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty()) { - return FALSE; + return false; } if (FX_DateFromCanonical(wsSrcDate, dt) && FX_TimeFromCanonical(wsSrcTime, dt, pLocale)) { @@ -4050,29 +4049,29 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, wsOutput); } } - return FALSE; + return false; } -FX_BOOL CFX_FormatString::FormatDateTime(const CFX_Unitime& dt, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatDateTime(const CFX_Unitime& dt, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsDatePattern, wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern); if (!pLocale) { - return FALSE; + return false; } return FX_FormatDateTime(dt, wsPattern, wsTimePattern, eCategory != FX_DATETIMETYPE_TimeDate, pLocale, wsOutput); } -FX_BOOL CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat); @@ -4089,12 +4088,12 @@ FX_BOOL CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, continue; } } - return TRUE; + return true; } -FX_BOOL CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, - CFX_WideString& wsOutput) { +bool CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, + CFX_WideString& wsOutput) { if (wsPattern.IsEmpty()) { - return FALSE; + return false; } CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat); @@ -4111,7 +4110,7 @@ FX_BOOL CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, continue; } } - return TRUE; + return true; } IFX_Locale* CFX_FormatString::GetPatternLocale(const CFX_WideString& wsLocale) { return m_pLocaleMgr->GetLocaleByName(wsLocale); @@ -4328,21 +4327,21 @@ static inline void fxmath_decimal_helper_raw_div(uint64_t a[], c[i] = left[i]; } } -static inline FX_BOOL fxmath_decimal_helper_outofrange(uint64_t a[], - uint8_t al, - uint8_t goal) { +static inline bool fxmath_decimal_helper_outofrange(uint64_t a[], + uint8_t al, + uint8_t goal) { for (int i = goal; i < al; i++) { if (a[i]) { - return TRUE; + return true; } } - return FALSE; + return false; } static inline void fxmath_decimal_helper_shrinkintorange(uint64_t a[], uint8_t al, uint8_t goal, uint8_t& scale) { - FX_BOOL bRoundUp = FALSE; + bool bRoundUp = false; while (scale != 0 && (scale > FXMATH_DECIMAL_SCALELIMIT || fxmath_decimal_helper_outofrange(a, al, goal))) { bRoundUp = fxmath_decimal_helper_div10_any(a, al) >= 5; @@ -4384,7 +4383,7 @@ CFX_Decimal::CFX_Decimal(uint32_t val) { CFX_Decimal::CFX_Decimal(uint32_t lo, uint32_t mid, uint32_t hi, - FX_BOOL neg, + bool neg, uint8_t scale) { scale = (scale > FXMATH_DECIMAL_SCALELIMIT ? 0 : scale); m_uLo = lo; @@ -4431,8 +4430,8 @@ CFX_Decimal::CFX_Decimal(FX_FLOAT val, uint8_t scale) { CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) { const FX_WCHAR* str = strObj.c_str(); const FX_WCHAR* strBound = str + strObj.GetLength(); - FX_BOOL pointmet = 0; - FX_BOOL negmet = 0; + bool pointmet = 0; + bool negmet = 0; uint8_t scale = 0; m_uHi = m_uMid = m_uLo = 0; while (str != strBound && *str == ' ') { @@ -4498,7 +4497,7 @@ CFX_Decimal::operator double() const { double base = ((double)m_uHi) * pow * pow + ((double)m_uMid) * pow + ((double)m_uLo); int8_t scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags); - FX_BOOL bNeg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags); + bool bNeg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags); return (bNeg ? -1 : 1) * base * ::pow(10.0, -scale); } void CFX_Decimal::SetScale(uint8_t newscale) { @@ -4549,9 +4548,9 @@ void CFX_Decimal::SetNegate() { m_uFlags ^= FXMATH_DECIMAL_NEGMASK; } } -void CFX_Decimal::FloorOrCeil(FX_BOOL bFloor) { +void CFX_Decimal::FloorOrCeil(bool bFloor) { uint64_t nums[3] = {m_uLo, m_uMid, m_uHi}; - FX_BOOL bDataLoss = FALSE; + bool bDataLoss = false; for (int i = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags); i > 0; i--) { bDataLoss = fxmath_decimal_helper_div10_any(nums, 3) || bDataLoss; } @@ -4566,10 +4565,10 @@ void CFX_Decimal::FloorOrCeil(FX_BOOL bFloor) { FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero(), 0); } void CFX_Decimal::SetFloor() { - FloorOrCeil(TRUE); + FloorOrCeil(true); } void CFX_Decimal::SetCeiling() { - FloorOrCeil(FALSE); + FloorOrCeil(false); } void CFX_Decimal::SetTruncate() { FloorOrCeil(!FXMATH_DECIMAL_FLAGS2NEG(m_uFlags)); @@ -4609,7 +4608,7 @@ int8_t CFX_Decimal::Compare(const CFX_Decimal& val) const { return (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) ? -retVal : retVal); } CFX_Decimal CFX_Decimal::AddOrMinus(const CFX_Decimal& val, - FX_BOOL isAdding) const { + bool isAdding) const { CFX_Decimal lhs = *this, rhs = val; if (FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) != FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags)) { @@ -4665,8 +4664,8 @@ CFX_Decimal CFX_Decimal::Multiply(const CFX_Decimal& val) const { b[3] = {val.m_uLo, val.m_uMid, val.m_uHi}; uint64_t c[6]; fxmath_decimal_helper_raw_mul(a, 3, b, 3, c, 6); - FX_BOOL neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^ - FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags); + bool neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^ + FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags); uint8_t scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) + FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags); fxmath_decimal_helper_shrinkintorange(c, 6, 3, scale); @@ -4677,8 +4676,8 @@ CFX_Decimal CFX_Decimal::Divide(const CFX_Decimal& val) const { if (!val.IsNotZero()) { return CFX_Decimal(); } - FX_BOOL neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^ - FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags); + bool neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^ + FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags); uint64_t a[7] = {m_uLo, m_uMid, m_uHi}, b[3] = {val.m_uLo, val.m_uMid, val.m_uHi}, c[7] = {0}; uint8_t scale = 0; @@ -4715,7 +4714,7 @@ CFX_Decimal CFX_Decimal::Modulus(const CFX_Decimal& val) const { if (!rhs_abs.IsNotZero()) { return *this; } - while (TRUE) { + while (true) { CFX_Decimal lhs_abs = lhs; lhs_abs.SetAbs(); if (lhs_abs < rhs_abs) { @@ -4746,10 +4745,10 @@ bool CFX_Decimal::operator>(const CFX_Decimal& val) const { return Compare(val) > 0; } CFX_Decimal CFX_Decimal::operator+(const CFX_Decimal& val) const { - return AddOrMinus(val, TRUE); + return AddOrMinus(val, true); } CFX_Decimal CFX_Decimal::operator-(const CFX_Decimal& val) const { - return AddOrMinus(val, FALSE); + return AddOrMinus(val, false); } CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { return Multiply(val); diff --git a/xfa/fgas/localization/fgas_locale.h b/xfa/fgas/localization/fgas_locale.h index 5b4c7f8147..f9b84c5487 100644 --- a/xfa/fgas/localization/fgas_locale.h +++ b/xfa/fgas/localization/fgas_locale.h @@ -62,15 +62,14 @@ class IFX_Locale { virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const = 0; virtual void GetMonthName(int32_t nMonth, CFX_WideString& wsMonthName, - FX_BOOL bAbbr = TRUE) const = 0; + bool bAbbr = true) const = 0; virtual void GetDayName(int32_t nWeek, CFX_WideString& wsDayName, - FX_BOOL bAbbr = TRUE) const = 0; + bool bAbbr = true) const = 0; virtual void GetMeridiemName(CFX_WideString& wsMeridiemName, - FX_BOOL bAM = TRUE) const = 0; + bool bAM = true) const = 0; virtual void GetTimeZone(FX_TIMEZONE& tz) const = 0; - virtual void GetEraName(CFX_WideString& wsEraName, - FX_BOOL bAD = TRUE) const = 0; + virtual void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const = 0; virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, CFX_WideString& wsPattern) const = 0; virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, @@ -91,11 +90,10 @@ class IFX_LocaleMgr { virtual std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid) = 0; }; -FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, - CFX_Unitime& datetime); -FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, - CFX_Unitime& datetime, - IFX_Locale* pLocale); +bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime); +bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, + CFX_Unitime& datetime, + IFX_Locale* pLocale); class CFX_Decimal { public: CFX_Decimal(); @@ -128,16 +126,12 @@ class CFX_Decimal { void SetTruncate(); protected: - CFX_Decimal(uint32_t hi, - uint32_t mid, - uint32_t lo, - FX_BOOL neg, - uint8_t scale); - inline FX_BOOL IsNotZero() const { return m_uHi || m_uMid || m_uLo; } + CFX_Decimal(uint32_t hi, uint32_t mid, uint32_t lo, bool neg, uint8_t scale); + inline bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; } inline int8_t Compare(const CFX_Decimal& val) const; inline void Swap(CFX_Decimal& val); - inline void FloorOrCeil(FX_BOOL bFloor); - CFX_Decimal AddOrMinus(const CFX_Decimal& val, FX_BOOL isAdding) const; + inline void FloorOrCeil(bool bFloor); + CFX_Decimal AddOrMinus(const CFX_Decimal& val, bool isAdding) const; CFX_Decimal Multiply(const CFX_Decimal& val) const; CFX_Decimal Divide(const CFX_Decimal& val) const; CFX_Decimal Modulus(const CFX_Decimal& val) const; diff --git a/xfa/fgas/localization/fgas_localeimp.h b/xfa/fgas/localization/fgas_localeimp.h index 969fe6b625..66f1767c5c 100644 --- a/xfa/fgas/localization/fgas_localeimp.h +++ b/xfa/fgas/localization/fgas_localeimp.h @@ -13,7 +13,7 @@ class CFX_LCNumeric; class CFX_FormatString { public: - CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, FX_BOOL bUseLCID); + CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, bool bUseLCID); void Release() { delete this; } @@ -22,44 +22,44 @@ class CFX_FormatString { FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern); uint16_t GetLCID(const CFX_WideString& wsPattern); CFX_WideString GetLocaleName(const CFX_WideString& wsPattern); - FX_BOOL ParseText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString& wsValue); - FX_BOOL ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - FX_FLOAT& fValue); - FX_BOOL ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsValue); - FX_BOOL ParseDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, - FX_DATETIMETYPE eDateTimeType, - CFX_Unitime& dtValue); - FX_BOOL ParseZero(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern); - FX_BOOL ParseNull(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern); - FX_BOOL FormatText(const CFX_WideString& wsSrcText, + bool ParseText(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern, + CFX_WideString& wsValue); + bool ParseNum(const CFX_WideString& wsSrcNum, + const CFX_WideString& wsPattern, + FX_FLOAT& fValue); + bool ParseNum(const CFX_WideString& wsSrcNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsValue); + bool ParseDateTime(const CFX_WideString& wsSrcDateTime, const CFX_WideString& wsPattern, - CFX_WideString& wsOutput); - FX_BOOL FormatNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput); - FX_BOOL FormatNum(FX_FLOAT fNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput); - FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput); - FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput, - FX_DATETIMETYPE eDateTimeType); - FX_BOOL FormatDateTime(const CFX_Unitime& dt, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput); - FX_BOOL FormatZero(const CFX_WideString& wsPattern, CFX_WideString& wsOutput); - FX_BOOL FormatNull(const CFX_WideString& wsPattern, CFX_WideString& wsOutput); + FX_DATETIMETYPE eDateTimeType, + CFX_Unitime& dtValue); + bool ParseZero(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern); + bool ParseNull(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern); + bool FormatText(const CFX_WideString& wsSrcText, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput); + bool FormatNum(const CFX_WideString& wsSrcNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput); + bool FormatNum(FX_FLOAT fNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput); + bool FormatDateTime(const CFX_WideString& wsSrcDateTime, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput); + bool FormatDateTime(const CFX_WideString& wsSrcDateTime, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput, + FX_DATETIMETYPE eDateTimeType); + bool FormatDateTime(const CFX_Unitime& dt, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput); + bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString& wsOutput); + bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString& wsOutput); protected: ~CFX_FormatString(); @@ -71,12 +71,12 @@ class CFX_FormatString { int32_t& iDotIndex, uint32_t& dwStyle, CFX_WideString& wsPurgePattern); - FX_BOOL FormatStrNum(const CFX_WideStringC& wsInputNum, + bool FormatStrNum(const CFX_WideStringC& wsInputNum, + const CFX_WideString& wsPattern, + CFX_WideString& wsOutput); + bool FormatLCNumeric(CFX_LCNumeric& lcNum, const CFX_WideString& wsPattern, CFX_WideString& wsOutput); - FX_BOOL FormatLCNumeric(CFX_LCNumeric& lcNum, - const CFX_WideString& wsPattern, - CFX_WideString& wsOutput); FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern, IFX_Locale*& pLocale, CFX_WideString& wsDatePattern, @@ -84,7 +84,7 @@ class CFX_FormatString { IFX_Locale* GetPatternLocale(const CFX_WideString& wsLocale); IFX_LocaleMgr* m_pLocaleMgr; - FX_BOOL m_bUseLCID; + bool m_bUseLCID; }; #endif // XFA_FGAS_LOCALIZATION_FGAS_LOCALEIMP_H_ |