From f39074c0ae47a84c496782f8b75bcce1e1cfdf59 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 26 Oct 2016 15:33:58 -0700 Subject: Fix some FX_BOOL / int noise in fxcrt. Review-Url: https://codereview.chromium.org/2450183003 --- xfa/fgas/crt/fgas_stream.cpp | 17 +++++++++-------- xfa/fgas/crt/fgas_stream.h | 8 +++----- xfa/fxfa/app/xfa_ffapp.cpp | 8 +++----- xfa/fxfa/xfa_ffapp.h | 2 +- 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'xfa') diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index f0a2a88100..6da4e9ed8c 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -291,16 +291,16 @@ class CFX_TextStream : public IFX_Stream { class CFGAS_FileRead : public IFX_SeekableReadStream { public: - CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream); + CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream); ~CFGAS_FileRead() override; // IFX_SeekableReadStream void Release() override; FX_FILESIZE GetSize() override; - FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; + bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; protected: - FX_BOOL m_bReleaseStream; + bool m_bReleaseStream; IFX_Stream* m_pStream; }; @@ -1469,12 +1469,14 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess, } return pShared; } + IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream, - FX_BOOL bReleaseStream) { + bool bReleaseStream) { ASSERT(pBaseStream); return new CFGAS_FileRead(pBaseStream, bReleaseStream); } -CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream) + +CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream) : m_bReleaseStream(bReleaseStream), m_pStream(pStream) { ASSERT(m_pStream); } @@ -1486,9 +1488,8 @@ CFGAS_FileRead::~CFGAS_FileRead() { FX_FILESIZE CFGAS_FileRead::GetSize() { return (FX_FILESIZE)m_pStream->GetLength(); } -FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) { + +bool CFGAS_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset); int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size); return iLen == (int32_t)size; diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h index c61688d7a7..34d684f9ca 100644 --- a/xfa/fgas/crt/fgas_stream.h +++ b/xfa/fgas/crt/fgas_stream.h @@ -10,11 +10,6 @@ #include "core/fxcrt/fx_stream.h" #include "core/fxcrt/fx_system.h" -class IFX_Stream; - -IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream, - FX_BOOL bReleaseStream); - enum FX_STREAMACCESS { FX_STREAMACCESS_Binary = 0x00, FX_STREAMACCESS_Text = 0x01, @@ -68,4 +63,7 @@ class IFX_Stream { virtual uint16_t SetCodePage(uint16_t wCodePage) = 0; }; +IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream, + bool bReleaseStream); + #endif // XFA_FGAS_CRT_FGAS_STREAM_H_ diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index d60d48fa75..06cad02253 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -37,9 +37,7 @@ FX_FILESIZE CXFA_FileRead::GetSize() { return dwSize; } -FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) { +bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { int32_t iCount = m_Data.GetSize(); int32_t index = 0; while (index < iCount) { @@ -58,13 +56,13 @@ FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, FXSYS_memcpy(buffer, acc.GetData() + offset, dwRead); size -= dwRead; if (size == 0) { - return TRUE; + return true; } buffer = (uint8_t*)buffer + dwRead; offset = 0; index++; } - return FALSE; + return false; } void CXFA_FileRead::Release() { diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h index 5e8289538b..543d78c2ee 100644 --- a/xfa/fxfa/xfa_ffapp.h +++ b/xfa/fxfa/xfa_ffapp.h @@ -31,7 +31,7 @@ class CXFA_FileRead : public IFX_SeekableReadStream { // IFX_SeekableReadStream FX_FILESIZE GetSize() override; - FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; + bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; void Release() override; protected: -- cgit v1.2.3