summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/extension.h33
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp2
-rw-r--r--core/fxcrt/fx_extension.cpp76
-rw-r--r--core/fxcrt/fx_stream.h44
-rw-r--r--core/fxcrt/fx_xml_parser.cpp179
-rw-r--r--core/fxcrt/fxcrt_posix.cpp38
-rw-r--r--core/fxcrt/fxcrt_posix.h10
-rw-r--r--core/fxcrt/fxcrt_stream.cpp6
-rw-r--r--core/fxcrt/fxcrt_windows.cpp101
-rw-r--r--core/fxcrt/fxcrt_windows.h8
-rw-r--r--core/fxcrt/xml_int.h24
11 files changed, 274 insertions, 247 deletions
diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h
index 45f6d4f2f0..5b1801bb1b 100644
--- a/core/fxcrt/extension.h
+++ b/core/fxcrt/extension.h
@@ -18,8 +18,8 @@ class IFXCRT_FileAccess {
static IFXCRT_FileAccess* Create();
virtual ~IFXCRT_FileAccess() {}
- virtual FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0;
- virtual FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0;
+ virtual bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0;
+ virtual bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0;
virtual void Close() = 0;
virtual FX_FILESIZE GetSize() const = 0;
virtual FX_FILESIZE GetPosition() const = 0;
@@ -30,8 +30,8 @@ class IFXCRT_FileAccess {
virtual size_t WritePos(const void* pBuffer,
size_t szBuffer,
FX_FILESIZE pos) = 0;
- virtual FX_BOOL Flush() = 0;
- virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
+ virtual bool Flush() = 0;
+ virtual bool Truncate(FX_FILESIZE szFile) = 0;
};
#ifdef PDF_ENABLE_XFA
@@ -63,14 +63,12 @@ class CFX_CRTFileStream final : public IFX_SeekableStream {
IFX_SeekableStream* Retain() override;
void Release() override;
FX_FILESIZE GetSize() override;
- FX_BOOL IsEOF() override;
+ bool IsEOF() override;
FX_FILESIZE GetPosition() override;
- FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
+ bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
size_t ReadBlock(void* buffer, size_t size) override;
- FX_BOOL WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) override;
- FX_BOOL Flush() override;
+ bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override;
+ bool Flush() override;
protected:
std::unique_ptr<IFXCRT_FileAccess> m_pFile;
@@ -80,6 +78,7 @@ class CFX_CRTFileStream final : public IFX_SeekableStream {
#define FX_MEMSTREAM_BlockSize (64 * 1024)
#define FX_MEMSTREAM_Consecutive 0x01
#define FX_MEMSTREAM_TakeOver 0x02
+
class CFX_MemoryStream final : public IFX_MemoryStream {
public:
explicit CFX_MemoryStream(FX_BOOL bConsecutive);
@@ -90,20 +89,18 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
IFX_SeekableStream* Retain() override;
void Release() override;
FX_FILESIZE GetSize() override;
- FX_BOOL IsEOF() override;
+ bool IsEOF() override;
FX_FILESIZE GetPosition() override;
- FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
+ bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
size_t ReadBlock(void* buffer, size_t size) override;
- FX_BOOL WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) override;
- FX_BOOL Flush() override;
- FX_BOOL IsConsecutive() const override;
+ bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override;
+ bool Flush() override;
+ bool IsConsecutive() const override;
void EstimateSize(size_t nInitSize, size_t nGrowSize) override;
uint8_t* GetBuffer() const override;
void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
- FX_BOOL bTakeOver = FALSE) override;
+ bool bTakeOver = FALSE) override;
void DetachBuffer() override;
protected:
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index e954224d8a..8466e88c56 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -244,7 +244,7 @@ bool CFX_FileBufferArchive::Flush() {
return false;
if (!m_pBuffer || !nRemaining)
return true;
- return m_pFile->WriteBlock(m_pBuffer.get(), nRemaining) > 0;
+ return m_pFile->WriteBlock(m_pBuffer.get(), nRemaining);
}
int32_t CFX_FileBufferArchive::AppendBlock(const void* pBuf, size_t size) {
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 5ac22bd44e..186d98b858 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -4,9 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fxcrt/extension.h"
+
#include <utility>
-#include "core/fxcrt/extension.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_ext.h"
@@ -102,7 +103,7 @@ FX_FILESIZE CFX_MemoryStream::GetSize() {
return (FX_FILESIZE)m_nCurSize;
}
-FX_BOOL CFX_MemoryStream::IsEOF() {
+bool CFX_MemoryStream::IsEOF() {
return m_nCurPos >= (size_t)GetSize();
}
@@ -110,24 +111,23 @@ FX_FILESIZE CFX_MemoryStream::GetPosition() {
return (FX_FILESIZE)m_nCurPos;
}
-FX_BOOL CFX_MemoryStream::ReadBlock(void* buffer,
- FX_FILESIZE offset,
- size_t size) {
- if (!buffer || !size) {
- return FALSE;
- }
+bool CFX_MemoryStream::ReadBlock(void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
+ if (!buffer || !size)
+ return false;
FX_SAFE_SIZE_T newPos = size;
newPos += offset;
if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 ||
newPos.ValueOrDie() > m_nCurSize) {
- return FALSE;
+ return false;
}
m_nCurPos = newPos.ValueOrDie();
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
FXSYS_memcpy(buffer, m_Blocks[0] + (size_t)offset, size);
- return TRUE;
+ return true;
}
size_t nStartBlock = (size_t)offset / m_nGrowSize;
offset -= (FX_FILESIZE)(nStartBlock * m_nGrowSize);
@@ -142,7 +142,7 @@ FX_BOOL CFX_MemoryStream::ReadBlock(void* buffer,
nStartBlock++;
offset = 0;
}
- return TRUE;
+ return true;
}
size_t CFX_MemoryStream::ReadBlock(void* buffer, size_t size) {
@@ -156,17 +156,17 @@ size_t CFX_MemoryStream::ReadBlock(void* buffer, size_t size) {
return nRead;
}
-FX_BOOL CFX_MemoryStream::WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) {
- if (!buffer || !size) {
- return FALSE;
- }
+bool CFX_MemoryStream::WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
+ if (!buffer || !size)
+ return false;
+
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
FX_SAFE_SIZE_T newPos = size;
newPos += offset;
if (!newPos.IsValid())
- return FALSE;
+ return false;
m_nCurPos = newPos.ValueOrDie();
if (m_nCurPos > m_nTotalSize) {
@@ -179,14 +179,14 @@ FX_BOOL CFX_MemoryStream::WriteBlock(const void* buffer,
}
if (!m_Blocks[0]) {
m_Blocks.RemoveAll();
- return FALSE;
+ return false;
}
}
FXSYS_memcpy(m_Blocks[0] + (size_t)offset, buffer, size);
if (m_nCurSize < m_nCurPos) {
m_nCurSize = m_nCurPos;
}
- return TRUE;
+ return true;
}
FX_SAFE_SIZE_T newPos = size;
@@ -215,11 +215,11 @@ FX_BOOL CFX_MemoryStream::WriteBlock(const void* buffer,
return TRUE;
}
-FX_BOOL CFX_MemoryStream::Flush() {
- return TRUE;
+bool CFX_MemoryStream::Flush() {
+ return true;
}
-FX_BOOL CFX_MemoryStream::IsConsecutive() const {
+bool CFX_MemoryStream::IsConsecutive() const {
return !!(m_dwFlags & FX_MEMSTREAM_Consecutive);
}
@@ -242,10 +242,10 @@ uint8_t* CFX_MemoryStream::GetBuffer() const {
void CFX_MemoryStream::AttachBuffer(uint8_t* pBuffer,
size_t nSize,
- FX_BOOL bTakeOver) {
- if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) {
+ bool bTakeOver) {
+ if (!(m_dwFlags & FX_MEMSTREAM_Consecutive))
return;
- }
+
m_Blocks.RemoveAll();
m_Blocks.Add(pBuffer);
m_nTotalSize = m_nCurSize = nSize;
@@ -297,7 +297,7 @@ FX_FILESIZE CFX_CRTFileStream::GetSize() {
return m_pFile->GetSize();
}
-FX_BOOL CFX_CRTFileStream::IsEOF() {
+bool CFX_CRTFileStream::IsEOF() {
return GetPosition() >= GetSize();
}
@@ -305,23 +305,23 @@ FX_FILESIZE CFX_CRTFileStream::GetPosition() {
return m_pFile->GetPosition();
}
-FX_BOOL CFX_CRTFileStream::ReadBlock(void* buffer,
- FX_FILESIZE offset,
- size_t size) {
- return (FX_BOOL)m_pFile->ReadPos(buffer, size, offset);
+bool CFX_CRTFileStream::ReadBlock(void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
+ return m_pFile->ReadPos(buffer, size, offset) > 0;
}
size_t CFX_CRTFileStream::ReadBlock(void* buffer, size_t size) {
return m_pFile->Read(buffer, size);
}
-FX_BOOL CFX_CRTFileStream::WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) {
- return (FX_BOOL)m_pFile->WritePos(buffer, size, offset);
+bool CFX_CRTFileStream::WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) {
+ return !!m_pFile->WritePos(buffer, size, offset);
}
-FX_BOOL CFX_CRTFileStream::Flush() {
+bool CFX_CRTFileStream::Flush() {
return m_pFile->Flush();
}
@@ -359,10 +359,10 @@ IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename) {
}
IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
size_t dwSize,
- FX_BOOL bTakeOver) {
+ bool bTakeOver) {
return new CFX_MemoryStream(pBuffer, dwSize, bTakeOver);
}
-IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive) {
+IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive) {
return new CFX_MemoryStream(bConsecutive);
}
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index 2509ec2cd7..8b1d91f4bc 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -59,7 +59,7 @@ class IFX_WriteStream {
public:
virtual ~IFX_WriteStream() {}
virtual void Release() = 0;
- virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
+ virtual bool WriteBlock(const void* pData, size_t size) = 0;
};
class IFX_ReadStream {
@@ -67,7 +67,7 @@ class IFX_ReadStream {
virtual ~IFX_ReadStream() {}
virtual void Release() = 0;
- virtual FX_BOOL IsEOF() = 0;
+ virtual bool IsEOF() = 0;
virtual FX_FILESIZE GetPosition() = 0;
virtual size_t ReadBlock(void* buffer, size_t size) = 0;
};
@@ -75,23 +75,23 @@ class IFX_ReadStream {
class IFX_SeekableWriteStream : public IFX_WriteStream {
public:
// IFX_WriteStream:
- FX_BOOL WriteBlock(const void* pData, size_t size) override;
+ bool WriteBlock(const void* pData, size_t size) override;
virtual FX_FILESIZE GetSize() = 0;
- virtual FX_BOOL Flush() = 0;
- virtual FX_BOOL WriteBlock(const void* pData,
- FX_FILESIZE offset,
- size_t size) = 0;
+ virtual bool Flush() = 0;
+ virtual bool WriteBlock(const void* pData,
+ FX_FILESIZE offset,
+ size_t size) = 0;
};
class IFX_SeekableReadStream : public IFX_ReadStream {
public:
// IFX_ReadStream:
void Release() override = 0;
- FX_BOOL IsEOF() override;
+ bool IsEOF() override;
FX_FILESIZE GetPosition() override;
size_t ReadBlock(void* buffer, size_t size) override;
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
+ virtual bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
virtual FX_FILESIZE GetSize() = 0;
};
@@ -105,18 +105,18 @@ class IFX_SeekableStream : public IFX_SeekableReadStream,
// IFX_SeekableReadStream:
void Release() override = 0;
- FX_BOOL IsEOF() override = 0;
+ bool IsEOF() override = 0;
FX_FILESIZE GetPosition() override = 0;
size_t ReadBlock(void* buffer, size_t size) override = 0;
- FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0;
+ bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0;
FX_FILESIZE GetSize() override = 0;
// IFX_SeekableWriteStream:
- FX_BOOL WriteBlock(const void* buffer,
- FX_FILESIZE offset,
- size_t size) override = 0;
- FX_BOOL WriteBlock(const void* buffer, size_t size) override;
- FX_BOOL Flush() override = 0;
+ bool WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size) override = 0;
+ bool WriteBlock(const void* buffer, size_t size) override;
+ bool Flush() override = 0;
};
IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename,
@@ -138,29 +138,29 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
class IFX_MemoryStream : public IFX_SeekableStream {
public:
- virtual FX_BOOL IsConsecutive() const = 0;
+ virtual bool IsConsecutive() const = 0;
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
virtual uint8_t* GetBuffer() const = 0;
virtual void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
- FX_BOOL bTakeOver = FALSE) = 0;
+ bool bTakeOver = FALSE) = 0;
virtual void DetachBuffer() = 0;
};
IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
size_t nSize,
- FX_BOOL bTakeOver = FALSE);
-IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE);
+ bool bTakeOver = FALSE);
+IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = FALSE);
class IFX_BufferRead : public IFX_ReadStream {
public:
// IFX_ReadStream:
void Release() override = 0;
- FX_BOOL IsEOF() override = 0;
+ bool IsEOF() override = 0;
FX_FILESIZE GetPosition() override = 0;
size_t ReadBlock(void* buffer, size_t size) override = 0;
- virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
+ virtual bool ReadNextBlock(bool bRestart = FALSE) = 0;
virtual const uint8_t* GetBlockBuffer() = 0;
virtual size_t GetBlockSize() = 0;
virtual FX_FILESIZE GetBlockOffset() = 0;
diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp
index e6c3543378..f6b81dad93 100644
--- a/core/fxcrt/fx_xml_parser.cpp
+++ b/core/fxcrt/fx_xml_parser.cpp
@@ -13,6 +13,62 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+namespace {
+
+#define FXCRTM_XML_CHARTYPE_Normal 0x00
+#define FXCRTM_XML_CHARTYPE_SpaceChar 0x01
+#define FXCRTM_XML_CHARTYPE_Letter 0x02
+#define FXCRTM_XML_CHARTYPE_Digital 0x04
+#define FXCRTM_XML_CHARTYPE_NameIntro 0x08
+#define FXCRTM_XML_CHARTYPE_NameChar 0x10
+#define FXCRTM_XML_CHARTYPE_HexDigital 0x20
+#define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40
+#define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60
+#define FXCRTM_XML_CHARTYPE_HexChar 0x60
+
+const uint8_t g_FXCRT_XML_ByteTypes[256] = {
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x18,
+ 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x01, 0x01,
+};
+
+bool g_FXCRT_XML_IsWhiteSpace(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar);
+}
+
+bool g_FXCRT_XML_IsDigital(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital);
+}
+
+bool g_FXCRT_XML_IsNameIntro(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro);
+}
+
+bool g_FXCRT_XML_IsNameChar(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar);
+}
+
+} // namespace
+
CXML_DataBufAcc::CXML_DataBufAcc(const uint8_t* pBuffer, size_t size)
: m_pBuffer(pBuffer), m_dwSize(size), m_dwCurPos(0) {}
@@ -22,7 +78,7 @@ void CXML_DataBufAcc::Release() {
delete this;
}
-FX_BOOL CXML_DataBufAcc::IsEOF() {
+bool CXML_DataBufAcc::IsEOF() {
return m_dwCurPos >= m_dwSize;
}
@@ -34,15 +90,15 @@ size_t CXML_DataBufAcc::ReadBlock(void* buffer, size_t size) {
return 0;
}
-FX_BOOL CXML_DataBufAcc::ReadNextBlock(FX_BOOL bRestart) {
- if (bRestart) {
+bool CXML_DataBufAcc::ReadNextBlock(bool bRestart) {
+ if (bRestart)
m_dwCurPos = 0;
- }
+
if (m_dwCurPos < m_dwSize) {
m_dwCurPos = m_dwSize;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
const uint8_t* CXML_DataBufAcc::GetBlockBuffer() {
@@ -70,7 +126,7 @@ void CXML_DataStmAcc::Release() {
delete this;
}
-FX_BOOL CXML_DataStmAcc::IsEOF() {
+bool CXML_DataStmAcc::IsEOF() {
return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize();
}
@@ -82,21 +138,21 @@ size_t CXML_DataStmAcc::ReadBlock(void* buffer, size_t size) {
return 0;
}
-FX_BOOL CXML_DataStmAcc::ReadNextBlock(FX_BOOL bRestart) {
- if (bRestart) {
+bool CXML_DataStmAcc::ReadNextBlock(bool bRestart) {
+ if (bRestart)
m_nStart = 0;
- }
+
FX_FILESIZE nLength = m_pFileRead->GetSize();
m_nStart += (FX_FILESIZE)m_dwSize;
- if (m_nStart >= nLength) {
- return FALSE;
- }
+ if (m_nStart >= nLength)
+ return false;
+
static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024;
m_dwSize = static_cast<size_t>(
std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart));
- if (!m_pBuffer) {
+ if (!m_pBuffer)
m_pBuffer = FX_Alloc(uint8_t, m_dwSize);
- }
+
return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize);
}
@@ -128,94 +184,45 @@ CXML_Parser::~CXML_Parser() {
}
}
-FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) {
+bool CXML_Parser::Init(uint8_t* pBuffer, size_t size) {
m_pDataAcc = new CXML_DataBufAcc(pBuffer, size);
- return Init(TRUE);
+ return Init(true);
}
-FX_BOOL CXML_Parser::Init(IFX_SeekableReadStream* pFileRead) {
+
+bool CXML_Parser::Init(IFX_SeekableReadStream* pFileRead) {
m_pDataAcc = new CXML_DataStmAcc(pFileRead);
- return Init(TRUE);
+ return Init(true);
}
-FX_BOOL CXML_Parser::Init(IFX_BufferRead* pBuffer) {
- if (!pBuffer) {
- return FALSE;
- }
+
+bool CXML_Parser::Init(IFX_BufferRead* pBuffer) {
+ if (!pBuffer)
+ return false;
+
m_pDataAcc = pBuffer;
- return Init(FALSE);
+ return Init(false);
}
-FX_BOOL CXML_Parser::Init(FX_BOOL bOwndedStream) {
+
+bool CXML_Parser::Init(bool bOwndedStream) {
m_bOwnedStream = bOwndedStream;
m_nOffset = 0;
return ReadNextBlock();
}
-FX_BOOL CXML_Parser::ReadNextBlock() {
- if (!m_pDataAcc->ReadNextBlock()) {
- return FALSE;
- }
+
+bool CXML_Parser::ReadNextBlock() {
+ if (!m_pDataAcc->ReadNextBlock())
+ return false;
+
m_pBuffer = m_pDataAcc->GetBlockBuffer();
m_dwBufferSize = m_pDataAcc->GetBlockSize();
m_nBufferOffset = m_pDataAcc->GetBlockOffset();
m_dwIndex = 0;
return m_dwBufferSize > 0;
}
-FX_BOOL CXML_Parser::IsEOF() {
- if (!m_pDataAcc->IsEOF()) {
- return FALSE;
- }
- return m_dwIndex >= m_dwBufferSize;
-}
-#define FXCRTM_XML_CHARTYPE_Normal 0x00
-#define FXCRTM_XML_CHARTYPE_SpaceChar 0x01
-#define FXCRTM_XML_CHARTYPE_Letter 0x02
-#define FXCRTM_XML_CHARTYPE_Digital 0x04
-#define FXCRTM_XML_CHARTYPE_NameIntro 0x08
-#define FXCRTM_XML_CHARTYPE_NameChar 0x10
-#define FXCRTM_XML_CHARTYPE_HexDigital 0x20
-#define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40
-#define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60
-#define FXCRTM_XML_CHARTYPE_HexChar 0x60
-uint8_t g_FXCRT_XML_ByteTypes[256] = {
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
- 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x18,
- 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x01, 0x01,
-};
-FX_BOOL g_FXCRT_XML_IsWhiteSpace(uint8_t ch) {
- return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar) != 0;
-}
-FX_BOOL g_FXCRT_XML_IsLetter(uint8_t ch) {
- return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Letter) != 0;
-}
-FX_BOOL g_FXCRT_XML_IsDigital(uint8_t ch) {
- return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital) != 0;
-}
-FX_BOOL g_FXCRT_XML_IsNameIntro(uint8_t ch) {
- return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro) != 0;
-}
-FX_BOOL g_FXCRT_XML_IsNameChar(uint8_t ch) {
- return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar) != 0;
-}
-FX_BOOL g_FXCRT_XML_IsHexChar(uint8_t ch) {
- return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar) != 0;
+
+bool CXML_Parser::IsEOF() {
+ return m_pDataAcc->IsEOF() && m_dwIndex >= m_dwBufferSize;
}
+
void CXML_Parser::SkipWhiteSpaces() {
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (IsEOF()) {
diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp
index b5efdc28f4..a96f164c7f 100644
--- a/core/fxcrt/fxcrt_posix.cpp
+++ b/core/fxcrt/fxcrt_posix.cpp
@@ -36,20 +36,24 @@ CFXCRT_FileAccess_Posix::CFXCRT_FileAccess_Posix() : m_nFD(-1) {}
CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix() {
Close();
}
-FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
- uint32_t dwMode) {
- if (m_nFD > -1) {
- return FALSE;
- }
- int32_t nFlags, nMasks;
+
+bool CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
+ uint32_t dwMode) {
+ if (m_nFD > -1)
+ return false;
+
+ int32_t nFlags;
+ int32_t nMasks;
FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks);
m_nFD = open(fileName.c_str(), nFlags, nMasks);
return m_nFD > -1;
}
-FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
- uint32_t dwMode) {
+
+bool CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
+ uint32_t dwMode) {
return Open(FX_UTF8Encode(fileName).AsStringC(), dwMode);
}
+
void CFXCRT_FileAccess_Posix::Close() {
if (m_nFD < 0) {
return;
@@ -115,16 +119,18 @@ size_t CFXCRT_FileAccess_Posix::WritePos(const void* pBuffer,
}
return Write(pBuffer, szBuffer);
}
-FX_BOOL CFXCRT_FileAccess_Posix::Flush() {
- if (m_nFD < 0) {
- return FALSE;
- }
+
+bool CFXCRT_FileAccess_Posix::Flush() {
+ if (m_nFD < 0)
+ return false;
+
return fsync(m_nFD) > -1;
}
-FX_BOOL CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) {
- if (m_nFD < 0) {
- return FALSE;
- }
+
+bool CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) {
+ if (m_nFD < 0)
+ return false;
+
return !ftruncate(m_nFD, szFile);
}
diff --git a/core/fxcrt/fxcrt_posix.h b/core/fxcrt/fxcrt_posix.h
index 37f6548d40..20faa5c02f 100644
--- a/core/fxcrt/fxcrt_posix.h
+++ b/core/fxcrt/fxcrt_posix.h
@@ -17,9 +17,9 @@ class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess {
CFXCRT_FileAccess_Posix();
~CFXCRT_FileAccess_Posix() override;
- // IFXCRT_FileAccess
- FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
- FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
+ // IFXCRT_FileAccess:
+ bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
+ bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
void Close() override;
FX_FILESIZE GetSize() const override;
FX_FILESIZE GetPosition() const override;
@@ -30,8 +30,8 @@ class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess {
size_t WritePos(const void* pBuffer,
size_t szBuffer,
FX_FILESIZE pos) override;
- FX_BOOL Flush() override;
- FX_BOOL Truncate(FX_FILESIZE szFile) override;
+ bool Flush() override;
+ bool Truncate(FX_FILESIZE szFile) override;
protected:
int32_t m_nFD;
diff --git a/core/fxcrt/fxcrt_stream.cpp b/core/fxcrt/fxcrt_stream.cpp
index 638a183177..48b8a79379 100644
--- a/core/fxcrt/fxcrt_stream.cpp
+++ b/core/fxcrt/fxcrt_stream.cpp
@@ -6,11 +6,11 @@
#include "core/fxcrt/fx_stream.h"
-FX_BOOL IFX_SeekableWriteStream::WriteBlock(const void* pData, size_t size) {
+bool IFX_SeekableWriteStream::WriteBlock(const void* pData, size_t size) {
return WriteBlock(pData, GetSize(), size);
}
-FX_BOOL IFX_SeekableReadStream::IsEOF() {
+bool IFX_SeekableReadStream::IsEOF() {
return FALSE;
}
@@ -22,6 +22,6 @@ size_t IFX_SeekableReadStream::ReadBlock(void* buffer, size_t size) {
return 0;
}
-FX_BOOL IFX_SeekableStream::WriteBlock(const void* buffer, size_t size) {
+bool IFX_SeekableStream::WriteBlock(const void* buffer, size_t size) {
return WriteBlock(buffer, GetSize(), size);
}
diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp
index ec16373f02..87bbe96a5c 100644
--- a/core/fxcrt/fxcrt_windows.cpp
+++ b/core/fxcrt/fxcrt_windows.cpp
@@ -28,6 +28,7 @@ void FXCRT_Windows_GetFileMode(uint32_t dwMode,
dwCreation = OPEN_EXISTING;
}
}
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -39,80 +40,91 @@ WINBASEAPI BOOL WINAPI SetFilePointerEx(HANDLE hFile,
#ifdef __cplusplus
}
#endif
+
CFXCRT_FileAccess_Win64::CFXCRT_FileAccess_Win64() : m_hFile(nullptr) {}
+
CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() {
Close();
}
-FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
- uint32_t dwMode) {
- if (m_hFile) {
+
+bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
+ uint32_t dwMode) {
+ if (m_hFile)
return FALSE;
- }
+
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr,
dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
if (m_hFile == INVALID_HANDLE_VALUE)
m_hFile = nullptr;
+
return !!m_hFile;
}
-FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
- uint32_t dwMode) {
- if (m_hFile) {
+
+bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
+ uint32_t dwMode) {
+ if (m_hFile)
return FALSE;
- }
+
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
m_hFile = ::CreateFileW((LPCWSTR)fileName.c_str(), dwAccess, dwShare, nullptr,
dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
if (m_hFile == INVALID_HANDLE_VALUE)
m_hFile = nullptr;
+
return !!m_hFile;
}
+
void CFXCRT_FileAccess_Win64::Close() {
- if (!m_hFile) {
+ if (!m_hFile)
return;
- }
+
::CloseHandle(m_hFile);
m_hFile = nullptr;
}
+
FX_FILESIZE CFXCRT_FileAccess_Win64::GetSize() const {
- if (!m_hFile) {
+ if (!m_hFile)
return 0;
- }
+
LARGE_INTEGER size = {};
- if (!::GetFileSizeEx(m_hFile, &size)) {
+ if (!::GetFileSizeEx(m_hFile, &size))
return 0;
- }
+
return (FX_FILESIZE)size.QuadPart;
}
+
FX_FILESIZE CFXCRT_FileAccess_Win64::GetPosition() const {
- if (!m_hFile) {
+ if (!m_hFile)
return (FX_FILESIZE)-1;
- }
+
LARGE_INTEGER dist = {};
LARGE_INTEGER newPos = {};
- if (!::SetFilePointerEx(m_hFile, dist, &newPos, FILE_CURRENT)) {
+ if (!::SetFilePointerEx(m_hFile, dist, &newPos, FILE_CURRENT))
return (FX_FILESIZE)-1;
- }
+
return (FX_FILESIZE)newPos.QuadPart;
}
+
FX_FILESIZE CFXCRT_FileAccess_Win64::SetPosition(FX_FILESIZE pos) {
- if (!m_hFile) {
+ if (!m_hFile)
return (FX_FILESIZE)-1;
- }
+
LARGE_INTEGER dist;
dist.QuadPart = pos;
LARGE_INTEGER newPos = {};
- if (!::SetFilePointerEx(m_hFile, dist, &newPos, FILE_BEGIN)) {
+ if (!::SetFilePointerEx(m_hFile, dist, &newPos, FILE_BEGIN))
return (FX_FILESIZE)-1;
- }
+
return (FX_FILESIZE)newPos.QuadPart;
}
+
size_t CFXCRT_FileAccess_Win64::Read(void* pBuffer, size_t szBuffer) {
- if (!m_hFile) {
+ if (!m_hFile)
return 0;
- }
+
size_t szRead = 0;
if (!::ReadFile(m_hFile, pBuffer, (DWORD)szBuffer, (LPDWORD)&szRead,
nullptr)) {
@@ -120,10 +132,11 @@ size_t CFXCRT_FileAccess_Win64::Read(void* pBuffer, size_t szBuffer) {
}
return szRead;
}
+
size_t CFXCRT_FileAccess_Win64::Write(const void* pBuffer, size_t szBuffer) {
- if (!m_hFile) {
+ if (!m_hFile)
return 0;
- }
+
size_t szWrite = 0;
if (!::WriteFile(m_hFile, pBuffer, (DWORD)szBuffer, (LPDWORD)&szWrite,
nullptr)) {
@@ -131,20 +144,22 @@ size_t CFXCRT_FileAccess_Win64::Write(const void* pBuffer, size_t szBuffer) {
}
return szWrite;
}
+
size_t CFXCRT_FileAccess_Win64::ReadPos(void* pBuffer,
size_t szBuffer,
FX_FILESIZE pos) {
- if (!m_hFile) {
+ if (!m_hFile)
return 0;
- }
- if (pos >= GetSize()) {
+
+ if (pos >= GetSize())
return 0;
- }
- if (SetPosition(pos) == (FX_FILESIZE)-1) {
+
+ if (SetPosition(pos) == (FX_FILESIZE)-1)
return 0;
- }
+
return Read(pBuffer, szBuffer);
}
+
size_t CFXCRT_FileAccess_Win64::WritePos(const void* pBuffer,
size_t szBuffer,
FX_FILESIZE pos) {
@@ -156,16 +171,18 @@ size_t CFXCRT_FileAccess_Win64::WritePos(const void* pBuffer,
}
return Write(pBuffer, szBuffer);
}
-FX_BOOL CFXCRT_FileAccess_Win64::Flush() {
- if (!m_hFile) {
- return FALSE;
- }
- return ::FlushFileBuffers(m_hFile);
+
+bool CFXCRT_FileAccess_Win64::Flush() {
+ if (!m_hFile)
+ return false;
+
+ return !!::FlushFileBuffers(m_hFile);
}
-FX_BOOL CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) {
- if (SetPosition(szFile) == (FX_FILESIZE)-1) {
- return FALSE;
- }
- return ::SetEndOfFile(m_hFile);
+
+bool CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) {
+ if (SetPosition(szFile) == (FX_FILESIZE)-1)
+ return false;
+
+ return !!::SetEndOfFile(m_hFile);
}
#endif
diff --git a/core/fxcrt/fxcrt_windows.h b/core/fxcrt/fxcrt_windows.h
index 19cef0adc2..f8f948360d 100644
--- a/core/fxcrt/fxcrt_windows.h
+++ b/core/fxcrt/fxcrt_windows.h
@@ -16,8 +16,8 @@ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess {
~CFXCRT_FileAccess_Win64() override;
// IFXCRT_FileAccess
- FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
- FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
+ bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
+ bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
void Close() override;
FX_FILESIZE GetSize() const override;
FX_FILESIZE GetPosition() const override;
@@ -28,8 +28,8 @@ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess {
size_t WritePos(const void* pBuffer,
size_t szBuffer,
FX_FILESIZE pos) override;
- FX_BOOL Flush() override;
- FX_BOOL Truncate(FX_FILESIZE szFile) override;
+ bool Flush() override;
+ bool Truncate(FX_FILESIZE szFile) override;
protected:
void* m_hFile;
diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h
index aa157c2333..bc9ea3dd48 100644
--- a/core/fxcrt/xml_int.h
+++ b/core/fxcrt/xml_int.h
@@ -21,10 +21,10 @@ class CXML_DataBufAcc : public IFX_BufferRead {
// IFX_BufferRead
void Release() override;
- FX_BOOL IsEOF() override;
+ bool IsEOF() override;
FX_FILESIZE GetPosition() override;
size_t ReadBlock(void* buffer, size_t size) override;
- FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) override;
+ bool ReadNextBlock(bool bRestart = FALSE) override;
const uint8_t* GetBlockBuffer() override;
size_t GetBlockSize() override;
FX_FILESIZE GetBlockOffset() override;
@@ -42,10 +42,10 @@ class CXML_DataStmAcc : public IFX_BufferRead {
// IFX_BufferRead
void Release() override;
- FX_BOOL IsEOF() override;
+ bool IsEOF() override;
FX_FILESIZE GetPosition() override;
size_t ReadBlock(void* buffer, size_t size) override;
- FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) override;
+ bool ReadNextBlock(bool bRestart = FALSE) override;
const uint8_t* GetBlockBuffer() override;
size_t GetBlockSize() override;
FX_FILESIZE GetBlockOffset() override;
@@ -62,13 +62,13 @@ class CXML_Parser {
CXML_Parser();
~CXML_Parser();
- FX_BOOL Init(uint8_t* pBuffer, size_t size);
- FX_BOOL Init(IFX_SeekableReadStream* pFileRead);
- FX_BOOL Init(IFX_BufferRead* pBuffer);
- FX_BOOL Init(FX_BOOL bOwndedStream);
- FX_BOOL ReadNextBlock();
- FX_BOOL IsEOF();
- FX_BOOL HaveAvailData();
+ bool Init(uint8_t* pBuffer, size_t size);
+ bool Init(IFX_SeekableReadStream* pFileRead);
+ bool Init(IFX_BufferRead* pBuffer);
+ bool Init(bool bOwndedStream);
+ bool ReadNextBlock();
+ bool IsEOF();
+ bool HaveAvailData();
void SkipWhiteSpaces();
void GetName(CFX_ByteString& space, CFX_ByteString& name);
void GetAttrValue(CFX_WideString& value);
@@ -85,7 +85,7 @@ class CXML_Parser {
void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
IFX_BufferRead* m_pDataAcc;
- FX_BOOL m_bOwnedStream;
+ bool m_bOwnedStream;
FX_FILESIZE m_nOffset;
FX_BOOL m_bSaveSpaceChars;
const uint8_t* m_pBuffer;