summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_basic_module.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_edit/editint.h14
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp244
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp38
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp24
-rw-r--r--core/src/fpdfapi/fpdf_font/font_int.h34
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp152
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp138
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h10
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp30
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp316
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp28
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp138
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp44
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp98
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp78
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp50
-rw-r--r--core/src/fpdfapi/fpdf_page/pageint.h70
-rw-r--r--core/src/fpdfapi/fpdf_parser/filters_int.h14
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp50
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp30
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp210
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp60
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp112
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp1056
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp38
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp164
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp38
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp186
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp180
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp64
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp110
-rw-r--r--core/src/fpdfapi/fpdf_render/render_int.h162
37 files changed, 2014 insertions, 2014 deletions
diff --git a/core/src/fpdfapi/fpdf_basic_module.cpp b/core/src/fpdfapi/fpdf_basic_module.cpp
index 03cfd66afb..83034af640 100644
--- a/core/src/fpdfapi/fpdf_basic_module.cpp
+++ b/core/src/fpdfapi/fpdf_basic_module.cpp
@@ -44,14 +44,14 @@ CPDF_ModuleMgr::~CPDF_ModuleMgr()
{
}
-void CPDF_ModuleMgr::SetDownloadCallback(FX_BOOL (*callback)(const FX_CHAR* module_name))
+void CPDF_ModuleMgr::SetDownloadCallback(bool (*callback)(const FX_CHAR* module_name))
{
m_pDownloadCallback = callback;
}
-FX_BOOL CPDF_ModuleMgr::DownloadModule(const FX_CHAR* module_name)
+bool CPDF_ModuleMgr::DownloadModule(const FX_CHAR* module_name)
{
if (m_pDownloadCallback == NULL) {
- return FALSE;
+ return false;
}
return m_pDownloadCallback(module_name);
}
diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h
index 4aec32a49a..bc4c72aff9 100644
--- a/core/src/fpdfapi/fpdf_edit/editint.h
+++ b/core/src/fpdfapi/fpdf_edit/editint.h
@@ -12,7 +12,7 @@ class CPDF_ObjectStream
public:
CPDF_ObjectStream();
- FX_BOOL Start();
+ bool Start();
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj);
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize);
@@ -34,15 +34,15 @@ public:
CPDF_XRefStream();
- FX_BOOL Start();
+ bool Start();
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator);
int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator);
- FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE);
- FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum);
- FX_BOOL EndXRefStream(CPDF_Creator* pCreator);
+ bool End(CPDF_Creator *pCreator, bool bEOF = false);
+ bool AddObjectNumberToIndexArray(FX_DWORD objnum);
+ bool EndXRefStream(CPDF_Creator* pCreator);
CFX_DWordArray m_IndexArray;
@@ -51,8 +51,8 @@ public:
FX_DWORD m_dwTempObjNum;
protected:
- int32_t EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE);
- FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF);
+ int32_t EndObjectStream(CPDF_Creator *pCreator, bool bEOF = true);
+ bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
int32_t m_iSeg;
CPDF_ObjectStream m_ObjStream;
CFX_ByteTextBuf m_Buffer;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index 65f78dab13..b84936c273 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -28,10 +28,10 @@ CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) : m_pPage(p
CPDF_PageContentGenerate::~CPDF_PageContentGenerate()
{
}
-FX_BOOL CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject)
+bool CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject)
{
if (!pPageObject) {
- return FALSE;
+ return false;
}
return m_pageObjects.Add(pPageObject);
}
@@ -51,7 +51,7 @@ void CPDF_PageContentGenerate::GenerateContent()
pPageDict->RemoveAt("Contents");
}
CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
- pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
+ pStream->SetData(buf.GetBuffer(), buf.GetLength(), false, false);
m_pDocument->AddIndirectObject(pStream);
pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
}
@@ -158,7 +158,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix)
ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);
}
CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
- pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
+ pStream->SetData(buf.GetBuffer(), buf.GetLength(), false, false);
m_pDocument->AddIndirectObject(pStream);
m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 22826a3609..b197b25979 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -13,7 +13,7 @@
extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, uint8_t*& dest_buf, FX_DWORD& dest_size);
extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns,
uint8_t*& dest_buf, FX_DWORD& dest_size);
-extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict);
+extern bool IsSignatureDict(const CPDF_Dictionary* pDict);
int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset)
{
int32_t len = 0;
@@ -43,7 +43,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *
break;
case PDFOBJ_STRING: {
CFX_ByteString str = pObj->GetString();
- FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex();
+ bool bHex = ((CPDF_String*)pObj)->IsHex();
if ((len = pFile->AppendString(PDF_EncodeString(str, bHex))) < 0) {
return -1;
}
@@ -156,7 +156,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *
}
offset += 8;
CPDF_StreamAcc acc;
- acc.LoadAllData(p, TRUE);
+ acc.LoadAllData(p, true);
if (pFile->AppendBlock(acc.GetData(), acc.GetSize()) < 0) {
return -1;
}
@@ -168,12 +168,12 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *
break;
}
default:
- ASSERT(FALSE);
+ ASSERT(false);
break;
}
return 1;
}
-int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress)
+int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, bool bCompress)
{
FX_FILESIZE offset = 0;
int32_t len = 0;
@@ -285,10 +285,10 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dw
offset += len + 6;
return offset;
}
-FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer)
+bool PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer)
{
if (!pBuffer) {
- return FALSE;
+ return false;
}
void* pContext = FX_Random_MT_Start(dwSeed1);
int32_t i = 0;
@@ -301,21 +301,21 @@ FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer
*pBuffer++ = FX_Random_MT_Generate(pContext);
}
FX_Random_MT_Close(pContext);
- return TRUE;
+ return true;
}
class CPDF_FlateEncoder
{
public:
CPDF_FlateEncoder();
~CPDF_FlateEncoder();
- FX_BOOL Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode);
- FX_BOOL Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE);
+ bool Initialize(CPDF_Stream* pStream, bool bFlateEncode);
+ bool Initialize(const uint8_t* pBuffer, FX_DWORD size, bool bFlateEncode, bool bXRefStream = false);
void CloneDict();
uint8_t* m_pData;
FX_DWORD m_dwSize;
CPDF_Dictionary* m_pDict;
- FX_BOOL m_bCloned;
- FX_BOOL m_bNewData;
+ bool m_bCloned;
+ bool m_bNewData;
CPDF_StreamAcc m_Acc;
};
CPDF_FlateEncoder::CPDF_FlateEncoder()
@@ -323,19 +323,19 @@ CPDF_FlateEncoder::CPDF_FlateEncoder()
m_pData = NULL;
m_dwSize = 0;
m_pDict = NULL;
- m_bCloned = FALSE;
- m_bNewData = FALSE;
+ m_bCloned = false;
+ m_bNewData = false;
}
void CPDF_FlateEncoder::CloneDict()
{
if (!m_bCloned) {
m_pDict = (CPDF_Dictionary*)m_pDict->Clone();
- m_bCloned = TRUE;
+ m_bCloned = true;
}
}
-FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
+bool CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, bool bFlateEncode)
{
- m_Acc.LoadAllData(pStream, TRUE);
+ m_Acc.LoadAllData(pStream, true);
if ((pStream && pStream->GetDict() && pStream->GetDict()->KeyExist("Filter")) || !bFlateEncode) {
if (pStream->GetDict()->KeyExist("Filter") && !bFlateEncode) {
CPDF_StreamAcc destAcc;
@@ -344,40 +344,40 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode
m_pData = (uint8_t*)destAcc.DetachData();
m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone();
m_pDict->RemoveAt(FX_BSTRC("Filter"));
- m_bNewData = TRUE;
- m_bCloned = TRUE;
+ m_bNewData = true;
+ m_bCloned = true;
} else {
m_pData = (uint8_t*)m_Acc.GetData();
m_dwSize = m_Acc.GetSize();
m_pDict = pStream->GetDict();
}
- return TRUE;
+ return true;
}
m_pData = NULL;
m_dwSize = 0;
- m_bNewData = TRUE;
- m_bCloned = TRUE;
+ m_bNewData = true;
+ m_bCloned = true;
::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), m_pData, m_dwSize);
m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone();
m_pDict->SetAtInteger("Length", m_dwSize);
m_pDict->SetAtName("Filter", "FlateDecode");
m_pDict->RemoveAt("DecodeParms");
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream)
+bool CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, FX_DWORD size, bool bFlateEncode, bool bXRefStream)
{
if (!bFlateEncode) {
m_pData = (uint8_t*)pBuffer;
m_dwSize = size;
- return TRUE;
+ return true;
}
- m_bNewData = TRUE;
+ m_bNewData = true;
if (bXRefStream) {
::FlateEncode(pBuffer, size, 12, 1, 8, 7, m_pData, m_dwSize);
} else {
::FlateEncode(pBuffer, size, m_pData, m_dwSize);
}
- return TRUE;
+ return true;
}
CPDF_FlateEncoder::~CPDF_FlateEncoder()
{
@@ -393,33 +393,33 @@ class CPDF_Encryptor
public:
CPDF_Encryptor();
~CPDF_Encryptor();
- FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size);
+ bool Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size);
uint8_t* m_pData;
FX_DWORD m_dwSize;
- FX_BOOL m_bNewBuf;
+ bool m_bNewBuf;
};
CPDF_Encryptor::CPDF_Encryptor()
{
m_pData = NULL;
m_dwSize = 0;
- m_bNewBuf = FALSE;
+ m_bNewBuf = false;
}
-FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size)
+bool CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size)
{
if (src_size == 0) {
- return TRUE;
+ return true;
}
if (pHandler == NULL) {
m_pData = (uint8_t*)src_data;
m_dwSize = src_size;
- m_bNewBuf = FALSE;
- return TRUE;
+ m_bNewBuf = false;
+ return true;
}
m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size);
m_pData = FX_Alloc(uint8_t, m_dwSize);
pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize);
- m_bNewBuf = TRUE;
- return TRUE;
+ m_bNewBuf = true;
+ return true;
}
CPDF_Encryptor::~CPDF_Encryptor()
{
@@ -432,14 +432,14 @@ CPDF_ObjectStream::CPDF_ObjectStream()
, m_index(0)
{
}
-FX_BOOL CPDF_ObjectStream::Start()
+bool CPDF_ObjectStream::Start()
{
m_ObjNumArray.RemoveAll();
m_OffsetArray.RemoveAll();
m_Buffer.Clear();
m_dwObjNum = 0;
m_index = 0;
- return TRUE;
+ return true;
}
int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj)
{
@@ -547,12 +547,12 @@ CPDF_XRefStream::CPDF_XRefStream()
, m_iSeg(0)
{
}
-FX_BOOL CPDF_XRefStream::Start()
+bool CPDF_XRefStream::Start()
{
m_IndexArray.RemoveAll();
m_Buffer.Clear();
m_iSeg = 0;
- return TRUE;
+ return true;
}
int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator)
{
@@ -578,7 +578,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t
}
return EndObjectStream(pCreator);
}
-static void _AppendIndex0(CFX_ByteTextBuf& buffer, FX_BOOL bFirstObject = TRUE)
+static void _AppendIndex0(CFX_ByteTextBuf& buffer, bool bFirstObject = true)
{
buffer.AppendByte(0);
buffer.AppendByte(0);
@@ -613,7 +613,7 @@ static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t inde
buffer.AppendByte(FX_GETBYTEOFFSET8(index));
buffer.AppendByte(FX_GETBYTEOFFSET0(index));
}
-int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
+int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, bool bEOF)
{
FX_FILESIZE objOffset = 0;
if (bEOF) {
@@ -644,7 +644,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
_AppendIndex2(m_Buffer, dwObjStmNum, index++);
}
} else {
- _AppendIndex0(m_Buffer, FALSE);
+ _AppendIndex0(m_Buffer, false);
}
}
if (iSize > 0 && bEOF) {
@@ -682,12 +682,12 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF)
}
return 1;
}
-FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF)
+bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF)
{
FX_FILESIZE offset_tmp = pCreator->m_Offset;
FX_DWORD objnum = ++pCreator->m_dwLastObjNum;
CFX_FileBufferArchive *pFile = &pCreator->m_File;
- FX_BOOL bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
+ bool bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
if (bIncremental) {
AddObjectNumberToIndexArray(objnum);
} else {
@@ -696,7 +696,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
if (offset) {
_AppendIndex1(m_Buffer, *offset);
} else {
- _AppendIndex0(m_Buffer, FALSE);
+ _AppendIndex0(m_Buffer, false);
}
}
}
@@ -704,49 +704,49 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
FX_FILESIZE &offset = pCreator->m_Offset;
int32_t len = pFile->AppendDWord(objnum);
if (len < 0) {
- return FALSE;
+ return false;
}
offset += len;
if ((len = pFile->AppendString(FX_BSTRC(" 0 obj\r\n<</Type /XRef/W[1 4 2]/Index["))) < 0) {
- return FALSE;
+ return false;
}
offset += len;
if (!bIncremental) {
if ((len = pFile->AppendDWord(0)) < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendString(FX_BSTRC(" "))) < 0) {
- return FALSE;
+ return false;
}
offset += len + 1;
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
- return FALSE;
+ return false;
}
offset += len;
} else {
int32_t iSeg = m_IndexArray.GetSize() / 2;
for (int32_t i = 0; i < iSeg; i++) {
if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2))) < 0) {
- return FALSE;
+ return false;
}
if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
- return FALSE;
+ return false;
}
offset += len + 1;
if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2 + 1))) < 0) {
- return FALSE;
+ return false;
}
if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
- return FALSE;
+ return false;
}
offset += len + 1;
}
}
if (pFile->AppendString(FX_BSTRC("]/Size ")) < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
- return FALSE;
+ return false;
}
offset += len + 7;
if (m_PrevOffset > 0) {
@@ -762,26 +762,26 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
}
offset += len + 6;
}
- FX_BOOL bPredictor = TRUE;
+ bool bPredictor = true;
CPDF_FlateEncoder encoder;
encoder.Initialize(m_Buffer.GetBuffer(), m_Buffer.GetLength(), pCreator->m_bCompress, bPredictor);
if (pCreator->m_bCompress) {
if (pFile->AppendString(FX_BSTRC("/Filter /FlateDecode")) < 0) {
- return FALSE;
+ return false;
}
offset += 20;
if (bPredictor) {
if ((len = pFile->AppendString(FX_BSTRC("/DecodeParms<</Columns 7/Predictor 12>>"))) < 0) {
- return FALSE;
+ return false;
}
offset += len;
}
}
if (pFile->AppendString(FX_BSTRC("/Length ")) < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendDWord(encoder.m_dwSize)) < 0) {
- return FALSE;
+ return false;
}
offset += len + 8;
if (bEOF) {
@@ -801,27 +801,27 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF
}
}
if ((len = pFile->AppendString(FX_BSTRC(">>stream\r\n"))) < 0) {
- return FALSE;
+ return false;
}
offset += len;
if (pFile->AppendBlock(encoder.m_pData, encoder.m_dwSize) < 0) {
- return FALSE;
+ return false;
}
if ((len = pFile->AppendString(FX_BSTRC("\r\nendstream\r\nendobj\r\n"))) < 0) {
- return FALSE;
+ return false;
}
offset += encoder.m_dwSize + len;
m_PrevOffset = offset_tmp;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_XRefStream::End(CPDF_Creator *pCreator, FX_BOOL bEOF )
+bool CPDF_XRefStream::End(CPDF_Creator *pCreator, bool bEOF )
{
if (EndObjectStream(pCreator, bEOF) < 0) {
- return FALSE;
+ return false;
}
return GenerateXRefStream(pCreator, bEOF);
}
-FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
+bool CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
{
if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) {
_AppendIndex0(m_Buffer);
@@ -830,7 +830,7 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
if (offset) {
_AppendIndex1(m_Buffer, *offset);
} else {
- _AppendIndex0(m_Buffer, FALSE);
+ _AppendIndex0(m_Buffer, false);
}
}
} else {
@@ -843,9 +843,9 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator)
}
}
}
- return GenerateXRefStream(pCreator, FALSE);
+ return GenerateXRefStream(pCreator, false);
}
-FX_BOOL CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
+bool CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
{
int32_t iSize = m_IndexArray.GetSize();
if (iSize == 0) {
@@ -862,13 +862,13 @@ FX_BOOL CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum)
m_IndexArray.Add(1);
}
}
- return TRUE;
+ return true;
}
CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
{
m_pDocument = pDoc;
m_pParser = (CPDF_Parser*)pDoc->m_pParser;
- m_bCompress = TRUE;
+ m_bCompress = true;
if (m_pParser) {
m_pEncryptDict = m_pParser->GetEncryptDict();
m_pCryptoHandler = m_pParser->GetCryptoHandler();
@@ -876,11 +876,11 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
m_pEncryptDict = NULL;
m_pCryptoHandler = NULL;
}
- m_bSecurityChanged = FALSE;
- m_bStandardSecurity = FALSE;
+ m_bSecurityChanged = false;
+ m_bStandardSecurity = false;
m_pMetadata = NULL;
- m_bEncryptCloned = FALSE;
- m_bEncryptMetadata = FALSE;
+ m_bEncryptCloned = false;
+ m_bEncryptMetadata = false;
m_Offset = 0;
m_iStage = -1;
m_dwFlags = 0;
@@ -892,7 +892,7 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
m_pIDArray = NULL;
m_FileVersion = 0;
m_dwEnryptObjNum = 0;
- m_bNewCrypto = FALSE;
+ m_bNewCrypto = false;
}
CPDF_Creator::~CPDF_Creator()
{
@@ -903,10 +903,10 @@ CPDF_Creator::~CPDF_Creator()
}
Clear();
}
-static FX_BOOL _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag)
+static bool _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag)
{
if (!(flag & FPDFCREATE_INCREMENTAL)) {
- return FALSE;
+ return false;
}
int32_t iSize = pXRef->m_IndexArray.GetSize() / 2;
int32_t iCount = 0;
@@ -1001,7 +1001,7 @@ int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum)
int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto)
{
CPDF_FlateEncoder encoder;
- encoder.Initialize((CPDF_Stream*)pStream, pStream == m_pMetadata ? FALSE : m_bCompress);
+ encoder.Initialize((CPDF_Stream*)pStream, pStream == m_pMetadata ? false : m_bCompress);
CPDF_Encryptor encryptor;
if(!encryptor.Initialize(pCrypto, objnum, encoder.m_pData, encoder.m_dwSize)) {
return -1;
@@ -1067,7 +1067,7 @@ int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj)
}
return WriteIndirectObj(pObj->GetObjNum(), pObj);
}
-int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt)
+int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, bool bEncrypt)
{
int32_t len = 0;
if (pObj == NULL) {
@@ -1096,7 +1096,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, F
break;
case PDFOBJ_STRING: {
CFX_ByteString str = pObj->GetString();
- FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex();
+ bool bHex = ((CPDF_String*)pObj)->IsHex();
if (m_pCryptoHandler == NULL || !bEncrypt) {
CFX_ByteString content = PDF_EncodeString(str, bHex);
if ((len = m_File.AppendString(content)) < 0) {
@@ -1206,10 +1206,10 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, F
}
m_Offset += 2;
CPDF_Dictionary* p = (CPDF_Dictionary*)pObj;
- FX_BOOL bSignDict = IsSignatureDict(p);
+ bool bSignDict = IsSignatureDict(p);
FX_POSITION pos = p->GetStartPos();
while (pos) {
- FX_BOOL bSignValue = FALSE;
+ bool bSignValue = false;
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
if (m_File.AppendString(FX_BSTRC("/")) < 0) {
@@ -1220,7 +1220,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, F
}
m_Offset += len + 1;
if (bSignDict && key == FX_BSTRC("Contents")) {
- bSignValue = TRUE;
+ bSignValue = true;
}
if (pValue->GetObjNum()) {
if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
@@ -1255,8 +1255,8 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum)
}
m_ObjectOffset[objnum] = m_Offset;
void* valuetemp = NULL;
- FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, valuetemp);
- FX_BOOL bObjStm = (m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream;
+ bool bExistInMap = m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, valuetemp);
+ bool bObjStm = (m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream;
if(m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap || bObjStm) {
CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
if (pObj == NULL) {
@@ -1334,7 +1334,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause)
}
return 0;
}
-int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause)
+int32_t CPDF_Creator::WriteNewObjs(bool bIncremental, IFX_Pause *pPause)
{
int32_t iCount = m_NewObjNumArray.GetSize();
int32_t index = (int32_t)(uintptr_t)m_Pos;
@@ -1385,8 +1385,8 @@ void CPDF_Creator::InitOldObjNumOffsets()
}
void CPDF_Creator::InitNewObjNumOffsets()
{
- FX_BOOL bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
- FX_BOOL bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
+ bool bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
+ bool bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
FX_DWORD nOldSize = m_pParser ? m_pParser->m_CrossRef.GetSize() : 0;
FX_POSITION pos = m_pDocument->m_IndirectObjs.GetStartPosition();
while (pos) {
@@ -1414,7 +1414,7 @@ void CPDF_Creator::InitNewObjNumOffsets()
}
int32_t i = 0;
FX_DWORD dwStartObjNum = 0;
- FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
+ bool bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
while (i < iCount) {
dwStartObjNum = m_NewObjNumArray.ElementAt(i);
if ((bIncremental && (bNoOriginal || bCrossRefValid)) || !m_ObjectOffset.GetPtrAt(dwStartObjNum)) {
@@ -1427,10 +1427,10 @@ void CPDF_Creator::InitNewObjNumOffsets()
}
FX_DWORD dwLastObjNum = dwStartObjNum;
i++;
- FX_BOOL bNewStart = FALSE;
+ bool bNewStart = false;
for (; i < iCount; i++) {
FX_DWORD dwCurObjNum = m_NewObjNumArray.ElementAt(i);
- FX_BOOL bExist = (dwCurObjNum < nOldSize && m_ObjectOffset.GetPtrAt(dwCurObjNum) != NULL);
+ bool bExist = (dwCurObjNum < nOldSize && m_ObjectOffset.GetPtrAt(dwCurObjNum) != NULL);
if (bExist || dwCurObjNum - dwLastObjNum > 1) {
if (!bNewStart) {
m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1);
@@ -1546,7 +1546,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause)
if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_pParser->GetLastXRefOffset() == 0) {
InitOldObjNumOffsets();
FX_DWORD dwEnd = m_pParser->GetLastObjNum();
- FX_BOOL bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0;
+ bool bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0;
for (FX_DWORD objnum = 0; objnum <= dwEnd; objnum++) {
if (m_pParser->m_V5Type[objnum] == 0 || m_pParser->m_V5Type[objnum] == 255) {
continue;
@@ -1622,7 +1622,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause)
if (m_iStage == 80) {
m_XrefStart = m_Offset;
if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) {
- m_pXRefStream->End(this, TRUE);
+ m_pXRefStream->End(this, true);
m_XrefStart = m_pXRefStream->m_PrevOffset;
m_iStage = 90;
} else if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 || !m_pParser->IsXRefStream()) {
@@ -1765,7 +1765,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause)
{
FXSYS_assert(m_iStage >= 90);
if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) {
- FX_BOOL bXRefStream = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
+ bool bXRefStream = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
if (!bXRefStream) {
if (m_File.AppendString(FX_BSTRC("trailer\r\n<<")) < 0) {
return -1;
@@ -1976,39 +1976,39 @@ void CPDF_Creator::Clear()
m_pIDArray = NULL;
}
}
-FX_BOOL CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags)
+bool CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags)
{
if (!m_File.AttachFile(filename)) {
- return FALSE;
+ return false;
}
- FX_BOOL bRet = Create(flags);
+ bool bRet = Create(flags);
if (!bRet || !(flags & FPDFCREATE_PROGRESSIVE)) {
Clear();
}
return bRet;
}
-FX_BOOL CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags)
+bool CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags)
{
if (!m_File.AttachFile(filename)) {
- return FALSE;
+ return false;
}
- FX_BOOL bRet = Create(flags);
+ bool bRet = Create(flags);
if (!bRet || !(flags & FPDFCREATE_PROGRESSIVE)) {
Clear();
}
return bRet;
}
-FX_BOOL CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags)
+bool CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags)
{
if (!pFile) {
- return FALSE;
+ return false;
}
- if (!m_File.AttachFile(pFile, FALSE)) {
- return FALSE;
+ if (!m_File.AttachFile(pFile, false)) {
+ return false;
}
return Create(flags);
}
-FX_BOOL CPDF_Creator::Create(FX_DWORD flags)
+bool CPDF_Creator::Create(FX_DWORD flags)
{
m_dwFlags = flags;
m_iStage = 0;
@@ -2019,14 +2019,14 @@ FX_BOOL CPDF_Creator::Create(FX_DWORD flags)
m_NewObjNumArray.RemoveAll();
InitID();
if (flags & FPDFCREATE_PROGRESSIVE) {
- return TRUE;
+ return true;
}
return Continue(NULL) > -1;
}
-void CPDF_Creator::InitID(FX_BOOL bDefault )
+void CPDF_Creator::InitID(bool bDefault )
{
CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : NULL;
- FX_BOOL bNewId = !m_pIDArray;
+ bool bNewId = !m_pIDArray;
if (!m_pIDArray) {
FX_DWORD* pBuffer = NULL;
m_pIDArray = CPDF_Array::Create();
@@ -2037,7 +2037,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
pBuffer = FX_Alloc(FX_DWORD, 4);
PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer);
CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD));
- m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
+ m_pIDArray->Add(CPDF_String::Create(bsBuffer, true), m_pDocument);
}
if (pBuffer) {
FX_Free(pBuffer);
@@ -2055,7 +2055,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
FX_DWORD* pBuffer = FX_Alloc(FX_DWORD, 4);
PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer);
CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD));
- m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
+ m_pIDArray->Add(CPDF_String::Create(bsBuffer, true), m_pDocument);
FX_Free(pBuffer);
return;
}
@@ -2071,8 +2071,8 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
}
m_pCryptoHandler = new CPDF_StandardCryptoHandler;
m_pCryptoHandler->Init(m_pEncryptDict, &handler);
- m_bNewCrypto = TRUE;
- m_bSecurityChanged = TRUE;
+ m_bNewCrypto = true;
+ m_bSecurityChanged = true;
}
}
}
@@ -2103,18 +2103,18 @@ int32_t CPDF_Creator::Continue(IFX_Pause *pPause)
}
return m_iStage;
}
-FX_BOOL CPDF_Creator::SetFileVersion(int32_t fileVersion )
+bool CPDF_Creator::SetFileVersion(int32_t fileVersion )
{
if (fileVersion < 10 || fileVersion > 17) {
- return FALSE;
+ return false;
}
m_FileVersion = fileVersion;
- return TRUE;
+ return true;
}
void CPDF_Creator::RemoveSecurity()
{
ResetStandardSecurity();
- m_bSecurityChanged = TRUE;
+ m_bSecurityChanged = true;
m_pEncryptDict = NULL;
m_pCryptoHandler = NULL;
}
@@ -2124,7 +2124,7 @@ void CPDF_Creator::ResetStandardSecurity()
delete m_pCryptoHandler;
m_pCryptoHandler = NULL;
}
- m_bNewCrypto = FALSE;
+ m_bNewCrypto = false;
if (!m_bStandardSecurity) {
return;
}
@@ -2132,5 +2132,5 @@ void CPDF_Creator::ResetStandardSecurity()
m_pEncryptDict->Release();
m_pEncryptDict = NULL;
}
- m_bStandardSecurity = FALSE;
+ m_bStandardSecurity = false;
}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 5a5fb94ef3..3621c7957a 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -12,7 +12,7 @@ CPDF_Document::CPDF_Document() : CPDF_IndirectObjects(NULL)
{
m_pRootDict = NULL;
m_pInfoDict = NULL;
- m_bLinearized = FALSE;
+ m_bLinearized = false;
m_dwFirstPageNo = 0;
m_dwFirstPageObjNum = 0;
m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this);
@@ -215,7 +215,7 @@ static void _InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArr
}
FX_Free(widths);
}
-CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_BOOL bTranslateName)
+CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, bool bVert, bool bTranslateName)
{
LOGFONTA lfa;
FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
@@ -239,7 +239,7 @@ CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC)
}
return result;
}
-CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_BOOL bTranslateName)
+CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, bool bVert, bool bTranslateName)
{
pLogFont->lfHeight = -1000;
pLogFont->lfWidth = 0;
@@ -269,7 +269,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B
if ((pLogFont->lfPitchAndFamily & 0xf8) == FF_SCRIPT) {
flags |= PDFFONT_SCRIPT;
}
- FX_BOOL bCJK = pLogFont->lfCharSet == CHINESEBIG5_CHARSET || pLogFont->lfCharSet == GB2312_CHARSET ||
+ bool bCJK = pLogFont->lfCharSet == CHINESEBIG5_CHARSET || pLogFont->lfCharSet == GB2312_CHARSET ||
pLogFont->lfCharSet == HANGEUL_CHARSET || pLogFont->lfCharSet == SHIFTJIS_CHARSET;
CFX_ByteString basefont;
if (bTranslateName && bCJK) {
@@ -549,7 +549,7 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest)
dest = (FX_CHAR*)pBuffer;
free(pBuffer);
}
-FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
+bool IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
{
int iCount = charSets.GetSize();
for (int i = 0; i < CFArrayGetCount(languages); ++i) {
@@ -557,11 +557,11 @@ FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
FX_DWORD CharSet = FX_GetCharsetFromLang(CFStringGetCStringPtr(language, kCFStringEncodingMacRoman), -1);
for (int j = 0; j < iCount; ++j) {
if (CharSet == charSets[j]) {
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
void FX_GetCharWidth(CTFontRef font, UniChar start, UniChar end, int* width)
{
@@ -599,7 +599,7 @@ static void _InsertWidthArray(CTFontRef font, int start, int end, CPDF_Array* pW
}
FX_Free(widths);
}
-CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTranslateName)
+CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, bool bVert, bool bTranslateName)
{
CTFontRef font = (CTFontRef)pFont;
CTFontDescriptorRef descriptor = CTFontCopyFontDescriptor(font);
@@ -607,7 +607,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr
return NULL;
}
CFX_ByteString basefont;
- FX_BOOL bCJK = FALSE;
+ bool bCJK = false;
int flags = 0, italicangle = 0, ascend = 0, descend = 0, capheight = 0, bbox[4];
FXSYS_memset(bbox, 0, sizeof(int) * 4);
CFArrayRef languages = (CFArrayRef)CTFontDescriptorCopyAttribute(descriptor, kCTFontLanguagesAttribute);
@@ -621,7 +621,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr
charSets.Add(FXFONT_HANGEUL_CHARSET);
charSets.Add(FXFONT_SHIFTJIS_CHARSET);
if (IsHasCharSet(languages, charSets)) {
- bCJK = TRUE;
+ bCJK = true;
}
CFRelease(descriptor);
CFDictionaryRef traits = (CFDictionaryRef)CTFontCopyTraits(font);
@@ -737,7 +737,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr
CFX_ByteString cmap;
CFX_ByteString ordering;
int supplement;
- FX_BOOL bFound = FALSE;
+ bool bFound = false;
CPDF_Array* pWidthArray = new CPDF_Array;
charSets.RemoveAll();
charSets.Add(FXFONT_CHINESEBIG5_CHARSET);
@@ -747,7 +747,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr
supplement = 4;
pWidthArray->AddInteger(1);
_InsertWidthArray(font, 0x20, 0x7e, pWidthArray);
- bFound = TRUE;
+ bFound = true;
}
charSets.RemoveAll();
charSets.Add(FXFONT_GB2312_CHARSET);
@@ -758,7 +758,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr
_InsertWidthArray(font, 0x20, 0x20, pWidthArray);
pWidthArray->AddInteger(814);
_InsertWidthArray(font, 0x21, 0x7e, pWidthArray);
- bFound = TRUE;
+ bFound = true;
}
charSets.RemoveAll();
charSets.Add(FXFONT_HANGEUL_CHARSET);
@@ -768,7 +768,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr
supplement = 2;
pWidthArray->AddInteger(1);
_InsertWidthArray(font, 0x20, 0x7e, pWidthArray);
- bFound = TRUE;
+ bFound = true;
}
charSets.RemoveAll();
charSets.Add(FXFONT_SHIFTJIS_CHARSET);
@@ -867,12 +867,12 @@ static void _InsertWidthArray1(CFX_Font* pFont, IFX_FontEncoding* pEncoding, FX_
}
FX_Free(widths);
}
-CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert)
+CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert)
{
if (pFont == NULL) {
return NULL;
}
- FX_BOOL bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || charset == FXFONT_GB2312_CHARSET ||
+ bool bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || charset == FXFONT_GB2312_CHARSET ||
charset == FXFONT_HANGEUL_CHARSET || charset == FXFONT_SHIFTJIS_CHARSET;
CFX_ByteString basefont = pFont->GetFamilyName();
basefont.Replace(" ", "");
@@ -1052,7 +1052,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert)
return LoadFont(pBaseDict);
}
static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages,
- int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL bInsert, CFX_PtrArray& stackList)
+ int nPagesToGo, CPDF_Dictionary* pPage, bool bInsert, CFX_PtrArray& stackList)
{
CPDF_Array* pKidList = pPages->GetArray("Kids");
if (!pKidList) {
@@ -1122,7 +1122,7 @@ static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageD
} else {
CFX_PtrArray stack;
stack.Add(pPages);
- if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, stack) < 0) {
+ if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, true, stack) < 0) {
return -1;
}
}
@@ -1165,7 +1165,7 @@ void CPDF_Document::DeletePage(int iPage)
}
CFX_PtrArray stack;
stack.Add(pPages);
- if (InsertDeletePDFPage(this, pPages, iPage, NULL, FALSE, stack) < 0) {
+ if (InsertDeletePDFPage(this, pPages, iPage, NULL, false, stack) < 0) {
return;
}
m_PageList.RemoveAt(iPage);
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index dad7326a5b..21ce31e3c3 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -16,7 +16,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size)
int32_t height;
int32_t num_comps;
int32_t bits;
- FX_BOOL color_trans;
+ bool color_trans;
if (!CPDF_ModuleMgr::Get()->GetJpegModule()->
LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) {
return NULL;
@@ -48,7 +48,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size)
pDict->SetAt("DecodeParms", pParms);
pParms->SetAtInteger("ColorTransform", 0);
}
- m_bIsMask = FALSE;
+ m_bIsMask = false;
m_Width = width;
m_Height = height;
if (m_pStream == NULL) {
@@ -92,7 +92,7 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile)
void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, int quality, uint8_t* &buf, FX_STRSIZE &size)
{
}
-void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, uint8_t* &buf, FX_STRSIZE &size, FX_BOOL bLossLess)
+void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, uint8_t* &buf, FX_STRSIZE &size, bool bLossLess)
{
}
void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam)
@@ -105,7 +105,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
uint8_t* src_buf = pBitmap->GetBuffer();
int32_t src_pitch = pBitmap->GetPitch();
int32_t bpp = pBitmap->GetBPP();
- FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb);
+ bool bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Dictionary* pDict = new CPDF_Dictionary;
pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
@@ -121,7 +121,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b);
}
if (set_a == 0 || reset_a == 0) {
- pDict->SetAt(FX_BSTRC("ImageMask"), new CPDF_Boolean(TRUE));
+ pDict->SetAt(FX_BSTRC("ImageMask"), new CPDF_Boolean(true));
if (reset_a == 0) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(1);
@@ -142,7 +142,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
pBuf[4] = (FX_CHAR)set_g;
pBuf[5] = (FX_CHAR)set_b;
ct.ReleaseBuffer(6);
- pCS->Add(CPDF_String::Create(ct, TRUE));
+ pCS->Add(CPDF_String::Create(ct, true));
pDict->SetAt(FX_BSTRC("ColorSpace"), pCS);
}
pDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 1);
@@ -194,10 +194,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
}
}
const CFX_DIBitmap* pMaskBitmap = NULL;
- FX_BOOL bDeleteMask = FALSE;
+ bool bDeleteMask = false;
if (pBitmap->HasAlpha()) {
pMaskBitmap = pBitmap->GetAlphaMask();
- bDeleteMask = TRUE;
+ bDeleteMask = true;
}
if (!pMaskBitmap && pMask) {
FXDIB_Format maskFormat = pMask->GetFormat();
@@ -220,7 +220,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
if (pMaskBitmap->GetBPP() == 8 && (iCompress & PDF_IMAGE_MASK_LOSSY_COMPRESS) != 0) {
_DCTEncodeBitmap(pMaskDict, pMaskBitmap, pParam ? pParam->nQuality : 75, mask_buf, mask_size);
} else if (pMaskBitmap->GetFormat() == FXDIB_1bppMask) {
- _JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, TRUE);
+ _JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, true);
} else {
mask_buf = FX_Alloc2D(uint8_t, maskHeight, maskWidth);
mask_size = maskHeight * maskWidth; // Safe since checked alloc returned.
@@ -245,15 +245,15 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi
delete pMaskBitmap;
}
}
- FX_BOOL bStream = pFileWrite != NULL && pFileRead != NULL;
+ bool bStream = pFileWrite != NULL && pFileRead != NULL;
if (opType == 0) {
if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) {
if (pBitmap->GetBPP() == 1) {
- _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, TRUE);
+ _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, true);
}
} else {
if (pBitmap->GetBPP() == 1) {
- _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, FALSE);
+ _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, false);
} else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) {
CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap();
pNewBitmap->Copy(pBitmap);
diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h
index f57e52758a..e52540853d 100644
--- a/core/src/fpdfapi/fpdf_font/font_int.h
+++ b/core/src/fpdfapi/fpdf_font/font_int.h
@@ -12,15 +12,15 @@ class CPDF_CMapManager
public:
CPDF_CMapManager();
~CPDF_CMapManager();
- void* GetPackage(FX_BOOL bPrompt);
- CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt);
- CPDF_CID2UnicodeMap* GetCID2UnicodeMap(int charset, FX_BOOL bPrompt);
+ void* GetPackage(bool bPrompt);
+ CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, bool bPrompt);
+ CPDF_CID2UnicodeMap* GetCID2UnicodeMap(int charset, bool bPrompt);
void ReloadAll();
private:
- CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt);
- CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(int charset, FX_BOOL bPrompt);
- void DropAll(FX_BOOL bReload);
- FX_BOOL m_bPrompted;
+ CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, bool bPrompt);
+ CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(int charset, bool bPrompt);
+ void DropAll(bool bReload);
+ bool m_bPrompted;
CFX_MapByteStringToPtr m_CMaps;
CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6];
};
@@ -56,7 +56,7 @@ class CPDF_CMapParser
public:
CPDF_CMapParser();
~CPDF_CMapParser() {}
- FX_BOOL Initialize(CPDF_CMap*);
+ bool Initialize(CPDF_CMap*);
void ParseWord(const CFX_ByteStringC& str);
CFX_BinaryBuf m_AddMaps;
private:
@@ -80,10 +80,10 @@ class CPDF_CMap
{
public:
CPDF_CMap();
- FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, FX_BOOL bPromptCJK);
- FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize);
+ bool LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, bool bPromptCJK);
+ bool LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize);
void Release();
- FX_BOOL IsLoaded() const
+ bool IsLoaded() const
{
return m_bLoaded;
}
@@ -91,7 +91,7 @@ public:
{
return m_Charset;
}
- FX_BOOL IsVertWriting() const
+ bool IsVertWriting() const
{
return m_bVertical;
}
@@ -109,14 +109,14 @@ protected:
friend class CPDF_CIDFont;
protected:
CFX_ByteString m_PredefinedCMap;
- FX_BOOL m_bVertical;
+ bool m_bVertical;
int m_Charset, m_Coding;
CodingScheme m_CodingScheme;
int m_nCodeRanges;
uint8_t* m_pLeadingBytes;
FX_WORD* m_pMapping;
uint8_t* m_pAddMapping;
- FX_BOOL m_bLoaded;
+ bool m_bLoaded;
const FXCMAP_CMap* m_pEmbedMap;
CPDF_CMap* m_pUseMap;
};
@@ -146,9 +146,9 @@ class CPDF_CID2UnicodeMap
public:
CPDF_CID2UnicodeMap();
~CPDF_CID2UnicodeMap();
- FX_BOOL Initialize();
- FX_BOOL IsLoaded();
- void Load(CPDF_CMapManager* pMgr, int charset, FX_BOOL bPromptCJK);
+ bool Initialize();
+ bool IsLoaded();
+ void Load(CPDF_CMapManager* pMgr, int charset, bool bPromptCJK);
FX_WCHAR UnicodeFromCID(FX_WORD CID);
protected:
int m_Charset;
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 8037a8c674..afcce6d18c 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -12,16 +12,16 @@
#include "../fpdf_page/pageint.h"
#include "font_int.h"
-FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id)
+bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id)
{
for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i ++) {
if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == platform_id &&
FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) == encoding_id) {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
CPDF_FontGlobals::CPDF_FontGlobals()
: m_pContrastRamps(NULL)
@@ -120,7 +120,7 @@ CPDF_Font::CPDF_Font(int fonttype) : m_FontType(fonttype)
m_pFontFile = NULL;
m_Flags = 0;
m_pToUnicodeMap = NULL;
- m_bToUnicodeLoaded = FALSE;
+ m_bToUnicodeLoaded = false;
m_pCharMap = new CPDF_FontCharMap(this);
}
CPDF_Font::~CPDF_Font()
@@ -135,9 +135,9 @@ CPDF_Font::~CPDF_Font()
m_pDocument->GetPageData()->ReleaseFontFileStreamAcc((CPDF_Stream*)m_pFontFile->GetStream());
}
}
-FX_BOOL CPDF_Font::IsVertWriting() const
+bool CPDF_Font::IsVertWriting() const
{
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -236,33 +236,33 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc)
{
m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags"), PDFFONT_NONSYMBOLIC);
int ItalicAngle = 0;
- FX_BOOL bExistItalicAngle = FALSE;
+ bool bExistItalicAngle = false;
if (pFontDesc->KeyExist(FX_BSTRC("ItalicAngle"))) {
ItalicAngle = pFontDesc->GetInteger(FX_BSTRC("ItalicAngle"));
- bExistItalicAngle = TRUE;
+ bExistItalicAngle = true;
}
if (ItalicAngle < 0) {
m_Flags |= PDFFONT_ITALIC;
m_ItalicAngle = ItalicAngle;
}
- FX_BOOL bExistStemV = FALSE;
+ bool bExistStemV = false;
if (pFontDesc->KeyExist(FX_BSTRC("StemV"))) {
m_StemV = pFontDesc->GetInteger(FX_BSTRC("StemV"));
- bExistStemV = TRUE;
+ bExistStemV = true;
}
- FX_BOOL bExistAscent = FALSE;
+ bool bExistAscent = false;
if (pFontDesc->KeyExist(FX_BSTRC("Ascent"))) {
m_Ascent = pFontDesc->GetInteger(FX_BSTRC("Ascent"));
- bExistAscent = TRUE;
+ bExistAscent = true;
}
- FX_BOOL bExistDescent = FALSE;
+ bool bExistDescent = false;
if (pFontDesc->KeyExist(FX_BSTRC("Descent"))) {
m_Descent = pFontDesc->GetInteger(FX_BSTRC("Descent"));
- bExistDescent = TRUE;
+ bExistDescent = true;
}
- FX_BOOL bExistCapHeight = FALSE;
+ bool bExistCapHeight = false;
if (pFontDesc->KeyExist(FX_BSTRC("CapHeight"))) {
- bExistCapHeight = TRUE;
+ bExistCapHeight = true;
}
if (bExistItalicAngle && bExistAscent && bExistCapHeight && bExistDescent && bExistStemV) {
m_Flags |= PDFFONT_USEEXTERNATTR;
@@ -316,7 +316,7 @@ void CPDF_Font::CheckFontMetrics()
m_Ascent = TT2PDF(FXFT_Get_Face_Ascender(m_Font.m_Face), m_Font.m_Face);
m_Descent = TT2PDF(FXFT_Get_Face_Descender(m_Font.m_Face), m_Font.m_Face);
} else {
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
for (int i = 0; i < 256; i ++) {
FX_RECT rect;
GetCharBBox(i, rect);
@@ -325,7 +325,7 @@ void CPDF_Font::CheckFontMetrics()
}
if (bFirst) {
m_FontBBox = rect;
- bFirst = FALSE;
+ bFirst = false;
} else {
if (m_FontBBox.top < rect.top) {
m_FontBBox.top = rect.top;
@@ -361,7 +361,7 @@ void CPDF_Font::CheckFontMetrics()
}
void CPDF_Font::LoadUnicodeMap()
{
- m_bToUnicodeLoaded = TRUE;
+ m_bToUnicodeLoaded = true;
CPDF_Stream* pStream = m_pFontDict->GetStream(FX_BSTRC("ToUnicode"));
if (pStream == NULL) {
return;
@@ -466,10 +466,10 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic
}
return pFont;
}
-FX_BOOL CPDF_Font::Load()
+bool CPDF_Font::Load()
{
if (m_pFontDict == NULL) {
- return FALSE;
+ return false;
}
CFX_ByteString type = m_pFontDict->GetString(FX_BSTRC("Subtype"));
m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont"));
@@ -623,7 +623,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream)
{
int CIDSet = 0;
CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, FALSE);
+ stream.LoadAllData(pStream, false);
CPDF_SimpleParser parser(stream.GetData(), stream.GetSize());
m_Map.EstimateSize(stream.GetSize() / 8, 1024);
while (1) {
@@ -719,12 +719,12 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream)
}
}
if (CIDSet) {
- m_pBaseMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(CIDSet, FALSE);
+ m_pBaseMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(CIDSet, false);
} else {
m_pBaseMap = NULL;
}
}
-static FX_BOOL GetPredefinedEncoding(int& basemap, const CFX_ByteString& value)
+static bool GetPredefinedEncoding(int& basemap, const CFX_ByteString& value)
{
if (value == FX_BSTRC("WinAnsiEncoding")) {
basemap = PDFFONT_ENCODING_WINANSI;
@@ -735,12 +735,12 @@ static FX_BOOL GetPredefinedEncoding(int& basemap, const CFX_ByteString& value)
} else if (value == FX_BSTRC("PDFDocEncoding")) {
basemap = PDFFONT_ENCODING_PDFDOC;
} else {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, int& iBaseEncoding, CFX_ByteString*& pCharNames,
- FX_BOOL bEmbedded, FX_BOOL bTrueType)
+ bool bEmbedded, bool bTrueType)
{
if (pEncoding == NULL) {
if (m_BaseFont == FX_BSTRC("Symbol")) {
@@ -802,18 +802,18 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, int& iBaseEncoding, CFX_
}
}
}
-FX_BOOL CPDF_Font::IsStandardFont() const
+bool CPDF_Font::IsStandardFont() const
{
if (m_FontType != PDFFONT_TYPE1) {
- return FALSE;
+ return false;
}
if (m_pFontFile != NULL) {
- return FALSE;
+ return false;
}
if (((CPDF_Type1Font*)this)->GetBase14Font() < 0) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype)
{
@@ -828,10 +828,10 @@ CPDF_SimpleFont::~CPDF_SimpleFont()
{
delete[] m_pCharNames;
}
-int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
+int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, bool *pVertGlyph)
{
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
if (charcode > 0xff) {
return -1;
@@ -923,7 +923,7 @@ const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNa
}
return name;
}
-FX_BOOL CPDF_SimpleFont::LoadCommon()
+bool CPDF_SimpleFont::LoadCommon()
{
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
if (pFontDesc) {
@@ -931,9 +931,9 @@ FX_BOOL CPDF_SimpleFont::LoadCommon()
}
CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths"));
int width_start = 0, width_end = -1;
- m_bUseFontWidth = TRUE;
+ m_bUseFontWidth = true;
if (pWidthArray) {
- m_bUseFontWidth = FALSE;
+ m_bUseFontWidth = false;
if (pFontDesc && pFontDesc->KeyExist(FX_BSTRC("MissingWidth"))) {
int MissingWidth = pFontDesc->GetInteger(FX_BSTRC("MissingWidth"));
for (int i = 0; i < 256; i ++) {
@@ -970,7 +970,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon()
delete[] m_pCharNames;
m_pCharNames = NULL;
if (m_Font.m_Face == NULL) {
- return TRUE;
+ return true;
}
if (m_Flags & PDFFONT_ALLCAP) {
unsigned char lowercases[] = {'a', 'z', 0xe0, 0xf6, 0xf8, 0xfd};
@@ -988,7 +988,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon()
}
}
CheckFontMetrics();
- return TRUE;
+ return true;
}
void CPDF_SimpleFont::LoadSubstFont()
{
@@ -1013,7 +1013,7 @@ void CPDF_SimpleFont::LoadSubstFont()
if (m_Font.m_pSubstFont->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) {
}
}
-FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const
+bool CPDF_SimpleFont::IsUnicodeCompatible() const
{
return m_BaseEncoding != PDFFONT_ENCODING_BUILTIN && m_BaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
@@ -1022,7 +1022,7 @@ CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1)
{
m_Base14Font = -1;
}
-FX_BOOL CPDF_Type1Font::_Load()
+bool CPDF_Type1Font::_Load()
{
m_Base14Font = _PDF_GetStandardFontName(m_BaseFont);
if (m_Base14Font >= 0) {
@@ -1046,21 +1046,21 @@ FX_BOOL CPDF_Type1Font::_Load()
}
return LoadCommon();
}
-static FX_BOOL FT_UseType1Charmap(FXFT_Face face)
+static bool FT_UseType1Charmap(FXFT_Face face)
{
if (FXFT_Get_Face_CharmapCount(face) == 0) {
- return FALSE;
+ return false;
}
if (FXFT_Get_Face_CharmapCount(face) == 1 &&
FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == FXFT_ENCODING_UNICODE) {
- return FALSE;
+ return false;
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == FXFT_ENCODING_UNICODE) {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[1]);
} else {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
}
- return TRUE;
+ return true;
}
extern FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -1112,21 +1112,21 @@ void CPDF_Type1Font::LoadGlyphMap()
return;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- FX_BOOL bCoreText = TRUE;
+ bool bCoreText = true;
CQuartz2D & quartz2d = ((CApplePlatform *) CFX_GEModule::Get()->GetPlatformData())->_quartz2d;
if (!m_Font.m_pPlatformFont) {
if (m_Font.GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
- bCoreText = FALSE;
+ bCoreText = false;
}
m_Font.m_pPlatformFont = quartz2d.CreateFont(m_Font.m_pFontData, m_Font.m_dwSize);
if (NULL == m_Font.m_pPlatformFont) {
- bCoreText = FALSE;
+ bCoreText = false;
}
}
#endif
if (!IsEmbedded() && (m_Base14Font < 12) && m_Font.IsTTFont()) {
if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) {
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
for (int charcode = 0; charcode < 256; charcode ++) {
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
for (int j = 0; j < 4; j ++) {
@@ -1143,7 +1143,7 @@ void CPDF_Type1Font::LoadGlyphMap()
}
#endif
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
break;
}
}
@@ -1237,9 +1237,9 @@ void CPDF_Type1Font::LoadGlyphMap()
}
return;
}
- FX_BOOL bUnicode = FALSE;
+ bool bUnicode = false;
if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
- bUnicode = TRUE;
+ bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode ++) {
const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
@@ -1315,9 +1315,9 @@ void CPDF_Type1Font::LoadGlyphMap()
#endif
return;
}
- FX_BOOL bUnicode = FALSE;
+ bool bUnicode = false;
if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
- bUnicode = TRUE;
+ bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode ++) {
const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
@@ -1363,7 +1363,7 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding)
m_Unicodes[i] = pSrc[i];
}
}
-FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const
+bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const
{
return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == 0;
}
@@ -1372,10 +1372,10 @@ CPDF_Object* CPDF_FontEncoding::Realize()
int predefined = 0;
for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; cs ++) {
const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(cs);
- FX_BOOL match = TRUE;
+ bool match = true;
for (int i = 0; i < 256; ++i) {
if (m_Unicodes[i] != pSrc[i]) {
- match = FALSE;
+ match = false;
break;
}
}
@@ -1413,7 +1413,7 @@ CPDF_Object* CPDF_FontEncoding::Realize()
CPDF_TrueTypeFont::CPDF_TrueTypeFont() : CPDF_SimpleFont(PDFFONT_TRUETYPE)
{
}
-FX_BOOL CPDF_TrueTypeFont::_Load()
+bool CPDF_TrueTypeFont::_Load()
{
return LoadCommon();
}
@@ -1426,14 +1426,14 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
if (m_pFontFile && m_Font.m_Face->num_charmaps > 0
&& (baseEncoding == PDFFONT_ENCODING_MACROMAN || baseEncoding == PDFFONT_ENCODING_WINANSI)
&& (m_Flags & PDFFONT_SYMBOLIC)) {
- FX_BOOL bSupportWin = FALSE;
- FX_BOOL bSupportMac = FALSE;
+ bool bSupportWin = false;
+ bool bSupportMac = false;
for (int i = 0; i < FXFT_Get_Face_CharmapCount(m_Font.m_Face); i++) {
int platform_id = FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(m_Font.m_Face)[i]);
if (platform_id == 0 || platform_id == 3) {
- bSupportWin = TRUE;
+ bSupportWin = true;
} else if (platform_id == 0 || platform_id == 1) {
- bSupportMac = TRUE;
+ bSupportMac = true;
}
}
if (baseEncoding == PDFFONT_ENCODING_WINANSI && !bSupportWin) {
@@ -1459,8 +1459,8 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
return;
}
- FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
- FX_BOOL bMacRoman = FALSE, bMSSymbol = FALSE;
+ bool bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
+ bool bMacRoman = false, bMSSymbol = false;
if (!bMSUnicode) {
if (m_Flags & PDFFONT_NONSYMBOLIC) {
bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
@@ -1470,7 +1470,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.m_Face, 1, 0);
}
}
- FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
+ bool bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
for (int charcode = 0; charcode < 256; charcode ++) {
const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode);
if (name == NULL) {
@@ -1523,13 +1523,13 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) {
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
for (int charcode = 0; charcode < 256; charcode ++) {
for (int j = 0; j < 4; j ++) {
FX_WORD unicode = prefix[j] * 256 + charcode;
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode);
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
break;
}
}
@@ -1552,12 +1552,12 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
}
if (FT_UseTTCharmap(m_Font.m_Face, 1, 0)) {
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
for (int charcode = 0; charcode < 256; charcode ++) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode);
m_Encoding.m_Unicodes[charcode] = FT_UnicodeFromCharCode(FXFT_ENCODING_APPLE_ROMAN, charcode);
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
}
}
if (m_pFontFile || bGotOne) {
@@ -1565,7 +1565,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
}
if (FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE) == 0) {
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding);
for (int charcode = 0; charcode < 256; charcode ++) {
if (m_pFontFile == NULL) {
@@ -1580,7 +1580,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, m_Encoding.m_Unicodes[charcode]);
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
}
}
if (bGotOne) {
@@ -1614,7 +1614,7 @@ CPDF_Type3Font::~CPDF_Type3Font()
delete (CPDF_Type3Char*)key;
}
}
-FX_BOOL CPDF_Type3Font::_Load()
+bool CPDF_Type3Font::_Load()
{
m_pFontResources = m_pFontDict->GetDict(FX_BSTRC("Resources"));
CPDF_Array* pMatrix = m_pFontDict->GetArray(FX_BSTRC("FontMatrix"));
@@ -1648,7 +1648,7 @@ FX_BOOL CPDF_Type3Font::_Load()
m_pCharProcs = m_pFontDict->GetDict(FX_BSTRC("CharProcs"));
CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
if (pEncoding) {
- LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE);
+ LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, false, false);
if (m_pCharNames) {
for (int i = 0; i < 256; i ++) {
m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]);
@@ -1658,7 +1658,7 @@ FX_BOOL CPDF_Type3Font::_Load()
}
}
}
- return TRUE;
+ return true;
}
void CPDF_Type3Font::CheckType3FontMetrics()
{
@@ -1736,8 +1736,8 @@ CPDF_Type3Char::CPDF_Type3Char()
{
m_pForm = NULL;
m_pBitmap = NULL;
- m_bPageRequired = FALSE;
- m_bColored = FALSE;
+ m_bPageRequired = false;
+ m_bColored = false;
}
CPDF_Type3Char::~CPDF_Type3Char()
{
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index f70b9ecfc4..8f95e59dee 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -13,18 +13,18 @@
#include "font_int.h"
extern short TT2PDF(int m, FXFT_Face face);
-extern FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id);
+extern bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id);
CPDF_CMapManager::CPDF_CMapManager()
{
- m_bPrompted = FALSE;
+ m_bPrompted = false;
FXSYS_memset(m_CID2UnicodeMaps, 0, sizeof m_CID2UnicodeMaps);
}
CPDF_CMapManager::~CPDF_CMapManager()
{
- DropAll(FALSE);
+ DropAll(false);
}
-CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK)
+CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK)
{
CPDF_CMap* pCMap;
if (m_CMaps.Lookup(name, (void*&)pCMap)) {
@@ -37,7 +37,7 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BO
m_CMaps.SetAt(name, pCMap);
return pCMap;
}
-CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK)
+CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK)
{
CPDF_CMap* pCMap = new CPDF_CMap;
const FX_CHAR* pname = name;
@@ -59,9 +59,9 @@ int _CharsetFromOrdering(const CFX_ByteString& Ordering)
}
void CPDF_CMapManager::ReloadAll()
{
- DropAll(TRUE);
+ DropAll(true);
}
-void CPDF_CMapManager::DropAll(FX_BOOL bReload)
+void CPDF_CMapManager::DropAll(bool bReload)
{
FX_POSITION pos = m_CMaps.GetStartPosition();
while (pos) {
@@ -72,7 +72,7 @@ void CPDF_CMapManager::DropAll(FX_BOOL bReload)
continue;
}
if (bReload) {
- pCMap->LoadPredefined(this, name, FALSE);
+ pCMap->LoadPredefined(this, name, false);
} else {
delete pCMap;
}
@@ -83,20 +83,20 @@ void CPDF_CMapManager::DropAll(FX_BOOL bReload)
continue;
}
if (bReload) {
- pMap->Load(this, i, FALSE);
+ pMap->Load(this, i, false);
} else {
delete pMap;
}
}
}
-CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(int charset, FX_BOOL bPromptCJK)
+CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(int charset, bool bPromptCJK)
{
if (m_CID2UnicodeMaps[charset] == NULL) {
m_CID2UnicodeMaps[charset] = LoadCID2UnicodeMap(charset, bPromptCJK);
}
return m_CID2UnicodeMaps[charset];
}
-CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(int charset, FX_BOOL bPromptCJK)
+CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(int charset, bool bPromptCJK)
{
CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap();
if (!pMap->Initialize()) {
@@ -112,13 +112,13 @@ CPDF_CMapParser::CPDF_CMapParser()
m_Status = 0;
m_CodeSeq = 0;
}
-FX_BOOL CPDF_CMapParser::Initialize(CPDF_CMap* pCMap)
+bool CPDF_CMapParser::Initialize(CPDF_CMap* pCMap)
{
m_pCMap = pCMap;
m_Status = 0;
m_CodeSeq = 0;
m_AddMaps.EstimateSize(0, 10240);
- return TRUE;
+ return true;
}
static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word)
{
@@ -147,10 +147,10 @@ static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word)
}
return num;
}
-static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC& first, const CFX_ByteStringC& second)
+static bool _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC& first, const CFX_ByteStringC& second)
{
if (first.GetLength() == 0 || first.GetAt(0) != '<') {
- return FALSE;
+ return false;
}
int i;
for (i = 1; i < first.GetLength(); i ++)
@@ -159,7 +159,7 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC&
}
range.m_CharSize = (i - 1) / 2;
if (range.m_CharSize > 4) {
- return FALSE;
+ return false;
}
for (i = 0; i < range.m_CharSize; i ++) {
uint8_t digit1 = first.GetAt(i * 2 + 1);
@@ -176,7 +176,7 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC&
byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10));
range.m_Upper[i] = byte;
}
- return TRUE;
+ return true;
}
static CFX_ByteString CMap_GetString(const CFX_ByteStringC& word)
{
@@ -282,7 +282,7 @@ CPDF_CMap::CPDF_CMap()
m_Coding = CIDCODING_UNKNOWN;
m_CodingScheme = TwoBytes;
m_bVertical = 0;
- m_bLoaded = FALSE;
+ m_bLoaded = false;
m_pMapping = NULL;
m_pLeadingBytes = NULL;
m_pAddMapping = NULL;
@@ -346,14 +346,14 @@ const CPDF_PredefinedCMap g_PredefinedCMaps[] = {
};
extern void FPDFAPI_FindEmbeddedCMap(const char* name, int charset, int coding, const FXCMAP_CMap*& pMap);
extern FX_WORD FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode);
-FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, FX_BOOL bPromptCJK)
+bool CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, bool bPromptCJK)
{
m_PredefinedCMap = pName;
if (m_PredefinedCMap == FX_BSTRC("Identity-H") || m_PredefinedCMap == FX_BSTRC("Identity-V")) {
m_Coding = CIDCODING_CID;
m_bVertical = pName[9] == 'V';
- m_bLoaded = TRUE;
- return TRUE;
+ m_bLoaded = true;
+ return true;
}
CFX_ByteString cmapid = m_PredefinedCMap;
m_bVertical = cmapid.Right(1) == FX_BSTRC("V");
@@ -363,7 +363,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName,
int index = 0;
while (1) {
if (g_PredefinedCMaps[index].m_pName == NULL) {
- return FALSE;
+ return false;
}
if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[index].m_pName)) {
break;
@@ -384,10 +384,10 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName,
}
FPDFAPI_FindEmbeddedCMap(pName, m_Charset, m_Coding, m_pEmbedMap);
if (m_pEmbedMap) {
- m_bLoaded = TRUE;
- return TRUE;
+ m_bLoaded = true;
+ return true;
}
- return FALSE;
+ return false;
}
extern "C" {
static int compare_dword(const void* data1, const void* data2)
@@ -395,7 +395,7 @@ extern "C" {
return (*(FX_DWORD*)data1) - (*(FX_DWORD*)data2);
}
};
-FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size)
+bool CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size)
{
m_pMapping = FX_Alloc(FX_WORD, 65536);
CPDF_CMapParser parser;
@@ -414,7 +414,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size)
FXSYS_memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m_AddMaps.GetSize());
FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compare_dword);
}
- return TRUE;
+ return true;
}
extern "C" {
static int compareCID(const void* key, const void* element)
@@ -668,11 +668,11 @@ CPDF_CID2UnicodeMap::CPDF_CID2UnicodeMap()
CPDF_CID2UnicodeMap::~CPDF_CID2UnicodeMap()
{
}
-FX_BOOL CPDF_CID2UnicodeMap::Initialize()
+bool CPDF_CID2UnicodeMap::Initialize()
{
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CID2UnicodeMap::IsLoaded()
+bool CPDF_CID2UnicodeMap::IsLoaded()
{
return m_EmbeddedCount != 0;
}
@@ -687,7 +687,7 @@ FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(FX_WORD CID)
return 0;
}
void FPDFAPI_LoadCID2UnicodeMap(int charset, const FX_WORD*& pMap, FX_DWORD& count);
-void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, int charset, FX_BOOL bPromptCJK)
+void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, int charset, bool bPromptCJK)
{
m_Charset = charset;
FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount);
@@ -700,8 +700,8 @@ CPDF_CIDFont::CPDF_CIDFont() : CPDF_Font(PDFFONT_CIDFONT)
m_pCID2UnicodeMap = NULL;
m_pAnsiWidths = NULL;
m_pCIDToGIDMap = NULL;
- m_bCIDIsGID = FALSE;
- m_bAdobeCourierStd = FALSE;
+ m_bCIDIsGID = false;
+ m_bAdobeCourierStd = false;
m_pTTGSUBTable = NULL;
FXSYS_memset(m_CharBBox, 0xff, 256 * sizeof(FX_SMALL_RECT));
}
@@ -721,9 +721,9 @@ FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const
}
return m_pCMap->CIDFromCharCode(charcode);
}
-FX_BOOL CPDF_CIDFont::IsVertWriting() const
+bool CPDF_CIDFont::IsVertWriting() const
{
- return m_pCMap ? m_pCMap->IsVertWriting() : FALSE;
+ return m_pCMap ? m_pCMap->IsVertWriting() : false;
}
extern FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, FX_WORD cid);
static FX_DWORD _EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, int charset, FX_WCHAR unicode)
@@ -873,27 +873,27 @@ static void FT_UseCIDCharmap(FXFT_Face face, int coding)
FXFT_Set_Charmap(face, *FXFT_Get_Face_Charmaps(face));
}
}
-FX_BOOL CPDF_CIDFont::_Load()
+bool CPDF_CIDFont::_Load()
{
if (m_pFontDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("TrueType")) {
return LoadGB2312();
}
CPDF_Array* pFonts = m_pFontDict->GetArray(FX_BSTRC("DescendantFonts"));
if (pFonts == NULL) {
- return FALSE;
+ return false;
}
if (pFonts->GetCount() != 1) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pCIDFontDict = pFonts->GetDict(0);
if (pCIDFontDict == NULL) {
- return FALSE;
+ return false;
}
m_BaseFont = pCIDFontDict->GetString(FX_BSTRC("BaseFont"));
if ((m_BaseFont.Compare("CourierStd") == 0 || m_BaseFont.Compare("CourierStd-Bold") == 0
|| m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || m_BaseFont.Compare("CourierStd-Oblique") == 0)
&& !IsEmbedded()) {
- m_bAdobeCourierStd = TRUE;
+ m_bAdobeCourierStd = true;
}
CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict(FX_BSTRC("FontDescriptor"));
if (pFontDesc) {
@@ -901,12 +901,12 @@ FX_BOOL CPDF_CIDFont::_Load()
}
CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
if (pEncoding == NULL) {
- return FALSE;
+ return false;
}
CFX_ByteString subtype = pCIDFontDict->GetString(FX_BSTRC("Subtype"));
- m_bType1 = FALSE;
+ m_bType1 = false;
if (subtype == FX_BSTRC("CIDFontType0")) {
- m_bType1 = TRUE;
+ m_bType1 = true;
}
if (pEncoding->GetType() == PDFOBJ_NAME) {
CFX_ByteString cmap = pEncoding->GetString();
@@ -916,13 +916,13 @@ FX_BOOL CPDF_CIDFont::_Load()
m_pAllocatedCMap = m_pCMap = new CPDF_CMap;
CPDF_Stream* pStream = (CPDF_Stream*)pEncoding;
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
} else {
- return FALSE;
+ return false;
}
if (m_pCMap == NULL) {
- return FALSE;
+ return false;
}
m_Charset = m_pCMap->m_Charset;
if (m_Charset == CIDSET_UNKNOWN) {
@@ -955,14 +955,14 @@ FX_BOOL CPDF_CIDFont::_Load()
if (pmap) {
if (pmap->GetType() == PDFOBJ_STREAM) {
m_pCIDToGIDMap = new CPDF_StreamAcc;
- m_pCIDToGIDMap->LoadAllData((CPDF_Stream*)pmap, FALSE);
+ m_pCIDToGIDMap->LoadAllData((CPDF_Stream*)pmap, false);
} else if (pmap->GetString() == FX_BSTRC("Identity")) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pFontFile) {
- m_bCIDIsGID = TRUE;
+ m_bCIDIsGID = true;
}
#else
- m_bCIDIsGID = TRUE;
+ m_bCIDIsGID = true;
#endif
}
}
@@ -983,7 +983,7 @@ FX_BOOL CPDF_CIDFont::_Load()
m_DefaultW1 = -1000;
}
}
- return TRUE;
+ return true;
}
FX_FLOAT _CIDTransformToFloat(uint8_t ch)
{
@@ -1001,7 +1001,7 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level)
rect.top = m_CharBBox[charcode].Top;
return;
}
- FX_BOOL bVert = FALSE;
+ bool bVert = false;
int glyph_index = GlyphFromCharCode(charcode, &bVert);
if (m_Font.m_Face == NULL) {
rect = FX_RECT(0, 0, 0, 0);
@@ -1120,10 +1120,10 @@ void CPDF_CIDFont::GetVertOrigin(FX_WORD CID, short& vx, short &vy) const
vx = (short)dwWidth / 2;
vy = (short)m_DefaultVY;
}
-int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph)
+int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, bool *pVertGlyph)
{
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
int index = FXFT_Get_Char_Index(m_Font.m_Face, unicode );
if (unicode == 0x2502) {
@@ -1136,7 +1136,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph)
if (vindex) {
index = vindex;
if (pVertGlyph) {
- *pVertGlyph = TRUE;
+ *pVertGlyph = true;
}
}
return index;
@@ -1157,21 +1157,21 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph)
if (vindex) {
index = vindex;
if (pVertGlyph) {
- *pVertGlyph = TRUE;
+ *pVertGlyph = true;
}
}
}
return index;
}
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
return index;
}
-int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
+int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, bool *pVertGlyph)
{
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
if (m_pFontFile == NULL && m_pCIDToGIDMap == NULL) {
FX_WORD cid = CIDFromCharCode(charcode);
@@ -1206,8 +1206,8 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
}
charcode += 31;
int index = 0, iBaseEncoding;
- FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
- FX_BOOL bMacRoman = FALSE;
+ bool bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
+ bool bMacRoman = false;
if (!bMSUnicode) {
bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
}
@@ -1327,16 +1327,16 @@ int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const
{
return m_pCMap->AppendChar(str, charcode);
}
-FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const
+bool CPDF_CIDFont::IsUnicodeCompatible() const
{
if (!m_pCMap->IsLoaded() || m_pCID2UnicodeMap == NULL || !m_pCID2UnicodeMap->IsLoaded()) {
return m_pCMap->m_Coding != CIDCODING_UNKNOWN;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const
+bool CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const
{
- return TRUE;
+ return true;
}
void CPDF_CIDFont::LoadSubstFont()
{
@@ -1390,7 +1390,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, CFX_DWordArray& result,
}
}
}
-FX_BOOL CPDF_CIDFont::LoadGB2312()
+bool CPDF_CIDFont::LoadGB2312()
{
m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont"));
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
@@ -1398,10 +1398,10 @@ FX_BOOL CPDF_CIDFont::LoadGB2312()
LoadFontDescriptor(pFontDesc);
}
m_Charset = CIDSET_GB1;
- m_bType1 = FALSE;
+ m_bType1 = false;
m_pCMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetPredefinedCMap(
- FX_BSTRC("GBK-EUC-H"), FALSE);
- m_pCID2UnicodeMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(m_Charset, FALSE);
+ FX_BSTRC("GBK-EUC-H"), false);
+ m_pCID2UnicodeMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(m_Charset, false);
if (!IsEmbedded()) {
LoadSubstFont();
}
@@ -1411,7 +1411,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312()
for (int i = 32; i < 127; i ++) {
m_pAnsiWidths[i] = 500;
}
- return TRUE;
+ return true;
}
const struct _CIDTransform {
FX_WORD CID;
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
index a65359c1d4..980e16c43e 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
@@ -48,15 +48,15 @@ void CFX_GlyphMap::SetAt(int key, int value)
}
m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair));
}
-FX_BOOL CFX_GlyphMap::Lookup(int key, int &value)
+bool CFX_GlyphMap::Lookup(int key, int &value)
{
void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair),
sizeof(_IntPair), _CompareInt);
if (pResult == NULL) {
- return FALSE;
+ return false;
}
value = ((FX_DWORD*)pResult)[1];
- return TRUE;
+ return true;
}
bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub)
{
@@ -108,7 +108,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyph(TT_uint32_t glyphnum, TT_uint32_t *vglyp
}
}
}
- m_bFeautureMapLoad = TRUE;
+ m_bFeautureMapLoad = true;
}
FX_POSITION pos = m_featureMap.GetStartPosition();
while (pos) {
@@ -420,7 +420,7 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, TSingleSubstFormat2
rec->Substitute[i] = GetUInt16(sp);
}
}
-FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum)
+bool CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum)
{
return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum);
}
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index 1b18f82d6e..133667b4d8 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -17,15 +17,15 @@ public:
CFX_GlyphMap();
~CFX_GlyphMap();
void SetAt(int key, int value);
- FX_BOOL Lookup(int key, int &value);
+ bool Lookup(int key, int &value);
protected:
CFX_BinaryBuf m_Buffer;
};
class CFX_CTTGSUBTable
{
public:
- CFX_CTTGSUBTable(void): m_bFeautureMapLoad(FALSE), loaded(false) {};
- CFX_CTTGSUBTable(FT_Bytes gsub): m_bFeautureMapLoad(FALSE), loaded(false)
+ CFX_CTTGSUBTable(void): m_bFeautureMapLoad(false), loaded(false) {};
+ CFX_CTTGSUBTable(FT_Bytes gsub): m_bFeautureMapLoad(false), loaded(false)
{
LoadGSUBTable(gsub);
}
@@ -395,7 +395,7 @@ private:
return ret;
}
CFX_CMapDWordToDWord m_featureMap;
- FX_BOOL m_bFeautureMapLoad;
+ bool m_bFeautureMapLoad;
bool loaded;
struct tt_gsub_header header;
struct TScriptList ScriptList;
@@ -406,7 +406,7 @@ class CFX_GSUBTable final : public IFX_GSUBTable
{
public:
~CFX_GSUBTable() override {}
- virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override;
+ virtual bool GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override;
CFX_CTTGSUBTable m_GsubImp;
};
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index f404352318..729e96c312 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -44,7 +44,7 @@ void CPDF_PageObject::Copy(const CPDF_PageObject* pSrc)
m_Top = pSrc->m_Top;
m_Bottom = pSrc->m_Bottom;
}
-void CPDF_PageObject::AppendClipPath(CPDF_Path path, int type, FX_BOOL bAutoMerge)
+void CPDF_PageObject::AppendClipPath(CPDF_Path path, int type, bool bAutoMerge)
{
m_ClipPath.AppendPath(path, type, bAutoMerge);
}
@@ -353,7 +353,7 @@ FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const
{
FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -373,7 +373,7 @@ FX_FLOAT CPDF_TextObject::GetSpaceCharWidth() const
return GetCharWidth(charCode);
}
FX_FLOAT fontSize = m_TextState.GetFontSize() / 4000.0f;
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -388,7 +388,7 @@ FX_FLOAT CPDF_TextObject::GetSpaceCharWidth() const
void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const
{
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -441,7 +441,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
FX_FLOAT min_y = 10000 * 1.0f;
FX_FLOAT max_y = -10000 * 1.0f;
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -570,7 +570,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const
{
CPDF_Font* pFont = m_TextState.GetFont();
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -720,7 +720,7 @@ void CPDF_FormObject::CalcBoundingBox()
m_Right = form_rect.right;
m_Top = form_rect.top;
}
-CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers)
+CPDF_PageObjects::CPDF_PageObjects(bool bReleaseMembers)
: m_pFormDict(nullptr),
m_pFormStream(nullptr),
m_pDocument(nullptr),
@@ -728,7 +728,7 @@ CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers)
m_pResources(nullptr),
m_Transparency(0),
m_ObjectList(128),
- m_bBackgroundAlphaNeeded(FALSE),
+ m_bBackgroundAlphaNeeded(false),
m_bReleaseMembers(bReleaseMembers),
m_pParser(nullptr),
m_ParseState(CONTENT_NOT_PARSED)
@@ -856,7 +856,7 @@ CPDF_Page::CPDF_Page()
{
m_pPageRender = NULL;
}
-void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BOOL bPageCache)
+void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, bool bPageCache)
{
m_pDocument = (CPDF_Document*)pDocument;
m_pFormDict = pPageDict;
@@ -923,7 +923,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BO
m_Transparency = PDFTRANS_ISOLATED;
LoadTransInfo();
}
-void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
+void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, bool bReParse)
{
if (bReParse) {
ClearCacheObjects();
@@ -935,7 +935,7 @@ void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
m_pParser->Start(this, pOptions);
m_ParseState = CONTENT_PARSING;
}
-void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
+void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, bool bReParse)
{
StartParse(pOptions, bReParse);
ContinueParse(NULL);
@@ -1068,8 +1068,8 @@ void CPDF_Page::GetDisplayMatrix(CFX_AffineMatrix& matrix, int xPos, int yPos,
}
CPDF_ParseOptions::CPDF_ParseOptions()
{
- m_bTextOnly = FALSE;
- m_bMarkedContent = TRUE;
- m_bSeparateForm = TRUE;
- m_bDecodeInlineImage = FALSE;
+ m_bTextOnly = false;
+ m_bMarkedContent = true;
+ m_bSeparateForm = true;
+ m_bDecodeInlineImage = false;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 198054ef7e..b1c8837326 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -40,7 +40,7 @@ CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family)
: CPDF_ColorSpace(pDoc, family, ComponentsForFamily(family)) {
}
-FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_Family == PDFCS_DEVICERGB) {
R = pBuf[0];
@@ -81,56 +81,56 @@ FX_BOOL CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT
} else {
ASSERT(m_Family == PDFCS_PATTERN);
R = G = B = 0;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
+bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
{
if (m_Family != PDFCS_DEVICECMYK) {
- return FALSE;
+ return false;
}
c = pBuf[0];
m = pBuf[1];
y = pBuf[2];
k = pBuf[3];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
if (m_Family == PDFCS_DEVICERGB) {
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
- return TRUE;
+ return true;
}
if (m_Family == PDFCS_DEVICEGRAY) {
if (R == G && R == B) {
*pBuf = R;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (m_Family == PDFCS_DEVICECMYK) {
sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
+bool CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
{
if (m_Family == PDFCS_DEVICERGB) {
AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]);
- return TRUE;
+ return true;
}
if (m_Family == PDFCS_DEVICECMYK) {
pBuf[0] = c;
pBuf[1] = m;
pBuf[2] = y;
pBuf[3] = k;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels)
{
@@ -149,7 +149,7 @@ static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels)
pSrcBuf += 3;
}
}
-void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
if (bTransMask && m_Family == PDFCS_DEVICECMYK) {
for (int i = 0; i < pixels; i ++) {
@@ -274,11 +274,11 @@ public:
explicit CPDF_CalGray(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_CALGRAY, 1) {
}
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const override;
+ int image_height, bool bTransMask = false) const override;
private:
FX_FLOAT m_WhitePoint[3];
@@ -286,7 +286,7 @@ private:
FX_FLOAT m_Gamma;
};
-FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Dictionary* pDict = pArray->GetDict(1);
CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
@@ -302,22 +302,22 @@ FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
if (m_Gamma == 0) {
m_Gamma = 1.0f;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_CalGray::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
R = G = B = *pBuf;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
if (R == G && R == B) {
*pBuf = R;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
for (int i = 0; i < pixels; i ++) {
*pDestBuf ++ = pSrcBuf[i];
@@ -331,24 +331,24 @@ public:
explicit CPDF_CalRGB(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_CALRGB, 3) {
}
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const override;
+ int image_height, bool bTransMask = false) const override;
FX_FLOAT m_WhitePoint[3];
FX_FLOAT m_BlackPoint[3];
FX_FLOAT m_Gamma[3];
FX_FLOAT m_Matrix[9];
- FX_BOOL m_bGamma;
- FX_BOOL m_bMatrix;
+ bool m_bGamma;
+ bool m_bMatrix;
};
-FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Dictionary* pDict = pArray->GetDict(1);
if (!pDict)
- return FALSE;
+ return false;
CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
int i;
@@ -361,25 +361,25 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
}
pParam = pDict->GetArray(FX_BSTRC("Gamma"));
if (pParam) {
- m_bGamma = TRUE;
+ m_bGamma = true;
for (i = 0; i < 3; i ++) {
m_Gamma[i] = pParam->GetNumber(i);
}
} else {
- m_bGamma = FALSE;
+ m_bGamma = false;
}
pParam = pDict->GetArray(FX_BSTRC("Matrix"));
if (pParam) {
- m_bMatrix = TRUE;
+ m_bMatrix = true;
for (i = 0; i < 9; i ++) {
m_Matrix[i] = pParam->GetNumber(i);
}
} else {
- m_bMatrix = FALSE;
+ m_bMatrix = false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
FX_FLOAT A_ = pBuf[0];
FX_FLOAT B_ = pBuf[1];
@@ -400,16 +400,16 @@ FX_BOOL CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT&
Z = C_;
}
XYZ_to_sRGB_WhitePoint(X, Y, Z, R, G, B, m_WhitePoint[0], m_WhitePoint[1], m_WhitePoint[2]);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
- return TRUE;
+ return true;
}
-void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
if (bTransMask) {
FX_FLOAT Cal[3];
@@ -435,21 +435,21 @@ public:
: CPDF_ColorSpace(pDoc, PDFCS_LAB, 3) {
}
void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const;
+ int image_height, bool bTransMask = false) const;
FX_FLOAT m_WhitePoint[3];
FX_FLOAT m_BlackPoint[3];
FX_FLOAT m_Ranges[4];
};
-FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Dictionary* pDict = pArray->GetDict(1);
if (!pDict) {
- return FALSE;
+ return false;
}
CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
int i;
@@ -465,7 +465,7 @@ FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
for (i = 0; i < 4; i ++) {
m_Ranges[i] = pParam ? pParam->GetNumber(i) : def_ranges[i];
}
- return TRUE;
+ return true;
}
void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const
{
@@ -484,7 +484,7 @@ void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min,
}
}
}
-FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
FX_FLOAT Lstar = pBuf[0];
FX_FLOAT astar = pBuf[1];
@@ -509,13 +509,13 @@ FX_BOOL CPDF_LabCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B
Z = 1.0889f * N * N * N;
}
XYZ_to_sRGB(X, Y, Z, R, G, B);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
- return FALSE;
+ return false;
}
-void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
for (int i = 0; i < pixels; i ++) {
FX_FLOAT lab[3];
@@ -532,12 +532,12 @@ void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, i
}
}
CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize):
- m_bsRGB(FALSE),
+ m_bsRGB(false),
m_pTransform(NULL),
m_nSrcComponents(0)
{
if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) {
- m_bsRGB = TRUE;
+ m_bsRGB = true;
m_nSrcComponents = 3;
}
else if (CPDF_ModuleMgr::Get()->GetIccModule()) {
@@ -559,23 +559,23 @@ public:
m_pProfile(nullptr),
m_pCache(nullptr),
m_pRanges(nullptr),
- m_bOwn(FALSE) {
+ m_bOwn(false) {
}
~CPDF_ICCBasedCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
- FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const override;
+ bool v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const override;
+ void EnableStdConversion(bool bEnabled) override;
void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width,
- int image_height, FX_BOOL bTransMask = FALSE) const override;
+ int image_height, bool bTransMask = false) const override;
CPDF_ColorSpace* m_pAlterCS;
CPDF_IccProfile* m_pProfile;
uint8_t* m_pCache;
FX_FLOAT* m_pRanges;
- FX_BOOL m_bOwn;
+ bool m_bOwn;
};
CPDF_ICCBasedCS::~CPDF_ICCBasedCS()
@@ -594,15 +594,15 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS()
}
}
-FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Stream* pStream = pArray->GetStream(1);
if (pStream == NULL) {
- return FALSE;
+ return false;
}
m_pProfile = pDoc->LoadIccProfile(pStream);
if (!m_pProfile) {
- return FALSE;
+ return false;
}
m_nComponents = m_pProfile->GetComponents(); //Try using the nComponents from ICC profile
CPDF_Dictionary* pDict = pStream->GetDict();
@@ -615,13 +615,13 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
if (pAlterCS->CountComponents() > 0) { // Use Alternative colorspace
m_nComponents = pAlterCS->CountComponents();
m_pAlterCS = pAlterCS;
- m_bOwn = TRUE;
+ m_bOwn = true;
}
else { // No valid alternative colorspace
pAlterCS->ReleaseCS();
int32_t nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0;
if (nDictComponents != 1 && nDictComponents != 3 && nDictComponents != 4) {
- return FALSE;
+ return false;
}
m_nComponents = nDictComponents;
}
@@ -633,7 +633,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
}
else {
m_pAlterCS = pAlterCS;
- m_bOwn = TRUE;
+ m_bOwn = true;
}
}
}
@@ -661,15 +661,15 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_pRanges[i] = 0;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pProfile && m_pProfile->m_bsRGB) {
R = pBuf[0];
G = pBuf[1];
B = pBuf[2];
- return TRUE;
+ return true;
}
ICodec_IccModule *pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
if (m_pProfile->m_pTransform == NULL || pIccModule == NULL) {
@@ -678,7 +678,7 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLO
} else {
R = G = B = 0.0f;
}
- return TRUE;
+ return true;
}
FX_FLOAT rgb[3];
pIccModule->SetComponents(m_nComponents);
@@ -686,31 +686,31 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLO
R = rgb[0];
G = rgb[1];
B = rgb[2];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
+bool CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
{
if (m_nComponents != 4) {
- return FALSE;
+ return false;
}
c = pBuf[0];
m = pBuf[1];
y = pBuf[2];
k = pBuf[3];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
+bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
{
- return FALSE;
+ return false;
}
-void CPDF_ICCBasedCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_ICCBasedCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAlterCS) {
m_pAlterCS->EnableStdConversion(bEnabled);
}
}
-void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, bool bTransMask) const
{
if (m_pProfile->m_bsRGB) {
ReverseRGB(pDestBuf, pSrcBuf, pixels);
@@ -765,10 +765,10 @@ public:
}
~CPDF_IndexedCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
CPDF_ColorSpace* GetBaseCS() const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pBaseCS;
CPDF_CountedColorSpace* m_pCountedBaseCS;
@@ -787,19 +787,19 @@ CPDF_IndexedCS::~CPDF_IndexedCS()
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
}
}
-FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
if (pArray->GetCount() < 4) {
- return FALSE;
+ return false;
}
CPDF_Object* pBaseObj = pArray->GetElementValue(1);
if (pBaseObj == m_pArray) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL);
if (m_pBaseCS == NULL) {
- return FALSE;
+ return false;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nBaseComponents = m_pBaseCS->CountComponents();
@@ -812,29 +812,29 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_MaxIndex = pArray->GetInteger(2);
CPDF_Object* pTableObj = pArray->GetElementValue(3);
if (pTableObj == NULL) {
- return FALSE;
+ return false;
}
if (pTableObj->GetType() == PDFOBJ_STRING) {
m_Table = ((CPDF_String*)pTableObj)->GetString();
} else if (pTableObj->GetType() == PDFOBJ_STREAM) {
CPDF_StreamAcc acc;
- acc.LoadAllData((CPDF_Stream*)pTableObj, FALSE);
+ acc.LoadAllData((CPDF_Stream*)pTableObj, false);
m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
int index = (int32_t)(*pBuf);
if (index < 0 || index > m_MaxIndex) {
- return FALSE;
+ return false;
}
if (m_nBaseComponents) {
if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents ||
(index + 1)*m_nBaseComponents > (int)m_Table.GetLength()) {
R = G = B = 0;
- return FALSE;
+ return false;
}
}
CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents);
@@ -844,13 +844,13 @@ FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA
comps[i] = m_pCompMinMax[i * 2] + m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255;
}
m_pBaseCS->GetRGB(comps, R, G, B);
- return TRUE;
+ return true;
}
CPDF_ColorSpace*CPDF_IndexedCS::GetBaseCS() const
{
return m_pBaseCS;
}
-void CPDF_IndexedCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_IndexedCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pBaseCS) {
@@ -871,39 +871,39 @@ CPDF_PatternCS::~CPDF_PatternCS()
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
}
}
-FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Object* pBaseCS = pArray->GetElementValue(1);
if (pBaseCS == m_pArray) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL);
if (m_pBaseCS) {
if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
- return FALSE;
+ return false;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nComponents = m_pBaseCS->CountComponents() + 1;
if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
- return FALSE;
+ return false;
}
} else {
m_nComponents = 1;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pBaseCS) {
ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN);
PatternValue* pvalue = (PatternValue*)pBuf;
if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) {
- return TRUE;
+ return true;
}
}
R = G = B = 0.75f;
- return FALSE;
+ return false;
}
CPDF_ColorSpace* CPDF_PatternCS::GetBaseCS() const
{
@@ -919,9 +919,9 @@ public:
}
~CPDF_SeparationCS() override;
void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pAltCS;
CPDF_Function* m_pFunc;
@@ -940,7 +940,7 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOA
min = 0;
max = 1.0f;
}
-FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CFX_ByteString name = pArray->GetString(1);
if (name == FX_BSTRC("None")) {
@@ -949,11 +949,11 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_Type = Colorant;
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (pAltCS == m_pArray) {
- return FALSE;
+ return false;
}
m_pAltCS = Load(pDoc, pAltCS);
if (!m_pAltCS) {
- return FALSE;
+ return false;
}
CPDF_Object* pFuncObj = pArray->GetElementValue(3);
if (pFuncObj && pFuncObj->GetType() != PDFOBJ_NAME) {
@@ -964,16 +964,16 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
m_pFunc = NULL;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_Type == None) {
- return FALSE;
+ return false;
}
if (m_pFunc == NULL) {
if (m_pAltCS == NULL) {
- return FALSE;
+ return false;
}
int nComps = m_pAltCS->CountComponents();
CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps);
@@ -981,22 +981,22 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_F
results[i] = *pBuf;
}
m_pAltCS->GetRGB(results, R, G, B);
- return TRUE;
+ return true;
}
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
m_pFunc->Call(pBuf, 1, results, nresults);
if (nresults == 0) {
- return FALSE;
+ return false;
}
if (m_pAltCS) {
m_pAltCS->GetRGB(results, R, G, B);
- return TRUE;
+ return true;
}
R = G = B = 0;
- return FALSE;
+ return false;
}
-void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_SeparationCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAltCS) {
@@ -1013,9 +1013,9 @@ public:
}
~CPDF_DeviceNCS() override;
void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
- void EnableStdConversion(FX_BOOL bEnabled) override;
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
+ void EnableStdConversion(bool bEnabled) override;
CPDF_ColorSpace* m_pAltCS;
CPDF_Function* m_pFunc;
@@ -1033,45 +1033,45 @@ void CPDF_DeviceNCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT&
min = 0;
max = 1.0f;
}
-FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
+bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CPDF_Object* pObj = pArray->GetElementValue(1);
if (!pObj) {
- return FALSE;
+ return false;
}
if (pObj->GetType() != PDFOBJ_ARRAY) {
- return FALSE;
+ return false;
}
m_nComponents = ((CPDF_Array*)pObj)->GetCount();
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (!pAltCS || pAltCS == m_pArray) {
- return FALSE;
+ return false;
}
m_pAltCS = Load(pDoc, pAltCS);
m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3));
if (m_pAltCS == NULL || m_pFunc == NULL) {
- return FALSE;
+ return false;
}
if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
+bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pFunc == NULL) {
- return FALSE;
+ return false;
}
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
m_pFunc->Call(pBuf, m_nComponents, results, nresults);
if (nresults == 0) {
- return FALSE;
+ return false;
}
m_pAltCS->GetRGB(results, R, G, B);
- return TRUE;
+ return true;
}
-void CPDF_DeviceNCS::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_DeviceNCS::EnableStdConversion(bool bEnabled)
{
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (m_pAltCS) {
@@ -1197,33 +1197,33 @@ FX_FLOAT* CPDF_ColorSpace::CreateBuf()
uint8_t* pBuf = FX_Alloc(uint8_t, size);
return (FX_FLOAT*)pBuf;
}
-FX_BOOL CPDF_ColorSpace::sRGB() const
+bool CPDF_ColorSpace::sRGB() const
{
if (m_Family == PDFCS_DEVICERGB) {
- return TRUE;
+ return true;
}
if (m_Family != PDFCS_ICCBASED) {
- return FALSE;
+ return false;
}
CPDF_ICCBasedCS* pCS = (CPDF_ICCBasedCS*)this;
return pCS->m_pProfile->m_bsRGB;
}
-FX_BOOL CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
+bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const
{
if (v_GetCMYK(pBuf, c, m, y, k)) {
- return TRUE;
+ return true;
}
FX_FLOAT R, G, B;
if (!GetRGB(pBuf, R, G, B)) {
- return FALSE;
+ return false;
}
sRGB_to_AdobeCMYK(R, G, B, c, m, y, k);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
+bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const
{
if (v_SetCMYK(pBuf, c, m, y, k)) {
- return TRUE;
+ return true;
}
FX_FLOAT R, G, B;
AdobeCMYK_to_sRGB(c, m, y, k, R, G, B);
@@ -1247,7 +1247,7 @@ int CPDF_ColorSpace::GetMaxIndex() const
CPDF_IndexedCS* pCS = (CPDF_IndexedCS*)this;
return pCS->m_MaxIndex;
}
-void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
+void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, bool bTransMask) const
{
CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents);
FX_FLOAT* src = srcbuf;
@@ -1265,7 +1265,7 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_b
*dest_buf ++ = (int32_t)(R * 255);
}
}
-void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled)
+void CPDF_ColorSpace::EnableStdConversion(bool bEnabled)
{
if (bEnabled) {
m_dwStdConversion ++;
@@ -1397,23 +1397,23 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc)
if (m_pCS->GetFamily() == PDFCS_PATTERN) {
PatternValue* pvalue = (PatternValue*)m_pBuffer;
if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) {
- pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()->GetPattern(pvalue->m_pPattern->m_pPatternObj, FALSE, &pvalue->m_pPattern->m_ParentMatrix);
+ pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()->GetPattern(pvalue->m_pPattern->m_pPatternObj, false, &pvalue->m_pPattern->m_ParentMatrix);
}
}
}
-FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const
+bool CPDF_Color::GetRGB(int& R, int& G, int& B) const
{
if (m_pCS == NULL || m_pBuffer == NULL) {
- return FALSE;
+ return false;
}
FX_FLOAT r=0.0f, g=0.0f, b=0.0f;
if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) {
- return FALSE;
+ return false;
}
R = (int32_t)(r * 255 + 0.5f);
G = (int32_t)(g * 255 + 0.5f);
B = (int32_t)(b * 255 + 0.5f);
- return TRUE;
+ return true;
}
CPDF_Pattern* CPDF_Color::GetPattern() const
{
@@ -1438,10 +1438,10 @@ FX_FLOAT* CPDF_Color::GetPatternColor() const
PatternValue* pvalue = (PatternValue*)m_pBuffer;
return pvalue->m_nComps ? pvalue->m_Comps : NULL;
}
-FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const
+bool CPDF_Color::IsEqual(const CPDF_Color& other) const
{
if (m_pCS != other.m_pCS || m_pCS == NULL) {
- return FALSE;
+ return false;
}
return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 05233a12a4..568863a89b 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -78,7 +78,7 @@ void CPDF_PageModule::ReleaseDoc(CPDF_Document* pDoc)
}
void CPDF_PageModule::ClearDoc(CPDF_Document* pDoc)
{
- pDoc->GetPageData()->Clear(FALSE);
+ pDoc->GetPageData()->Clear(false);
}
void CPDF_PageModule::NotifyCJKAvailable()
{
@@ -88,7 +88,7 @@ void CPDF_PageModule::NotifyCJKAvailable()
CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict)
{
ASSERT(pFontDict);
- return GetValidatePageData()->GetFont(pFontDict, FALSE);
+ return GetValidatePageData()->GetFont(pFontDict, false);
}
CPDF_StreamAcc* CPDF_Document::LoadFontFile(CPDF_Stream* pStream)
@@ -101,7 +101,7 @@ CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, CPDF_Diction
{
return GetValidatePageData()->GetColorSpace(pCSObj, pResources);
}
-CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix)
+CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* matrix)
{
return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix);
}
@@ -126,14 +126,14 @@ void CPDF_Document::RemoveColorSpaceFromPageData(CPDF_Object* pCSObj)
}
CPDF_DocPageData::CPDF_DocPageData(CPDF_Document* pPDFDoc)
: m_pPDFDoc(pPDFDoc),
- m_bForceClear(FALSE)
+ m_bForceClear(false)
{
}
CPDF_DocPageData::~CPDF_DocPageData()
{
- Clear(FALSE);
- Clear(TRUE);
+ Clear(false);
+ Clear(true);
for (auto& it : m_PatternMap)
delete it.second;
@@ -148,7 +148,7 @@ CPDF_DocPageData::~CPDF_DocPageData()
m_ColorSpaceMap.clear();
}
-void CPDF_DocPageData::Clear(FX_BOOL bForceRelease)
+void CPDF_DocPageData::Clear(bool bForceRelease)
{
m_bForceClear = bForceRelease;
@@ -235,7 +235,7 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease)
}
}
-CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly)
+CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, bool findOnly)
{
if (!pFontDict) {
return NULL;
@@ -432,7 +432,7 @@ void CPDF_DocPageData::ReleaseColorSpace(CPDF_Object* pColorSpace)
}
}
-CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix)
+CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* matrix)
{
if (!pPatternObj)
return nullptr;
@@ -455,7 +455,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bSh
if (type == 1) {
pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix);
} else if (type == 2) {
- pPattern = new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix);
+ pPattern = new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, false, matrix);
}
}
}
@@ -501,7 +501,7 @@ CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream)
}
CPDF_Image* pImage = new CPDF_Image(m_pPDFDoc);
- pImage->LoadImageF((CPDF_Stream*)pImageStream, FALSE);
+ pImage->LoadImageF((CPDF_Stream*)pImageStream, false);
CPDF_CountedImage* imageData = new CPDF_CountedImage(pImage);
m_ImageMap[dwImageObjNum] = imageData;
@@ -540,7 +540,7 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream)
}
CPDF_StreamAcc stream;
- stream.LoadAllData(pIccProfileStream, FALSE);
+ stream.LoadAllData(pIccProfileStream, false);
uint8_t digest[20];
CPDF_Stream* pCopiedStream = nullptr;
CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
@@ -590,14 +590,14 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream)
org_size = 0;
CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc;
- pFontFile->LoadAllData(pFontStream, FALSE, org_size);
+ pFontFile->LoadAllData(pFontStream, false, org_size);
CPDF_CountedStreamAcc* ftData = new CPDF_CountedStreamAcc(pFontFile);
m_FontFileMap[pFontStream] = ftData;
return ftData->AddRef();
}
-void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce)
+void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, bool bForce)
{
if (!pFontStream)
return;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index c961f8b20f..a92219d268 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -25,8 +25,8 @@ class CPDF_PSProc
{
public:
~CPDF_PSProc();
- FX_BOOL Parse(CPDF_SimpleParser& parser);
- FX_BOOL Execute(CPDF_PSEngine* pEngine);
+ bool Parse(CPDF_SimpleParser& parser);
+ bool Execute(CPDF_PSEngine* pEngine);
CFX_PtrArray m_Operators;
};
#define PSENGINE_STACKSIZE 100
@@ -35,12 +35,12 @@ class CPDF_PSEngine
public:
CPDF_PSEngine();
~CPDF_PSEngine();
- FX_BOOL Parse(const FX_CHAR* string, int size);
- FX_BOOL Execute()
+ bool Parse(const FX_CHAR* string, int size);
+ bool Execute()
{
return m_MainProc.Execute(this);
}
- FX_BOOL DoOperator(PDF_PSOP op);
+ bool DoOperator(PDF_PSOP op);
void Reset()
{
m_StackCount = 0;
@@ -73,7 +73,7 @@ CPDF_PSProc::~CPDF_PSProc()
}
}
}
-FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
+bool CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
{
int size = m_Operators.GetSize();
for (int i = 0; i < size; i ++) {
@@ -85,7 +85,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
i ++;
} else if (op == PSOP_IF) {
if (i < 2 || m_Operators[i - 2] != (void*)PSOP_PROC) {
- return FALSE;
+ return false;
}
if ((int)pEngine->Pop()) {
((CPDF_PSProc*)m_Operators[i - 1])->Execute(pEngine);
@@ -93,7 +93,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
} else if (op == PSOP_IFELSE) {
if (i < 4 || m_Operators[i - 2] != (void*)PSOP_PROC ||
m_Operators[i - 4] != (void*)PSOP_PROC) {
- return FALSE;
+ return false;
}
if ((int)pEngine->Pop()) {
((CPDF_PSProc*)m_Operators[i - 3])->Execute(pEngine);
@@ -104,7 +104,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine)
pEngine->DoOperator(op);
}
}
- return TRUE;
+ return true;
}
CPDF_PSEngine::CPDF_PSEngine()
{
@@ -145,31 +145,31 @@ const struct _PDF_PSOpName {
{"copy", PSOP_COPY}, {"index", PSOP_INDEX}, {"roll", PSOP_ROLL},
{NULL, PSOP_PROC}
};
-FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* string, int size)
+bool CPDF_PSEngine::Parse(const FX_CHAR* string, int size)
{
CPDF_SimpleParser parser((uint8_t*)string, size);
CFX_ByteStringC word = parser.GetWord();
if (word != FX_BSTRC("{")) {
- return FALSE;
+ return false;
}
return m_MainProc.Parse(parser);
}
-FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser)
+bool CPDF_PSProc::Parse(CPDF_SimpleParser& parser)
{
while (1) {
CFX_ByteStringC word = parser.GetWord();
if (word.IsEmpty()) {
- return FALSE;
+ return false;
}
if (word == FX_BSTRC("}")) {
- return TRUE;
+ return true;
}
if (word == FX_BSTRC("{")) {
CPDF_PSProc* pProc = new CPDF_PSProc;
m_Operators.Add((void*)PSOP_PROC);
m_Operators.Add(pProc);
if (!pProc->Parse(parser)) {
- return FALSE;
+ return false;
}
} else {
int i = 0;
@@ -190,7 +190,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser)
}
}
#define PI 3.1415926535897932384626433832795f
-FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op)
+bool CPDF_PSEngine::DoOperator(PDF_PSOP op)
{
int i1, i2;
FX_FLOAT d1, d2;
@@ -418,7 +418,7 @@ FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op)
default:
break;
}
- return TRUE;
+ return true;
}
static FX_FLOAT PDF_Interpolate(FX_FLOAT x, FX_FLOAT xmin, FX_FLOAT xmax, FX_FLOAT ymin, FX_FLOAT ymax)
{
@@ -445,8 +445,8 @@ class CPDF_SampledFunc : public CPDF_Function
public:
CPDF_SampledFunc();
virtual ~CPDF_SampledFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
SampleEncodeInfo* m_pEncodeInfo;
SampleDecodeInfo* m_pDecodeInfo;
FX_DWORD m_nBitsPerSample;
@@ -469,10 +469,10 @@ CPDF_SampledFunc::~CPDF_SampledFunc()
FX_Free(m_pDecodeInfo);
}
}
-FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
{
if (pObj->GetType() != PDFOBJ_STREAM) {
- return FALSE;
+ return false;
}
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_Dictionary* pDict = pStream->GetDict();
@@ -481,11 +481,11 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample"));
if (m_nBitsPerSample > 32) {
- return FALSE;
+ return false;
}
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
m_pSampleStream = new CPDF_StreamAcc;
- m_pSampleStream->LoadAllData(pStream, FALSE);
+ m_pSampleStream->LoadAllData(pStream, false);
m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs);
FX_SAFE_DWORD nTotalSampleBits = 1;
for (int i = 0; i < m_nInputs; i ++) {
@@ -514,7 +514,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
if (!nTotalSampleBytes.IsValid() ||
nTotalSampleBytes.ValueOrDie() == 0 ||
nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) {
- return FALSE;
+ return false;
}
m_pDecodeInfo = FX_Alloc(SampleDecodeInfo, m_nOutputs);
for (int i = 0; i < m_nOutputs; i ++) {
@@ -526,9 +526,9 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1];
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
+bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
{
int pos = 0;
CFX_FixedBufGrow<FX_FLOAT, 16> encoded_input_buf(m_nInputs);
@@ -555,21 +555,21 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
FX_SAFE_INT32 bits_to_output = m_nOutputs;
bits_to_output *= m_nBitsPerSample;
if (!bits_to_output.IsValid()) {
- return FALSE;
+ return false;
}
FX_SAFE_INT32 bitpos = pos;
bitpos *= bits_to_output.ValueOrDie();
if (!bitpos.IsValid()) {
- return FALSE;
+ return false;
}
FX_SAFE_INT32 range_check = bitpos;
range_check += bits_to_output.ValueOrDie();
if (!range_check.IsValid()) {
- return FALSE;
+ return false;
}
const uint8_t* pSampleData = m_pSampleStream->GetData();
if (!pSampleData) {
- return FALSE;
+ return false;
}
for (int j = 0; j < m_nOutputs; j ++) {
FX_DWORD sample = _GetBits32(pSampleData, bitpos.ValueOrDie() + j * m_nBitsPerSample, m_nBitsPerSample);
@@ -586,7 +586,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
bitpos2 += j;
bitpos2 *= m_nBitsPerSample;
if (!bitpos2.IsValid()) {
- return FALSE;
+ return false;
}
FX_DWORD sample1 = _GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample);
encoded += (encoded_input[i] - index[i]) * ((FX_FLOAT)sample1 - (FX_FLOAT)sample);
@@ -595,23 +595,23 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
results[j] = PDF_Interpolate(encoded, 0, (FX_FLOAT)m_SampleMax,
m_pDecodeInfo[j].decode_min, m_pDecodeInfo[j].decode_max);
}
- return TRUE;
+ return true;
}
class CPDF_PSFunc : public CPDF_Function
{
public:
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
CPDF_PSEngine m_PS;
};
-FX_BOOL CPDF_PSFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_PSFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
return m_PS.Parse((const FX_CHAR*)acc.GetData(), acc.GetSize());
}
-FX_BOOL CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
+bool CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
{
CPDF_PSEngine& PS = (CPDF_PSEngine&)m_PS;
PS.Reset();
@@ -621,20 +621,20 @@ FX_BOOL CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
}
PS.Execute();
if (PS.GetStackSize() < m_nOutputs) {
- return FALSE;
+ return false;
}
for (i = 0; i < m_nOutputs; i ++) {
results[m_nOutputs - i - 1] = PS.Pop();
}
- return TRUE;
+ return true;
}
class CPDF_ExpIntFunc : public CPDF_Function
{
public:
CPDF_ExpIntFunc();
virtual ~CPDF_ExpIntFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
FX_FLOAT m_Exponent;
FX_FLOAT* m_pBeginValues;
FX_FLOAT* m_pEndValues;
@@ -654,11 +654,11 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc()
FX_Free(m_pEndValues);
}
}
-FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict = pObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0"));
if (m_nOutputs == 0) {
@@ -677,27 +677,27 @@ FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
m_Exponent = pDict->GetFloat(FX_BSTRC("N"));
m_nOrigOutputs = m_nOutputs;
if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
- return FALSE;
+ return false;
}
m_nOutputs *= m_nInputs;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
+bool CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
{
for (int i = 0; i < m_nInputs; i ++)
for (int j = 0; j < m_nOrigOutputs; j ++) {
results[i * m_nOrigOutputs + j] = m_pBeginValues[j] + (FX_FLOAT)FXSYS_pow(inputs[i], m_Exponent) *
(m_pEndValues[j] - m_pBeginValues[j]);
}
- return TRUE;
+ return true;
}
class CPDF_StitchFunc : public CPDF_Function
{
public:
CPDF_StitchFunc();
virtual ~CPDF_StitchFunc();
- virtual FX_BOOL v_Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
+ virtual bool v_Init(CPDF_Object* pObj);
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
int m_nSubs;
CPDF_Function** m_pSubFunctions;
FX_FLOAT* m_pBounds;
@@ -724,19 +724,19 @@ CPDF_StitchFunc::~CPDF_StitchFunc()
FX_Free(m_pEncode);
}
}
-FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
+bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict = pObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions"));
if (pArray == NULL) {
- return FALSE;
+ return false;
}
m_nSubs = pArray->GetCount();
if (m_nSubs == 0) {
- return FALSE;
+ return false;
}
m_pSubFunctions = FX_Alloc(CPDF_Function*, m_nSubs);
m_nOutputs = 0;
@@ -744,11 +744,11 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
for (i = 0; i < m_nSubs; i ++) {
CPDF_Object* pSub = pArray->GetElementValue(i);
if (pSub == pObj) {
- return FALSE;
+ return false;
}
m_pSubFunctions[i] = CPDF_Function::Load(pSub);
if (m_pSubFunctions[i] == NULL) {
- return FALSE;
+ return false;
}
if (m_pSubFunctions[i]->CountOutputs() > m_nOutputs) {
m_nOutputs = m_pSubFunctions[i]->CountOutputs();
@@ -758,7 +758,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
m_pBounds[0] = m_pDomains[0];
pArray = pDict->GetArray(FX_BSTRC("Bounds"));
if (pArray == NULL) {
- return FALSE;
+ return false;
}
for (i = 0; i < m_nSubs - 1; i ++) {
m_pBounds[i + 1] = pArray->GetFloat(i);
@@ -767,14 +767,14 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj)
m_pEncode = FX_Alloc2D(FX_FLOAT, m_nSubs, 2);
pArray = pDict->GetArray(FX_BSTRC("Encode"));
if (pArray == NULL) {
- return FALSE;
+ return false;
}
for (i = 0; i < m_nSubs * 2; i ++) {
m_pEncode[i] = pArray->GetFloat(i);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const
+bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const
{
FX_FLOAT input = inputs[0];
int i;
@@ -783,12 +783,12 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const
break;
}
if (m_pSubFunctions[i] == NULL) {
- return FALSE;
+ return false;
}
input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1], m_pEncode[i * 2], m_pEncode[i * 2 + 1]);
int nresults;
m_pSubFunctions[i]->Call(&input, m_nInputs, outputs, nresults);
- return TRUE;
+ return true;
}
CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj)
{
@@ -837,7 +837,7 @@ CPDF_Function::~CPDF_Function()
m_pRanges = NULL;
}
}
-FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
+bool CPDF_Function::Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict;
if (pObj->GetType() == PDFOBJ_STREAM) {
@@ -847,11 +847,11 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
}
CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain"));
if (pDomains == NULL) {
- return FALSE;
+ return false;
}
m_nInputs = pDomains->GetCount() / 2;
if (m_nInputs == 0) {
- return FALSE;
+ return false;
}
m_pDomains = FX_Alloc2D(FX_FLOAT, m_nInputs, 2);
for (int i = 0; i < m_nInputs * 2; i ++) {
@@ -868,7 +868,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
}
FX_DWORD old_outputs = m_nOutputs;
if (!v_Init(pObj)) {
- return FALSE;
+ return false;
}
if (m_pRanges && m_nOutputs > (int)old_outputs) {
m_pRanges = FX_Realloc(FX_FLOAT, m_pRanges, m_nOutputs * 2);
@@ -876,12 +876,12 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj)
FXSYS_memset(m_pRanges + (old_outputs * 2), 0, sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2);
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const
+bool CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const
{
if (m_nInputs != ninputs) {
- return FALSE;
+ return false;
}
nresults = m_nOutputs;
for (int i = 0; i < m_nInputs; i ++) {
@@ -901,5 +901,5 @@ FX_BOOL CPDF_Function::Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, in
}
}
}
- return TRUE;
+ return true;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index b4d030e679..3264be42c6 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -97,7 +97,7 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count)
CPDF_Rect CPDF_ClipPath::GetClipBox() const
{
CPDF_Rect rect;
- FX_BOOL bStarted = FALSE;
+ bool bStarted = false;
int count = GetPathCount();
if (count) {
rect = GetPath(0).GetBoundingBox();
@@ -105,26 +105,26 @@ CPDF_Rect CPDF_ClipPath::GetClipBox() const
CPDF_Rect path_rect = GetPath(i).GetBoundingBox();
rect.Intersect(path_rect);
}
- bStarted = TRUE;
+ bStarted = true;
}
count = GetTextCount();
if (count) {
CPDF_Rect layer_rect;
- FX_BOOL bLayerStarted = FALSE;
+ bool bLayerStarted = false;
for (int i = 0; i < count; i ++) {
CPDF_TextObject* pTextObj = GetText(i);
if (pTextObj == NULL) {
if (!bStarted) {
rect = layer_rect;
- bStarted = TRUE;
+ bStarted = true;
} else {
rect.Intersect(layer_rect);
}
- bLayerStarted = FALSE;
+ bLayerStarted = false;
} else {
if (!bLayerStarted) {
layer_rect = pTextObj->GetBBox(NULL);
- bLayerStarted = TRUE;
+ bLayerStarted = true;
} else {
layer_rect.Union(pTextObj->GetBBox(NULL));
}
@@ -133,7 +133,7 @@ CPDF_Rect CPDF_ClipPath::GetClipBox() const
}
return rect;
}
-void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge)
+void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, bool bAutoMerge)
{
CPDF_ClipPathData* pData = GetModify();
if (pData->m_PathCount && bAutoMerge) {
@@ -256,7 +256,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, FX_FLOAT* pValue, i
CPDF_ColorStateData* pData = GetModify();
pData->m_FillColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
- FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B);
+ bool ret = pData->m_FillColor.GetRGB(R, G, B);
if (pPattern->m_PatternType == 1 && ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
pData->m_FillRGB = 0x00BFBFBF;
return;
@@ -268,7 +268,7 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, FX_FLOAT* pValue,
CPDF_ColorStateData* pData = GetModify();
pData->m_StrokeColor.SetValue(pPattern, pValue, nValues);
int R, G, B;
- FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B);
+ bool ret = pData->m_StrokeColor.GetRGB(R, G, B);
if (pPattern->m_PatternType == 1 && ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
pData->m_StrokeRGB = 0x00BFBFBF;
return;
@@ -295,7 +295,7 @@ CPDF_TextStateData::CPDF_TextStateData(const CPDF_TextStateData& src)
}
FXSYS_memcpy(this, &src, sizeof(CPDF_TextStateData));
if (m_pDocument && m_pFont) {
- m_pFont = m_pDocument->GetPageData()->GetFont(m_pFont->GetFontDict(), FALSE);
+ m_pFont = m_pDocument->GetPageData()->GetFont(m_pFont->GetFontDict(), false);
}
}
CPDF_TextStateData::~CPDF_TextStateData()
@@ -545,7 +545,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser
}
pGeneralState->SetBlendMode(mode);
if (pGeneralState->m_BlendType > FXDIB_BLEND_MULTIPLY) {
- pParser->GetObjectList()->m_bBackgroundAlphaNeeded = TRUE;
+ pParser->GetObjectList()->m_bBackgroundAlphaNeeded = true;
}
break;
}
@@ -631,12 +631,12 @@ CPDF_ContentMarkItem::~CPDF_ContentMarkItem()
((CPDF_Dictionary*)m_pParam)->Release();
}
}
-FX_BOOL CPDF_ContentMarkItem::HasMCID() const
+bool CPDF_ContentMarkItem::HasMCID() const
{
if (m_pParam && (m_ParamType == DirectDict || m_ParamType == PropertiesDict)) {
return ((CPDF_Dictionary *)m_pParam)->KeyExist(FX_BSTRC("MCID"));
}
- return FALSE;
+ return false;
}
CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src)
{
@@ -658,7 +658,7 @@ int CPDF_ContentMarkData::GetMCID() const
}
return -1;
}
-void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, CPDF_Dictionary* pDict, FX_BOOL bDirect)
+void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, CPDF_Dictionary* pDict, bool bDirect)
{
CPDF_ContentMarkItem& item = m_Marks.Add();
item.SetName(name);
@@ -676,23 +676,23 @@ void CPDF_ContentMarkData::DeleteLastMark()
}
m_Marks.RemoveAt(size - 1);
}
-FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const
+bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const
{
if (m_pObject == NULL) {
- return FALSE;
+ return false;
}
for (int i = 0; i < m_pObject->CountItems(); i ++) {
CPDF_ContentMarkItem& item = m_pObject->GetItem(i);
if (item.GetName() == mark) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const
+bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const
{
if (m_pObject == NULL) {
- return FALSE;
+ return false;
}
for (int i = 0; i < m_pObject->CountItems(); i ++) {
CPDF_ContentMarkItem& item = m_pObject->GetItem(i);
@@ -702,8 +702,8 @@ FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionar
item.GetParamType() == CPDF_ContentMarkItem::DirectDict) {
pDict = (CPDF_Dictionary*)item.GetParam();
}
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
index aabfd141d6..739a0bdf04 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -57,7 +57,7 @@ CPDF_Image* CPDF_Image::Clone()
CPDF_Image* pImage = new CPDF_Image(m_pDocument);
pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInline);
if (m_bInline) {
- CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE);
+ CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(true);
pImage->SetInlineDict(pInlineDict);
}
return pImage;
@@ -67,7 +67,7 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc)
m_pDocument = pDoc;
m_pStream = NULL;
m_pOC = NULL;
- m_bInline = FALSE;
+ m_bInline = false;
m_pInlineDict = NULL;
m_pDIBSource = NULL;
m_pMask = NULL;
@@ -84,7 +84,7 @@ CPDF_Image::~CPDF_Image()
}
}
}
-FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline)
+bool CPDF_Image::LoadImageF(CPDF_Stream* pStream, bool bInline)
{
m_pStream = pStream;
if (m_bInline && m_pInlineDict) {
@@ -101,5 +101,5 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline)
m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate"));
m_Height = pDict->GetInteger(FX_BSTRC("Height"));
m_Width = pDict->GetInteger(FX_BSTRC("Width"));
- return TRUE;
+ return true;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 892e2153b7..b27f958d5e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -9,7 +9,7 @@
#include "../../../include/fpdfapi/fpdf_serial.h"
#include "pageint.h"
-#define REQUIRE_PARAMS(count) if (m_ParamCount != count) { m_bAbort = TRUE; return; }
+#define REQUIRE_PARAMS(count) if (m_ParamCount != count) { m_bAbort = true; return; }
CPDF_StreamContentParser::CPDF_StreamContentParser(
CPDF_Document* pDocument,
@@ -30,7 +30,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
m_Level(level),
m_ParamStartPos(0),
m_ParamCount(0),
- m_bAbort(FALSE),
+ m_bAbort(false),
m_pCurStates(new CPDF_AllStates),
m_pLastTextObject(nullptr),
m_DefFontSize(0),
@@ -43,9 +43,9 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
m_pLastImage(nullptr),
m_pLastImageDict(nullptr),
m_pLastCloneImageDict(nullptr),
- m_bReleaseLastDict(TRUE),
- m_bColored(FALSE),
- m_bResourceMissing(FALSE)
+ m_bReleaseLastDict(true),
+ m_bColored(false),
+ m_bResourceMissing(false)
{
if (pmtContentToUser) {
m_mtContentToUser = *pmtContentToUser;
@@ -183,7 +183,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index)
if (param.m_Type == 0) {
return param.m_pObject;
}
- ASSERT(FALSE);
+ ASSERT(false);
return NULL;
}
CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index)
@@ -226,7 +226,7 @@ FX_FLOAT CPDF_StreamContentParser::GetNumber16(FX_DWORD index)
{
return GetNumber(index);
}
-void CPDF_StreamContentParser::SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph)
+void CPDF_StreamContentParser::SetGraphicStates(CPDF_PageObject* pObj, bool bColor, bool bText, bool bGraph)
{
pObj->m_GeneralState = m_pCurStates->m_GeneralState;
pObj->m_ClipPath = m_pCurStates->m_ClipPath;
@@ -318,7 +318,7 @@ const CPDF_StreamContentParser::OpCode CPDF_StreamContentParser::g_OpCodes[] =
{FXBSTR_ID('w', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineWidth},
{FXBSTR_ID('y', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_13},
};
-FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
+bool CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
{
int i = 0;
FX_DWORD opid = 0;
@@ -336,7 +336,7 @@ FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
int compare = opid - g_OpCodes[middle].m_OpId;
if (compare == 0) {
(this->*g_OpCodes[middle].m_OpHandler)();
- return TRUE;
+ return true;
}
if (compare < 0) {
high = middle - 1;
@@ -352,14 +352,14 @@ void CPDF_StreamContentParser::Handle_CloseFillStrokePath()
return;
}
Handle_ClosePath();
- AddPathObject(FXFILL_WINDING, TRUE);
+ AddPathObject(FXFILL_WINDING, true);
}
void CPDF_StreamContentParser::Handle_FillStrokePath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_WINDING, TRUE);
+ AddPathObject(FXFILL_WINDING, true);
}
void CPDF_StreamContentParser::Handle_CloseEOFillStrokePath()
{
@@ -367,14 +367,14 @@ void CPDF_StreamContentParser::Handle_CloseEOFillStrokePath()
return;
}
AddPathPoint(m_PathStartX, m_PathStartY, FXPT_LINETO | FXPT_CLOSEFIGURE);
- AddPathObject(FXFILL_ALTERNATE, TRUE);
+ AddPathObject(FXFILL_ALTERNATE, true);
}
void CPDF_StreamContentParser::Handle_EOFillStrokePath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_ALTERNATE, TRUE);
+ AddPathObject(FXFILL_ALTERNATE, true);
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary()
{
@@ -386,13 +386,13 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary()
if (pProperty == NULL) {
return;
}
- FX_BOOL bDirect = TRUE;
+ bool bDirect = true;
if (pProperty->GetType() == PDFOBJ_NAME) {
pProperty = FindResourceObj(FX_BSTRC("Properties"), pProperty->GetString());
if (pProperty == NULL) {
return;
}
- bDirect = FALSE;
+ bDirect = false;
}
if (pProperty->GetType() != PDFOBJ_DICTIONARY) {
return;
@@ -405,7 +405,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent()
return;
}
CFX_ByteString tag = GetString(0);
- m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE);
+ m_CurContentMark.GetModify()->AddMark(tag, NULL, false);
}
struct _FX_BSTR {
const FX_CHAR* m_Ptr;
@@ -622,20 +622,20 @@ void CPDF_StreamContentParser::Handle_SetCharWidth()
{
m_Type3Data[0] = GetNumber(1);
m_Type3Data[1] = GetNumber(0);
- m_bColored = TRUE;
+ m_bColored = true;
}
void CPDF_StreamContentParser::Handle_SetCachedDevice()
{
for (int i = 0; i < 6; i ++) {
m_Type3Data[i] = GetNumber(5 - i);
}
- m_bColored = FALSE;
+ m_bColored = false;
}
void CPDF_StreamContentParser::Handle_ExecuteXObject()
{
CFX_ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && m_pLastImage->GetStream()->GetObjNum()) {
- AddImage(NULL, m_pLastImage, FALSE);
+ AddImage(NULL, m_pLastImage, false);
return;
}
if (m_Options.m_bTextOnly) {
@@ -673,14 +673,14 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject()
}
}
}
- FX_BOOL bForm;
+ bool bForm;
if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(), bForm) && !bForm) {
return;
}
}
CPDF_Stream* pXObject = (CPDF_Stream*)FindResourceObj(FX_BSTRC("XObject"), name);
if (pXObject == NULL || pXObject->GetType() != PDFOBJ_STREAM) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return;
}
CFX_ByteStringC type = pXObject->GetDict() ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) : CFX_ByteStringC();
@@ -688,7 +688,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject()
if (m_Options.m_bTextOnly) {
return;
}
- CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE);
+ CPDF_ImageObject* pObj = AddImage(pXObject, NULL, false);
m_LastImageName = name;
m_pLastImage = pObj->m_pImage;
} else if (type == FX_BSTRC("Form")) {
@@ -719,10 +719,10 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream)
m_pCurStates.get(), m_Level + 1);
parser.m_pCurStates->m_CTM = form_matrix;
if (ClipPath.NotNull()) {
- parser.m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, TRUE);
+ parser.m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, true);
}
CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, FALSE);
+ stream.LoadAllData(pStream, false);
if (stream.GetSize() == 0) {
return;
}
@@ -740,13 +740,13 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream)
status.m_TextState = m_pCurStates->m_TextState;
pFormObj->m_pForm->ParseContent(&status, NULL, NULL, &m_Options, m_Level + 1);
if (!m_pObjectList->m_bBackgroundAlphaNeeded && pFormObj->m_pForm->m_bBackgroundAlphaNeeded) {
- m_pObjectList->m_bBackgroundAlphaNeeded = TRUE;
+ m_pObjectList->m_bBackgroundAlphaNeeded = true;
}
pFormObj->CalcBoundingBox();
- SetGraphicStates(pFormObj, TRUE, TRUE, TRUE);
+ SetGraphicStates(pFormObj, true, true, true);
m_pObjectList->m_ObjectList.AddTail(pFormObj);
}
-CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline)
+CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, bool bInline)
{
if (pStream == NULL && pImage == NULL) {
return NULL;
@@ -763,7 +763,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_
pImageObj->m_pImage = new CPDF_Image(m_pDocument);
pImageObj->m_pImage->LoadImageF(pStream, bInline);
}
- SetGraphicStates(pImageObj, pImageObj->m_pImage->IsMask(), FALSE, FALSE);
+ SetGraphicStates(pImageObj, pImageObj->m_pImage->IsMask(), false, false);
pImageObj->m_Matrix = ImageMatrix;
pImageObj->CalcBoundingBox();
m_pObjectList->m_ObjectList.AddTail(pImageObj);
@@ -817,21 +817,21 @@ void CPDF_StreamContentParser::Handle_FillPath()
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_WINDING, FALSE);
+ AddPathObject(FXFILL_WINDING, false);
}
void CPDF_StreamContentParser::Handle_FillPathOld()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_WINDING, FALSE);
+ AddPathObject(FXFILL_WINDING, false);
}
void CPDF_StreamContentParser::Handle_EOFillPath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(FXFILL_ALTERNATE, FALSE);
+ AddPathObject(FXFILL_ALTERNATE, false);
}
void CPDF_StreamContentParser::Handle_SetGray_Fill()
{
@@ -850,7 +850,7 @@ void CPDF_StreamContentParser::Handle_SetExtendGraphState()
CFX_ByteString name = GetString(0);
CPDF_Dictionary* pGS = (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("ExtGState"), name);
if (pGS == NULL || pGS->GetType() != PDFOBJ_DICTIONARY) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return;
}
m_pCurStates->ProcessExtGS(pGS, this);
@@ -934,7 +934,7 @@ void CPDF_StreamContentParser::Handle_EndPath()
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(0, FALSE);
+ AddPathObject(0, false);
}
void CPDF_StreamContentParser::Handle_SaveGraphState()
{
@@ -999,14 +999,14 @@ void CPDF_StreamContentParser::Handle_CloseStrokePath()
return;
}
Handle_ClosePath();
- AddPathObject(0, TRUE);
+ AddPathObject(0, true);
}
void CPDF_StreamContentParser::Handle_StrokePath()
{
if (m_Options.m_bTextOnly) {
return;
}
- AddPathObject(0, TRUE);
+ AddPathObject(0, true);
}
void CPDF_StreamContentParser::Handle_SetColor_Fill()
{
@@ -1060,7 +1060,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill()
}
}
if (nvalues != nargs) {
- CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE);
+ CPDF_Pattern* pPattern = FindPattern(GetString(0), false);
if (pPattern) {
m_pCurStates->m_ColorState.SetFillPattern(pPattern, values, nvalues);
}
@@ -1093,7 +1093,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke()
}
}
if (nvalues != nargs) {
- CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE);
+ CPDF_Pattern* pPattern = FindPattern(GetString(0), false);
if (pPattern) {
m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues);
}
@@ -1111,7 +1111,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill()
if (m_Options.m_bTextOnly) {
return;
}
- CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE);
+ CPDF_Pattern* pPattern = FindPattern(GetString(0), true);
if (pPattern == NULL) {
return;
}
@@ -1127,7 +1127,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill()
}
CPDF_ShadingObject* pObj = new CPDF_ShadingObject;
pObj->m_pShading = pShading;
- SetGraphicStates(pObj, FALSE, FALSE, FALSE);
+ SetGraphicStates(pObj, false, false, false);
pObj->m_Matrix = m_pCurStates->m_CTM;
pObj->m_Matrix.Concat(m_mtContentToUser);
CFX_FloatRect bbox;
@@ -1206,7 +1206,7 @@ CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name)
{
CPDF_Dictionary* pFontDict = (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("Font"), name);
if (pFontDict == NULL || pFontDict->GetType() != PDFOBJ_DICTIONARY) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return CPDF_Font::GetStockFont(m_pDocument, FX_BSTRC("Helvetica"));
}
CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict);
@@ -1238,17 +1238,17 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(const CFX_ByteString&
}
CPDF_Object* pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name);
if (pCSObj == NULL) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return NULL;
}
return m_pDocument->LoadColorSpace(pCSObj);
}
-CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, FX_BOOL bShading)
+CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, bool bShading)
{
CPDF_Object* pPattern = FindResourceObj(bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name);
if (pPattern == NULL || (pPattern->GetType() != PDFOBJ_DICTIONARY &&
pPattern->GetType() != PDFOBJ_STREAM)) {
- m_bResourceMissing = TRUE;
+ m_bResourceMissing = true;
return NULL;
}
return m_pDocument->LoadPattern(pPattern, bShading, &m_pCurStates->m_ParentMatrix);
@@ -1287,7 +1287,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, FX_FLOAT fIn
}
CPDF_TextObject* pText = new CPDF_TextObject;
m_pLastTextObject = pText;
- SetGraphicStates(pText, TRUE, TRUE, TRUE);
+ SetGraphicStates(pText, true, true, true);
if (textmode && textmode != 3 && textmode != 4 && textmode != 7) {
FX_FLOAT* pCTM = pText->m_TextState.GetModify()->m_CTM;
pCTM[0] = m_pCurStates->m_CTM.a;
@@ -1501,7 +1501,7 @@ void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag)
m_pPathPoints[m_PathPointCount - 1].m_PointX = x;
m_pPathPoints[m_PathPointCount - 1].m_PointY = y;
}
-void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
+void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke)
{
int PathPointCount = m_PathPointCount, PathClipType = m_PathClipType;
m_PathPointCount = 0;
@@ -1510,7 +1510,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
if (PathPointCount && PathClipType) {
CPDF_Path path;
path.New()->AppendRect(0, 0, 0, 0);
- m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, TRUE);
+ m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, true);
}
return;
}
@@ -1529,7 +1529,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
pPathObj->m_FillType = FillType;
pPathObj->m_Path = Path;
pPathObj->m_Matrix = matrix;
- SetGraphicStates(pPathObj, TRUE, FALSE, TRUE);
+ SetGraphicStates(pPathObj, true, false, true);
pPathObj->CalcBoundingBox();
m_pObjectList->m_ObjectList.AddTail(pPathObj);
}
@@ -1538,13 +1538,13 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke)
Path.Transform(&matrix);
matrix.SetIdentity();
}
- m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE);
+ m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, true);
}
}
CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf)
{
CFX_ByteTextBuf buf;
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
int code = 0;
const uint8_t* str = src_buf.GetBuffer();
FX_DWORD size = src_buf.GetSize();
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index b2cfce73d9..ca5e9fe529 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -18,18 +18,18 @@ const FX_CHAR* const _PDF_OpCharType =
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII";
-FX_BOOL _PDF_HasInvalidOpChar(const FX_CHAR* op)
+bool _PDF_HasInvalidOpChar(const FX_CHAR* op)
{
if(!op) {
- return FALSE;
+ return false;
}
uint8_t ch;
while((ch = *op++)) {
if(_PDF_OpCharType[ch] == 'I') {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
class CPDF_StreamParserAutoClearer {
public:
@@ -60,7 +60,7 @@ FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData, FX_DWORD dwSize,
return m_pSyntax->GetPos();
case CPDF_StreamParser::Keyword:
if(!OnOperator((char*)syntax.GetWordBuf()) && _PDF_HasInvalidOpChar((char*)syntax.GetWordBuf())) {
- m_bAbort = TRUE;
+ m_bAbort = true;
}
if (m_bAbort) {
return m_pSyntax->GetPos();
@@ -143,7 +143,7 @@ void CPDF_StreamContentParser::Handle_BeginImage()
return;
}
pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
- CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, TRUE);
+ CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, true);
if (!pImgObj) {
if (pStream) {
pStream->Release();
@@ -159,7 +159,7 @@ void CPDF_StreamContentParser::ParsePathObject()
int last_pos = m_pSyntax->GetPos();
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
- FX_BOOL bProcessed = TRUE;
+ bool bProcessed = true;
switch (type) {
case CPDF_StreamParser::EndOfData:
return;
@@ -198,7 +198,7 @@ void CPDF_StreamContentParser::ParsePathObject()
nParams = 0;
break;
default:
- bProcessed = FALSE;
+ bProcessed = false;
break;
}
} else if (len == 2) {
@@ -206,10 +206,10 @@ void CPDF_StreamContentParser::ParsePathObject()
AddPathRect(params[0], params[1], params[2], params[3]);
nParams = 0;
} else {
- bProcessed = FALSE;
+ bProcessed = false;
}
} else {
- bProcessed = FALSE;
+ bProcessed = false;
}
if (bProcessed) {
last_pos = m_pSyntax->GetPos();
@@ -220,14 +220,14 @@ void CPDF_StreamContentParser::ParsePathObject()
if (nParams == 6) {
break;
}
- FX_BOOL bInteger;
+ bool bInteger;
int value;
FX_atonum(CFX_ByteStringC(m_pSyntax->GetWordBuf(), m_pSyntax->GetWordSize()), bInteger, &value);
params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*)&value;
break;
}
default:
- bProcessed = FALSE;
+ bProcessed = false;
}
if (!bProcessed) {
m_pSyntax->SetPos(last_pos);
@@ -279,7 +279,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
const CPDF_Dictionary* pParams);
FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
+FX_DWORD FPDFAPI_FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size);
FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
int width, int height, CFX_ByteString& decoder,
@@ -296,10 +296,10 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
return _HexDecode(src_buf, limit, dest_buf, dest_size);
}
if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
- return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size, dest_buf, dest_size);
+ return FPDFAPI_FlateOrLZWDecode(false, src_buf, limit, pParam, dest_size, dest_buf, dest_size);
}
if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
- return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_buf, dest_size);
+ return FPDFAPI_FlateOrLZWDecode(true, src_buf, limit, pParam, 0, dest_buf, dest_size);
}
if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
@@ -313,7 +313,7 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
dest_buf = 0;
return (FX_DWORD) - 1;
}
-CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode)
+CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, bool bDecode)
{
if (m_Pos == m_Size) {
return NULL;
@@ -447,7 +447,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
m_pLastObj = NULL;
}
m_WordSize = 0;
- FX_BOOL bIsNumber = TRUE;
+ bool bIsNumber = true;
if (m_Pos >= m_Size) {
return EndOfData;
}
@@ -485,7 +485,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
m_WordBuffer[m_WordSize++] = ch;
}
if (type != 'N') {
- bIsNumber = FALSE;
+ bIsNumber = false;
}
if (m_Size <= m_Pos) {
break;
@@ -506,7 +506,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
}
if (m_WordSize == 4) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
- m_pLastObj = CPDF_Boolean::Create(TRUE);
+ m_pLastObj = CPDF_Boolean::Create(true);
return Others;
}
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
@@ -515,7 +515,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement()
}
} else if (m_WordSize == 5) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
- m_pLastObj = CPDF_Boolean::Create(FALSE);
+ m_pLastObj = CPDF_Boolean::Create(false);
return Others;
}
}
@@ -584,9 +584,9 @@ void CPDF_StreamParser::SkipPathObject()
}
}
}
-CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOOL bInArray)
+CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray, bool bInArray)
{
- FX_BOOL bIsNumber;
+ bool bIsNumber;
GetNextWord(bIsNumber);
if (m_WordSize == 0) {
return NULL;
@@ -604,7 +604,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
}
if (first_char == '<') {
if (m_WordSize == 1) {
- return CPDF_String::Create(ReadHexString(), TRUE);
+ return CPDF_String::Create(ReadHexString(), true);
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
while (1) {
@@ -621,7 +621,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
return NULL;
}
CFX_ByteString key = PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
- CPDF_Object* pObj = ReadNextObject(TRUE);
+ CPDF_Object* pObj = ReadNextObject(true);
if (pObj == NULL) {
if (pDict) {
pDict->Release();
@@ -642,7 +642,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
}
CPDF_Array* pArray = CPDF_Array::Create();
while (1) {
- CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, TRUE);
+ CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, true);
if (pObj == NULL) {
if (m_WordSize == 0 || m_WordBuffer[0] == ']') {
return pArray;
@@ -657,22 +657,22 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
}
if (m_WordSize == 4) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) {
- return CPDF_Boolean::Create(TRUE);
+ return CPDF_Boolean::Create(true);
}
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) {
return CPDF_Null::Create();
}
} else if (m_WordSize == 5) {
if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e') {
- return CPDF_Boolean::Create(FALSE);
+ return CPDF_Boolean::Create(false);
}
}
return NULL;
}
-void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber)
+void CPDF_StreamParser::GetNextWord(bool& bIsNumber)
{
m_WordSize = 0;
- bIsNumber = TRUE;
+ bIsNumber = true;
if (m_Size <= m_Pos) {
return;
}
@@ -701,7 +701,7 @@ void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber)
type = PDF_CharType[ch];
}
if (type == 'D') {
- bIsNumber = FALSE;
+ bIsNumber = false;
m_WordBuffer[m_WordSize++] = ch;
if (ch == '/') {
while (1) {
@@ -746,7 +746,7 @@ void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber)
m_WordBuffer[m_WordSize++] = ch;
}
if (type != 'N') {
- bIsNumber = FALSE;
+ bIsNumber = false;
}
if (m_Size <= m_Pos) {
return;
@@ -862,7 +862,7 @@ CFX_ByteString CPDF_StreamParser::ReadHexString()
}
int ch = m_pBuf[m_Pos++];
CFX_ByteTextBuf buf;
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
int code = 0;
while (1) {
if (ch == '>') {
@@ -947,7 +947,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions)
return;
}
m_pObjects = pPage;
- m_bForm = FALSE;
+ m_bForm = false;
if (pOptions) {
m_Options = *pOptions;
}
@@ -962,7 +962,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions)
if (pContent->GetType() == PDFOBJ_STREAM) {
m_nStreams = 0;
m_pSingleStream = new CPDF_StreamAcc;
- m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, FALSE);
+ m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, false);
} else if (pContent->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = (CPDF_Array*)pContent;
m_nStreams = pArray->GetCount();
@@ -981,7 +981,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates,
{
m_pType3Char = pType3Char;
m_pObjects = pForm;
- m_bForm = TRUE;
+ m_bForm = true;
CFX_AffineMatrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
if (pGraphicStates) {
form_matrix.Concat(pGraphicStates->m_CTM);
@@ -1011,7 +1011,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates,
m_pParser->GetCurStates()->m_CTM = form_matrix;
m_pParser->GetCurStates()->m_ParentMatrix = form_matrix;
if (ClipPath.NotNull()) {
- m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, TRUE);
+ m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, true);
}
if (pForm->m_Transparency & PDFTRANS_GROUP) {
CPDF_GeneralStateData* pData = m_pParser->GetCurStates()->m_GeneralState.GetModify();
@@ -1023,9 +1023,9 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates,
m_nStreams = 0;
m_pSingleStream = new CPDF_StreamAcc;
if (pForm->m_pDocument) {
- m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE);
+ m_pSingleStream->LoadAllData(pForm->m_pFormStream, false);
} else {
- m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE);
+ m_pSingleStream->LoadAllData(pForm->m_pFormStream, false);
}
m_pData = (uint8_t*)m_pSingleStream->GetData();
m_Size = m_pSingleStream->GetSize();
@@ -1070,7 +1070,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause)
CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTRC("Contents"));
m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc;
CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->GetElementValue(m_CurrentOffset) : NULL);
- m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE);
+ m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false);
m_CurrentOffset ++;
}
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 48b3a40495..8292d2d90e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -8,7 +8,7 @@
#include "pageint.h"
CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) :
- m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(FALSE)
+ m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_bForceClear(false)
{
if (pParentMatrix) {
m_ParentMatrix = *pParentMatrix;
@@ -37,28 +37,28 @@ CPDF_TilingPattern::~CPDF_TilingPattern()
delete m_pForm;
m_pForm = NULL;
}
-FX_BOOL CPDF_TilingPattern::Load()
+bool CPDF_TilingPattern::Load()
{
if (m_pForm != NULL) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("XStep")));
m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("YStep")));
if (m_pPatternObj->GetType() != PDFOBJ_STREAM) {
- return FALSE;
+ return false;
}
CPDF_Stream* pStream = (CPDF_Stream*)m_pPatternObj;
m_pForm = new CPDF_Form(m_pDocument, NULL, pStream);
m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL);
m_BBox = pDict->GetRect(FX_BSTRC("BBox"));
- return TRUE;
+ return true;
}
-CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix)
+CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix)
{
m_PatternType = PATTERN_SHADING;
m_pPatternObj = bShading ? NULL : pPatternObj;
@@ -102,14 +102,14 @@ void CPDF_ShadingPattern::Clear()
m_pCountedCS = NULL;
m_nFuncs = 0;
}
-FX_BOOL CPDF_ShadingPattern::Load()
+bool CPDF_ShadingPattern::Load()
{
if (m_ShadingType != 0) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pShadingDict = m_pShadingObj ? m_pShadingObj->GetDict() : NULL;
if (pShadingDict == NULL) {
- return FALSE;
+ return false;
}
if (m_nFuncs) {
for (int i = 0; i < m_nFuncs; i ++)
@@ -133,7 +133,7 @@ FX_BOOL CPDF_ShadingPattern::Load()
}
CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj == NULL) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL);
@@ -141,14 +141,14 @@ FX_BOOL CPDF_ShadingPattern::Load()
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
}
m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType"));
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_ShadingPattern::Reload()
+bool CPDF_ShadingPattern::Reload()
{
Clear();
return Load();
}
-FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
+bool CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
{
m_Stream.LoadAllData(pShadingStream);
m_BitStream.Init(m_Stream.GetData(), m_Stream.GetSize());
@@ -160,21 +160,21 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFunc
m_nCompBits = pDict->GetInteger(FX_BSTRC("BitsPerComponent"));
m_nFlagBits = pDict->GetInteger(FX_BSTRC("BitsPerFlag"));
if (!m_nCoordBits || !m_nCompBits) {
- return FALSE;
+ return false;
}
int nComps = pCS->CountComponents();
if (nComps > 8) {
- return FALSE;
+ return false;
}
m_nComps = nFuncs ? 1 : nComps;
if (((int)m_nComps < 0) || m_nComps > 8) {
- return FALSE;
+ return false;
}
m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1;
m_CompMax = (1 << m_nCompBits) - 1;
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
if (pDecode == NULL || pDecode->GetCount() != 4 + m_nComps * 2) {
- return FALSE;
+ return false;
}
m_xmin = pDecode->GetNumber(0);
m_xmax = pDecode->GetNumber(1);
@@ -184,7 +184,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, CPDF_Function** pFunc
m_ColorMin[i] = pDecode->GetNumber(i * 2 + 4);
m_ColorMax[i] = pDecode->GetNumber(i * 2 + 5);
}
- return TRUE;
+ return true;
}
FX_DWORD CPDF_MeshStream::GetFlag()
{
@@ -231,18 +231,18 @@ FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex, CFX_AffineMatrix* p
m_BitStream.ByteAlign();
return flag;
}
-FX_BOOL CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap)
+bool CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_AffineMatrix* pObject2Bitmap)
{
for (int i = 0; i < count; i ++) {
if (m_BitStream.IsEOF()) {
- return FALSE;
+ return false;
}
GetCoords(vertex[i].x, vertex[i].y);
pObject2Bitmap->Transform(vertex[i].x, vertex[i].y);
GetColor(vertex[i].r, vertex[i].g, vertex[i].b);
m_BitStream.ByteAlign();
}
- return TRUE;
+ return true;
}
CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMatrix* pMatrix,
CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
@@ -255,8 +255,8 @@ CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMa
return CFX_FloatRect(0, 0, 0, 0);
}
CFX_FloatRect rect;
- FX_BOOL bStarted = FALSE;
- FX_BOOL bGouraud = type == 4 || type == 5;
+ bool bStarted = false;
+ bool bGouraud = type == 4 || type == 5;
int full_point_count = type == 7 ? 16 : (type == 6 ? 12 : 1);
int full_color_count = (type == 6 || type == 7) ? 4 : 1;
while (!stream.m_BitStream.IsEOF()) {
@@ -276,7 +276,7 @@ CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMa
rect.UpdateRect(x, y);
} else {
rect.InitRect(x, y);
- bStarted = TRUE;
+ bStarted = true;
}
}
stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color_count);
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h
index 8cd393cf32..021b33a421 100644
--- a/core/src/fpdfapi/fpdf_page/pageint.h
+++ b/core/src/fpdfapi/fpdf_page/pageint.h
@@ -21,7 +21,7 @@ public:
CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize);
~CPDF_StreamParser();
- CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode);
+ CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, bool bDecode);
typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType;
SyntaxType ParseNextElement();
@@ -48,10 +48,10 @@ public:
m_Pos = pos;
}
- CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, FX_BOOL bInArray = FALSE);
+ CPDF_Object* ReadNextObject(bool bAllowNestedArray = false, bool bInArray = false);
void SkipPathObject();
protected:
- void GetNextWord(FX_BOOL& bIsNumber);
+ void GetNextWord(bool& bIsNumber);
CFX_ByteString ReadString();
CFX_ByteString ReadHexString();
const uint8_t* m_pBuf;
@@ -105,7 +105,7 @@ typedef struct {
int m_Type;
union {
struct {
- FX_BOOL m_bInteger;
+ bool m_bInteger;
union {
int m_Integer;
FX_FLOAT m_Float;
@@ -137,10 +137,10 @@ public:
int level);
~CPDF_StreamContentParser();
- FX_BOOL ShouldAbort() const { return m_bAbort; }
+ bool ShouldAbort() const { return m_bAbort; }
CPDF_PageObjects* GetObjectList() const { return m_pObjectList; }
CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); }
- FX_BOOL IsColored() const { return m_bColored; }
+ bool IsColored() const { return m_bColored; }
const FX_FLOAT* GetType3Data() const { return m_Type3Data; }
void AddNumberParam(const FX_CHAR* str, int len);
@@ -156,7 +156,7 @@ public:
{
return (int32_t)(GetNumber(index));
}
- FX_BOOL OnOperator(const FX_CHAR* op);
+ bool OnOperator(const FX_CHAR* op);
void BigCaseCaller(int index);
FX_DWORD GetParsePos()
{
@@ -171,16 +171,16 @@ public:
void ParsePathObject();
void AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag);
void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h);
- void AddPathObject(int FillType, FX_BOOL bStroke);
- CPDF_ImageObject* AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline);
+ void AddPathObject(int FillType, bool bStroke);
+ CPDF_ImageObject* AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, bool bInline);
void AddDuplicateImage();
void AddForm(CPDF_Stream*);
- void SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph);
+ void SetGraphicStates(CPDF_PageObject* pObj, bool bColor, bool bText, bool bGraph);
void SaveStates(CPDF_AllStates*);
void RestoreStates(CPDF_AllStates*);
CPDF_Font* FindFont(const CFX_ByteString& name);
CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name);
- CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_BOOL bShading);
+ CPDF_Pattern* FindPattern(const CFX_ByteString& name, bool bShading);
CPDF_Object* FindResourceObj(const CFX_ByteStringC& type, const CFX_ByteString& name);
protected:
@@ -277,7 +277,7 @@ protected:
_ContentParam m_ParamBuf1[PARAM_BUF_SIZE];
FX_DWORD m_ParamStartPos;
FX_DWORD m_ParamCount;
- FX_BOOL m_bAbort;
+ bool m_bAbort;
CPDF_StreamParser* m_pSyntax;
nonstd::unique_ptr<CPDF_AllStates> m_pCurStates;
CPDF_ContentMark m_CurContentMark;
@@ -299,11 +299,11 @@ protected:
CFX_BinaryBuf m_LastImageData;
CPDF_Dictionary* m_pLastImageDict;
CPDF_Dictionary* m_pLastCloneImageDict;
- FX_BOOL m_bReleaseLastDict;
- FX_BOOL m_bSameLastDict;
- FX_BOOL m_bColored;
+ bool m_bReleaseLastDict;
+ bool m_bSameLastDict;
+ bool m_bColored;
FX_FLOAT m_Type3Data[6];
- FX_BOOL m_bResourceMissing;
+ bool m_bResourceMissing;
CFX_PtrArray m_StateStack;
};
class CPDF_ContentParser
@@ -331,7 +331,7 @@ protected:
void Clear();
ParseStatus m_Status;
CPDF_PageObjects* m_pObjects;
- FX_BOOL m_bForm;
+ bool m_bForm;
CPDF_ParseOptions m_Options;
CPDF_Type3Char* m_pType3Char;
int m_InternalStage;
@@ -363,22 +363,22 @@ class CPDF_DocPageData
explicit CPDF_DocPageData(CPDF_Document *pPDFDoc);
~CPDF_DocPageData();
- void Clear(FX_BOOL bRelease = FALSE);
- CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly);
+ void Clear(bool bRelease = false);
+ CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, bool findOnly);
CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName, CPDF_FontEncoding* pEncoding);
void ReleaseFont(CPDF_Dictionary* pFontDict);
CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictionary* pResources);
CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj);
void ReleaseColorSpace(CPDF_Object* pColorSpace);
- CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix);
+ CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, bool bShading, const CFX_AffineMatrix* matrix);
void ReleasePattern(CPDF_Object* pPatternObj);
CPDF_Image* GetImage(CPDF_Object* pImageStream);
void ReleaseImage(CPDF_Object* pImageStream);
CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream);
void ReleaseIccProfile(CPDF_IccProfile* pIccProfile);
CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream);
- void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce = FALSE);
- FX_BOOL IsForceClear() const {return m_bForceClear;}
+ void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, bool bForce = false);
+ bool IsForceClear() const {return m_bForceClear;}
CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const;
CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const;
@@ -397,7 +397,7 @@ class CPDF_DocPageData
CPDF_Document* const m_pPDFDoc;
CFX_MapByteStringToPtr m_HashProfileMap;
- FX_BOOL m_bForceClear;
+ bool m_bForceClear;
CPDF_ColorSpaceMap m_ColorSpaceMap;
CPDF_FontFileMap m_FontFileMap;
@@ -412,7 +412,7 @@ class CPDF_Function
public:
static CPDF_Function* Load(CPDF_Object* pFuncObj);
virtual ~CPDF_Function();
- FX_BOOL Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const;
+ bool Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const;
int CountInputs()
{
return m_nInputs;
@@ -426,9 +426,9 @@ protected:
int m_nInputs, m_nOutputs;
FX_FLOAT* m_pDomains;
FX_FLOAT* m_pRanges;
- FX_BOOL Init(CPDF_Object* pObj);
- virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0;
- virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
+ bool Init(CPDF_Object* pObj);
+ virtual bool v_Init(CPDF_Object* pObj) = 0;
+ virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
};
class CPDF_IccProfile
{
@@ -436,7 +436,7 @@ public:
CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize);
~CPDF_IccProfile();
int32_t GetComponents() const { return m_nSrcComponents; }
- FX_BOOL m_bsRGB;
+ bool m_bsRGB;
void* m_pTransform;
private:
int32_t m_nSrcComponents;
@@ -447,20 +447,20 @@ class CPDF_DeviceCS : public CPDF_ColorSpace
public:
CPDF_DeviceCS(CPDF_Document* pDoc, int family);
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
+ bool GetRGB(FX_FLOAT* pBuf,
FX_FLOAT& R,
FX_FLOAT& G,
FX_FLOAT& B) const override;
- FX_BOOL SetRGB(FX_FLOAT* pBuf,
+ bool SetRGB(FX_FLOAT* pBuf,
FX_FLOAT R,
FX_FLOAT G,
FX_FLOAT B) const override;
- FX_BOOL v_GetCMYK(FX_FLOAT* pBuf,
+ bool v_GetCMYK(FX_FLOAT* pBuf,
FX_FLOAT& c,
FX_FLOAT& m,
FX_FLOAT& y,
FX_FLOAT& k) const override;
- FX_BOOL v_SetCMYK(FX_FLOAT* pBuf,
+ bool v_SetCMYK(FX_FLOAT* pBuf,
FX_FLOAT c,
FX_FLOAT m,
FX_FLOAT y,
@@ -470,7 +470,7 @@ public:
int pixels,
int image_width,
int image_height,
- FX_BOOL bTransMask = FALSE) const override;
+ bool bTransMask = false) const override;
};
class CPDF_PatternCS : public CPDF_ColorSpace
@@ -482,8 +482,8 @@ public:
m_pCountedBaseCS(nullptr) {
}
~CPDF_PatternCS() override;
- FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- FX_BOOL GetRGB(FX_FLOAT* pBuf,
+ bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
+ bool GetRGB(FX_FLOAT* pBuf,
FX_FLOAT& R,
FX_FLOAT& G,
FX_FLOAT& B) const override;
diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h
index 2ec54fb1f5..c27ade8a70 100644
--- a/core/src/fpdfapi/fpdf_parser/filters_int.h
+++ b/core/src/fpdfapi/fpdf_parser/filters_int.h
@@ -31,11 +31,11 @@ public:
class CPDF_LzwFilter : public CFX_DataFilter
{
public:
- CPDF_LzwFilter(FX_BOOL bEarlyChange);
+ CPDF_LzwFilter(bool bEarlyChange);
virtual ~CPDF_LzwFilter() {}
virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
- FX_BOOL m_bEarlyChange;
+ bool m_bEarlyChange;
FX_DWORD m_CodeArray[5021];
FX_DWORD m_nCodes;
FX_DWORD m_CodeLen;
@@ -54,7 +54,7 @@ public:
virtual ~CPDF_PredictorFilter();
virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
- FX_BOOL m_bTiff;
+ bool m_bTiff;
FX_DWORD m_Pitch, m_Bpp;
uint8_t* m_pRefLine;
uint8_t* m_pCurLine;
@@ -102,14 +102,14 @@ public:
CFX_BinaryBuf m_InputBuf;
uint8_t* m_pScanline;
int m_Pitch, m_Height, m_Width, m_nComps, m_iLine;
- FX_BOOL m_bGotHeader;
+ bool m_bGotHeader;
};
class CPDF_FaxFilter : public CFX_DataFilter
{
public:
CPDF_FaxFilter();
virtual ~CPDF_FaxFilter();
- FX_BOOL Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns);
+ bool Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns);
virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf);
int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack;
@@ -118,9 +118,9 @@ public:
uint8_t* m_pRefBuf;
CFX_BinaryBuf m_InputBuf;
int m_InputBitPos;
- void ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
+ void ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, bool bFinish,
CFX_BinaryBuf& dest_buf);
- FX_BOOL ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos);
+ bool ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos);
};
#endif // CORE_SRC_FPDFAPI_FPDF_PARSER_FILTERS_INT_H_
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 47c08fb4a3..e60888a292 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -91,7 +91,7 @@ FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu
}
dest_buf = FX_Alloc( uint8_t, i / 2 + 1);
dest_size = 0;
- FX_BOOL bFirstDigit = TRUE;
+ bool bFirstDigit = true;
for (i = 0; i < src_size; i ++) {
uint8_t ch = src_buf[i];
if (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') {
@@ -186,9 +186,9 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
const CPDF_Dictionary* pParams)
{
int K = 0;
- FX_BOOL EndOfLine = FALSE;
- FX_BOOL ByteAlign = FALSE;
- FX_BOOL BlackIs1 = FALSE;
+ bool EndOfLine = false;
+ bool ByteAlign = false;
+ bool BlackIs1 = false;
int Columns = 1728;
int Rows = 0;
if (pParams) {
@@ -208,25 +208,25 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
return CPDF_ModuleMgr::Get()->GetFaxModule()->CreateDecoder(src_buf, src_size, width, height,
K, EndOfLine, ByteAlign, BlackIs1, Columns, Rows);
}
-static FX_BOOL CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Columns)
+static bool CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Columns)
{
if (Columns < 0) {
- return FALSE;
+ return false;
}
int check = Columns;
if (Colors < 0 || (check > 0 && Colors > INT_MAX / check)) {
- return FALSE;
+ return false;
}
check *= Colors;
if (BitsPerComponent < 0 ||
(check > 0 && BitsPerComponent > INT_MAX / check)) {
- return FALSE;
+ return false;
}
check *= BitsPerComponent;
if (check > INT_MAX - 7) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, const CPDF_Dictionary* pParams)
@@ -245,11 +245,11 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DW
return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_size, width, height,
nComps, bpc, predictor, Colors, BitsPerComponent, Columns);
}
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
+FX_DWORD FPDFAPI_FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
int predictor = 0;
- FX_BOOL bEarlyChange = TRUE;
+ bool bEarlyChange = true;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"));
@@ -265,14 +265,14 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD
bEarlyChange, predictor, Colors, BitsPerComponent, Columns, estimated_size,
dest_buf, dest_size);
}
-FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
+bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding,
- CPDF_Dictionary*& pImageParms, FX_DWORD last_estimated_size, FX_BOOL bImageAcc)
+ CPDF_Dictionary*& pImageParms, FX_DWORD last_estimated_size, bool bImageAcc)
{
CPDF_Object* pDecoder = pDict ? pDict->GetElementValue(FX_BSTRC("Filter")) : NULL;
if (pDecoder == NULL || (pDecoder->GetType() != PDFOBJ_ARRAY && pDecoder->GetType() != PDFOBJ_NAME)) {
- return FALSE;
+ return false;
}
CPDF_Object* pParams = pDict ? pDict->GetElementValue(FX_BSTRC("DecodeParms")) : NULL;
CFX_ByteStringArray DecoderList;
@@ -310,11 +310,11 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dic
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
- return TRUE;
+ return true;
}
- offset = FPDFAPI_FlateOrLZWDecode(FALSE, last_buf, last_size, pParam, estimated_size, new_buf, new_size);
+ offset = FPDFAPI_FlateOrLZWDecode(false, last_buf, last_size, pParam, estimated_size, new_buf, new_size);
} else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
- offset = FPDFAPI_FlateOrLZWDecode(TRUE, last_buf, last_size, pParam, estimated_size, new_buf, new_size);
+ offset = FPDFAPI_FlateOrLZWDecode(true, last_buf, last_size, pParam, estimated_size, new_buf, new_size);
} else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
offset = _A85Decode(last_buf, last_size, new_buf, new_size);
} else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
@@ -325,7 +325,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dic
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
- return TRUE;
+ return true;
}
offset = RunLengthDecode(last_buf, last_size, new_buf, new_size);
} else {
@@ -340,13 +340,13 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dic
pImageParms = pParam;
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
- return TRUE;
+ return true;
}
if (last_buf != src_buf) {
FX_Free(last_buf);
}
if (offset == -1) {
- return FALSE;
+ return false;
}
last_buf = new_buf;
last_size = new_size;
@@ -355,7 +355,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dic
pImageParms = NULL;
dest_buf = last_buf;
dest_size = last_size;
- return TRUE;
+ return true;
}
extern const FX_WORD PDFDocEncoding[256] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
@@ -389,7 +389,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len, CFX_Cha
{
CFX_WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) || (src_data[0] == 0xff && src_data[1] == 0xfe))) {
- FX_BOOL bBE = src_data[0] == 0xfe;
+ bool bBE = src_data[0] == 0xfe;
FX_DWORD max_chars = (src_len - 2) / 2;
if (!max_chars) {
return result;
@@ -472,7 +472,7 @@ CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len, CFX_CharMap* pCh
result.ReleaseBuffer(encLen);
return result;
}
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex)
+CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex)
{
CFX_ByteTextBuf result;
int srclen = src.GetLength();
@@ -521,7 +521,7 @@ FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_b
{
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
- return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
+ return pEncoders->GetFlateModule()->FlateOrLZWDecode(false, src_buf, src_size, false, 0, 0, 0, 0, 0, dest_buf, dest_size);
}
return 0;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index c0f45c5379..0ea692ed4d 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -12,7 +12,7 @@ CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParse
ASSERT(pParser != NULL);
m_pRootDict = NULL;
m_pInfoDict = NULL;
- m_bLinearized = FALSE;
+ m_bLinearized = false;
m_dwFirstPageNo = 0;
m_dwFirstPageObjNum = 0;
m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this);
@@ -58,7 +58,7 @@ void CPDF_Document::LoadDoc()
}
void CPDF_Document::LoadAsynDoc(CPDF_Dictionary *pLinearized)
{
- m_bLinearized = TRUE;
+ m_bLinearized = true;
m_LastObjNum = m_pParser->GetLastObjNum();
CPDF_Object* indirectObj = GetIndirectObject(m_pParser->GetRootObjNum());
m_pRootDict = indirectObj ? indirectObj->GetDict() : NULL;
@@ -228,7 +228,7 @@ int CPDF_Document::GetPageIndex(FX_DWORD objnum)
{
FX_DWORD nPages = m_PageList.GetSize();
FX_DWORD skip_count = 0;
- FX_BOOL bSkipped = FALSE;
+ bool bSkipped = false;
for (FX_DWORD i = 0; i < nPages; i ++) {
FX_DWORD objnum1 = m_PageList.GetAt(i);
if (objnum1 == objnum) {
@@ -236,7 +236,7 @@ int CPDF_Document::GetPageIndex(FX_DWORD objnum)
}
if (!bSkipped && objnum1 == 0) {
skip_count = i;
- bSkipped = TRUE;
+ bSkipped = true;
}
}
CPDF_Dictionary* pRoot = GetRoot();
@@ -297,7 +297,7 @@ int CPDF_Document::_GetPageCount() const
}
return _CountPages(pPages, 0);
}
-FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pThisPageDict)
+bool CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pThisPageDict)
{
for (int i = 0; i < m_PageList.GetSize(); i ++) {
CPDF_Dictionary* pPageDict = GetPage(i);
@@ -316,42 +316,42 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary*
continue;
}
if (((CPDF_Reference*) pRef)->GetRefObjNum() == objnum) {
- return TRUE;
+ return true;
}
}
} else if (pContents->GetObjNum() == objnum) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const
+FX_DWORD CPDF_Document::GetUserPermissions(bool bCheckRevision) const
{
if (m_pParser == NULL) {
return (FX_DWORD) - 1;
}
return m_pParser->GetPermissions(bCheckRevision);
}
-FX_BOOL CPDF_Document::IsOwner() const
+bool CPDF_Document::IsOwner() const
{
if (m_pParser == NULL) {
- return TRUE;
+ return true;
}
return m_pParser->IsOwner();
}
-FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const
+bool CPDF_Document::IsFormStream(FX_DWORD objnum, bool& bForm) const
{
{
CPDF_Object* pObj;
if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) {
bForm = pObj->GetType() == PDFOBJ_STREAM &&
((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Form");
- return TRUE;
+ return true;
}
}
if (m_pParser == NULL) {
- bForm = FALSE;
- return TRUE;
+ bForm = false;
+ return true;
}
return m_pParser->IsFormStream(objnum, bForm);
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 9f356a4748..ff6f0e12bd 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -14,7 +14,7 @@ const uint8_t defpasscode[32] = {
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a
};
void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, FX_DWORD pass_size,
- uint8_t* key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray)
+ uint8_t* key, int keylen, bool bIgnoreMeta, CPDF_Array* pIdArray)
{
int revision = pEncrypt->GetInteger(FX_BSTRC("R"));
uint8_t passcode[32];
@@ -57,7 +57,7 @@ CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler()
typedef struct _PDF_CRYPTOITEM {
int32_t m_Cipher;
int32_t m_KeyLen;
- FX_BOOL m_bChecked;
+ bool m_bChecked;
CPDF_StandardCryptoHandler* m_pCryptoHandler;
} PDF_CRYPTOITEM;
CPDF_StandardSecurityHandler::CPDF_StandardSecurityHandler()
@@ -66,7 +66,7 @@ CPDF_StandardSecurityHandler::CPDF_StandardSecurityHandler()
m_Revision = 0;
m_pParser = NULL;
m_pEncryptDict = NULL;
- m_bOwner = FALSE;
+ m_bOwner = false;
m_Permissions = 0;
m_Cipher = FXCIPHER_NONE;
m_KeyLen = 0;
@@ -74,36 +74,36 @@ CPDF_StandardSecurityHandler::CPDF_StandardSecurityHandler()
CPDF_StandardSecurityHandler::~CPDF_StandardSecurityHandler()
{
}
-FX_BOOL CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict)
+bool CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict)
{
m_pParser = pParser;
if (!LoadDict(pEncryptDict)) {
- return FALSE;
+ return false;
}
if (m_Cipher == FXCIPHER_NONE) {
- return TRUE;
+ return true;
}
return CheckSecurity(m_KeyLen);
}
-FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len)
+bool CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len)
{
CFX_ByteString password = m_pParser->GetPassword();
- if (CheckPassword(password, password.GetLength(), TRUE, m_EncryptKey, key_len)) {
+ if (CheckPassword(password, password.GetLength(), true, m_EncryptKey, key_len)) {
if (password.IsEmpty()) {
- if (!CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, key_len)) {
- return FALSE;
+ if (!CheckPassword(password, password.GetLength(), false, m_EncryptKey, key_len)) {
+ return false;
}
}
- m_bOwner = TRUE;
- return TRUE;
+ m_bOwner = true;
+ return true;
}
- return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, key_len);
+ return CheckPassword(password, password.GetLength(), false, m_EncryptKey, key_len);
}
FX_DWORD CPDF_StandardSecurityHandler::GetPermissions()
{
return m_Permissions;
}
-static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStringC& name, int& cipher, int& keylen)
+static bool _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStringC& name, int& cipher, int& keylen)
{
int Version = pEncryptDict->GetInteger(FX_BSTRC("V"));
cipher = FXCIPHER_RC4;
@@ -111,14 +111,14 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStrin
if (Version >= 4) {
CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict(FX_BSTRC("CF"));
if (pCryptFilters == NULL) {
- return FALSE;
+ return false;
}
if (name == FX_BSTRC("Identity")) {
cipher = FXCIPHER_NONE;
} else {
CPDF_Dictionary* pDefFilter = pCryptFilters->GetDict(name);
if (pDefFilter == NULL) {
- return FALSE;
+ return false;
}
int nKeyBits = 0;
if (Version == 4) {
@@ -142,14 +142,14 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStrin
keylen = Version > 1 ? pEncryptDict->GetInteger(FX_BSTRC("Length"), 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict)
+bool CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict)
{
m_pEncryptDict = pEncryptDict;
- m_bOwner = FALSE;
+ m_bOwner = false;
m_Version = pEncryptDict->GetInteger(FX_BSTRC("V"));
m_Revision = pEncryptDict->GetInteger(FX_BSTRC("R"));
m_Permissions = pEncryptDict->GetInteger(FX_BSTRC("P"), -1);
@@ -159,17 +159,17 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict)
CFX_ByteString stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF"));
CFX_ByteString strf_name = pEncryptDict->GetString(FX_BSTRC("StrF"));
if (stmf_name != strf_name) {
- return FALSE;
+ return false;
}
if (!_LoadCryptInfo(pEncryptDict, strf_name, m_Cipher, m_KeyLen)) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX_DWORD type, int& cipher, int& key_len)
+bool CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX_DWORD type, int& cipher, int& key_len)
{
m_pEncryptDict = pEncryptDict;
- m_bOwner = FALSE;
+ m_bOwner = false;
m_Version = pEncryptDict->GetInteger(FX_BSTRC("V"));
m_Revision = pEncryptDict->GetInteger(FX_BSTRC("R"));
m_Permissions = pEncryptDict->GetInteger(FX_BSTRC("P"), -1);
@@ -178,23 +178,23 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX
stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF"));
strf_name = pEncryptDict->GetString(FX_BSTRC("StrF"));
if (stmf_name != strf_name) {
- return FALSE;
+ return false;
}
}
if (!_LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len)) {
- return FALSE;
+ return false;
}
m_Cipher = cipher;
m_KeyLen = key_len;
- return TRUE;
- return TRUE;
+ return true;
+ return true;
}
-FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen)
+bool CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen)
{
cipher = m_Cipher;
buffer = m_EncryptKey;
keylen = m_KeyLen;
- return TRUE;
+ return true;
}
#define FX_GET_32WORD(n,b,i) \
{ \
@@ -252,7 +252,7 @@ void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt,
content.AppendBlock(vector, 48);
}
}
- CRYPT_AESSetKey(aes, 16, key, 16, TRUE);
+ CRYPT_AESSetKey(aes, 16, key, 16, true);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, E, content.GetBuffer(), iBufLen);
int iHash = 0;
@@ -288,16 +288,16 @@ void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt,
FXSYS_memcpy(hash, input, 32);
}
}
-FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size,
- FX_BOOL bOwner, uint8_t* key)
+bool CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size,
+ bool bOwner, uint8_t* key)
{
CFX_ByteString okey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("O")) : CFX_ByteString();
if (okey.GetLength() < 48) {
- return FALSE;
+ return false;
}
CFX_ByteString ukey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("U")) : CFX_ByteString();
if (ukey.GetLength() < 48) {
- return FALSE;
+ return false;
}
const uint8_t* pkey = bOwner ? (const uint8_t*)okey : (const uint8_t*)ukey;
uint8_t sha[128];
@@ -314,10 +314,10 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo
CRYPT_SHA256Finish(sha, digest);
}
if (FXSYS_memcmp(digest, pkey, 32) != 0) {
- return FALSE;
+ return false;
}
if (key == NULL) {
- return TRUE;
+ return true;
}
if (m_Revision >= 6) {
Revision6_Hash(password, size, (const uint8_t*)pkey + 40, (bOwner ? (const uint8_t*)ukey : NULL), digest);
@@ -332,19 +332,19 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo
}
CFX_ByteString ekey = m_pEncryptDict ? m_pEncryptDict->GetString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE")) : CFX_ByteString();
if (ekey.GetLength() < 32) {
- return FALSE;
+ return false;
}
uint8_t* aes = FX_Alloc(uint8_t, 2048);
- CRYPT_AESSetKey(aes, 16, digest, 32, FALSE);
+ CRYPT_AESSetKey(aes, 16, digest, 32, false);
uint8_t iv[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESDecrypt(aes, key, ekey, 32);
- CRYPT_AESSetKey(aes, 16, key, 32, FALSE);
+ CRYPT_AESSetKey(aes, 16, key, 32, false);
CRYPT_AESSetIV(aes, iv);
CFX_ByteString perms = m_pEncryptDict->GetString(FX_BSTRC("Perms"));
if (perms.IsEmpty()) {
- return FALSE;
+ return false;
}
uint8_t perms_buf[16];
FXSYS_memset(perms_buf, 0, sizeof(perms_buf));
@@ -357,21 +357,21 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo
CRYPT_AESDecrypt(aes, buf, perms_buf, 16);
FX_Free(aes);
if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') {
- return FALSE;
+ return false;
}
if (FXDWORD_GET_LSBFIRST(buf) != m_Permissions) {
- return FALSE;
+ return false;
}
if ((buf[8] == 'T' && !IsMetadataEncrypted()) || (buf[8] == 'F' && IsMetadataEncrypted())) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_BOOL bOwner, uint8_t* key)
+int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD pass_size, bool bOwner, uint8_t* key)
{
return CheckPassword(password, pass_size, bOwner, key, m_KeyLen);
}
-int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, uint8_t* key, int32_t key_len)
+int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD size, bool bOwner, uint8_t* key, int32_t key_len)
{
if (m_Revision >= 5) {
return AES256_CheckPassword(password, size, bOwner, key);
@@ -383,16 +383,16 @@ int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWOR
if (bOwner) {
return CheckOwnerPassword(password, size, key, key_len);
}
- return CheckUserPassword(password, size, FALSE, key, key_len) || CheckUserPassword(password, size, TRUE, key, key_len);
+ return CheckUserPassword(password, size, false, key, key_len) || CheckUserPassword(password, size, true, key, key_len);
}
-FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX_DWORD pass_size,
- FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len)
+bool CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX_DWORD pass_size,
+ bool bIgnoreEncryptMeta, uint8_t* key, int32_t key_len)
{
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta,
m_pParser->GetIDArray());
CFX_ByteString ukey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("U")) : CFX_ByteString();
if (ukey.GetLength() < 16) {
- return FALSE;
+ return false;
}
uint8_t ukeybuf[32];
if (m_Revision == 2) {
@@ -425,9 +425,9 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password,
return FXSYS_memcmp(test, ukeybuf, 16) == 0;
}
if (FXSYS_memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size)
{
@@ -480,18 +480,18 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owne
}
return CFX_ByteString(okeybuf, len);
}
-FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size,
+bool CPDF_StandardSecurityHandler::CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size,
uint8_t* key, int32_t key_len)
{
CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
- if (CheckUserPassword(user_pass, user_pass.GetLength(), FALSE, key, key_len)) {
- return TRUE;
+ if (CheckUserPassword(user_pass, user_pass.GetLength(), false, key, key_len)) {
+ return true;
}
- return CheckUserPassword(user_pass, user_pass.GetLength(), TRUE, key, key_len);
+ return CheckUserPassword(user_pass, user_pass.GetLength(), true, key, key_len);
}
-FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted()
+bool CPDF_StandardSecurityHandler::IsMetadataEncrypted()
{
- return m_pEncryptDict->GetBoolean(FX_BSTRC("EncryptMetadata"), TRUE);
+ return m_pEncryptDict->GetBoolean(FX_BSTRC("EncryptMetadata"), true);
}
CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler()
{
@@ -499,7 +499,7 @@ CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler()
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray,
const uint8_t* user_pass, FX_DWORD user_size,
- const uint8_t* owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type)
+ const uint8_t* owner_pass, FX_DWORD owner_size, bool bDefault, FX_DWORD type)
{
int cipher = 0, key_len = 0;
if (!LoadDict(pEncryptDict, type, cipher, key_len)) {
@@ -517,10 +517,10 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
CRYPT_SHA256Update(sha, m_EncryptKey, 32);
CRYPT_SHA256Update(sha, (uint8_t*)"there", 5);
CRYPT_SHA256Finish(sha, m_EncryptKey);
- AES256_SetPassword(pEncryptDict, user_pass, user_size, FALSE, m_EncryptKey);
+ AES256_SetPassword(pEncryptDict, user_pass, user_size, false, m_EncryptKey);
if (bDefault) {
- AES256_SetPassword(pEncryptDict, owner_pass, owner_size, TRUE, m_EncryptKey);
- AES256_SetPerms(pEncryptDict, m_Permissions, pEncryptDict->GetBoolean(FX_BSTRC("EncryptMetadata"), TRUE), m_EncryptKey);
+ AES256_SetPassword(pEncryptDict, owner_pass, owner_size, true, m_EncryptKey);
+ AES256_SetPerms(pEncryptDict, m_Permissions, pEncryptDict->GetBoolean(FX_BSTRC("EncryptMetadata"), true), m_EncryptKey);
}
return;
}
@@ -554,7 +554,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
pEncryptDict->SetAtString(FX_BSTRC("O"), CFX_ByteString(passcode, 32));
}
- CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray);
+ CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey, key_len, false, pIdArray);
if (m_Revision < 3) {
uint8_t tempbuf[32];
FXSYS_memcpy(tempbuf, defpasscode, 32);
@@ -586,13 +586,13 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
const uint8_t* user_pass, FX_DWORD user_size,
const uint8_t* owner_pass, FX_DWORD owner_size, FX_DWORD type)
{
- OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size, TRUE, type);
+ OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size, true, type);
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, FX_DWORD user_size, FX_DWORD type)
{
- OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type);
+ OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, false, type);
}
-void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, const uint8_t* key)
+void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, bool bOwner, const uint8_t* key)
{
uint8_t sha[128];
CRYPT_SHA1Start(sha);
@@ -627,7 +627,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
CRYPT_SHA256Finish(sha, digest1);
}
uint8_t* aes = FX_Alloc(uint8_t, 2048);
- CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE);
+ CRYPT_AESSetKey(aes, 16, digest1, 32, true);
uint8_t iv[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
@@ -636,7 +636,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
pEncryptDict->SetAtString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"), CFX_ByteString(digest1, 32));
}
void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions,
- FX_BOOL bEncryptMetadata, const uint8_t* key)
+ bool bEncryptMetadata, const uint8_t* key)
{
uint8_t buf[16];
buf[0] = (uint8_t)permissions;
@@ -652,7 +652,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict
buf[10] = 'd';
buf[11] = 'b';
uint8_t* aes = FX_Alloc(uint8_t, 2048);
- CRYPT_AESSetKey(aes, 16, key, 32, TRUE);
+ CRYPT_AESSetKey(aes, 16, key, 32, true);
uint8_t iv[16], buf1[16];
FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
@@ -660,7 +660,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict
FX_Free(aes);
pEncryptDict->SetAtString(FX_BSTRC("Perms"), CFX_ByteString(buf1, 16));
}
-void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
+void CPDF_StandardCryptoHandler::CryptBlock(bool bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
uint8_t* dest_buf, FX_DWORD& dest_size)
{
if (m_Cipher == FXCIPHER_NONE) {
@@ -720,18 +720,18 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
}
typedef struct _AESCryptContext {
uint8_t m_Context[2048];
- FX_BOOL m_bIV;
+ bool m_bIV;
uint8_t m_Block[16];
FX_DWORD m_BlockOffset;
} AESCryptContext;
-void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt)
+void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, bool bEncrypt)
{
if (m_Cipher == FXCIPHER_NONE) {
return this;
}
if (m_Cipher == FXCIPHER_AES && m_KeyLen == 32) {
AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
- pContext->m_bIV = TRUE;
+ pContext->m_bIV = true;
pContext->m_BlockOffset = 0;
CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt);
if (bEncrypt) {
@@ -757,7 +757,7 @@ void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, F
}
if (m_Cipher == FXCIPHER_AES) {
AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
- pContext->m_bIV = TRUE;
+ pContext->m_bIV = true;
pContext->m_BlockOffset = 0;
CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt);
if (bEncrypt) {
@@ -772,25 +772,25 @@ void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, F
CRYPT_ArcFourSetup(pContext, realkey, realkeylen);
return pContext;
}
-FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt)
+bool CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, bool bEncrypt)
{
if (!context) {
- return FALSE;
+ return false;
}
if (m_Cipher == FXCIPHER_NONE) {
dest_buf.AppendBlock(src_buf, src_size);
- return TRUE;
+ return true;
}
if (m_Cipher == FXCIPHER_RC4) {
int old_size = dest_buf.GetSize();
dest_buf.AppendBlock(src_buf, src_size);
CRYPT_ArcFourCrypt(context, dest_buf.GetBuffer() + old_size, src_size);
- return TRUE;
+ return true;
}
AESCryptContext* pContext = (AESCryptContext*)context;
if (pContext->m_bIV && bEncrypt) {
dest_buf.AppendBlock(pContext->m_Block, 16);
- pContext->m_bIV = FALSE;
+ pContext->m_bIV = false;
}
FX_DWORD src_off = 0;
FX_DWORD src_left = src_size;
@@ -806,7 +806,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* sr
if (pContext->m_BlockOffset == 16) {
if (!bEncrypt && pContext->m_bIV) {
CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block);
- pContext->m_bIV = FALSE;
+ pContext->m_bIV = false;
pContext->m_BlockOffset = 0;
} else if (src_off < src_size) {
uint8_t block_buf[16];
@@ -823,19 +823,19 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* sr
break;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt)
+bool CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, bool bEncrypt)
{
if (!context) {
- return FALSE;
+ return false;
}
if (m_Cipher == FXCIPHER_NONE) {
- return TRUE;
+ return true;
}
if (m_Cipher == FXCIPHER_RC4) {
FX_Free(context);
- return TRUE;
+ return true;
}
AESCryptContext* pContext = (AESCryptContext*)context;
if (bEncrypt) {
@@ -856,24 +856,24 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& de
}
}
FX_Free(pContext);
- return TRUE;
+ return true;
}
void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum)
{
- return CryptStart(objnum, gennum, FALSE);
+ return CryptStart(objnum, gennum, false);
}
FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size)
{
return m_Cipher == FXCIPHER_AES ? src_size - 16 : src_size;
}
-FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler)
+bool CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler)
{
const uint8_t* key;
if (!pSecurityHandler->GetCryptInfo(m_Cipher, key, m_KeyLen)) {
- return FALSE;
+ return false;
}
if (m_KeyLen > 32 || m_KeyLen < 0) {
- return FALSE;
+ return false;
}
if (m_Cipher != FXCIPHER_NONE) {
FXSYS_memcpy(m_EncryptKey, key, m_KeyLen);
@@ -881,9 +881,9 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen)
+bool CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen)
{
if (cipher == FXCIPHER_AES) {
switch(keylen) {
@@ -892,15 +892,15 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int key
case 32:
break;
default:
- return FALSE;
+ return false;
}
} else if (cipher == FXCIPHER_AES2) {
if (keylen != 32) {
- return FALSE;
+ return false;
}
} else if (cipher == FXCIPHER_RC4) {
if (keylen < 5 || keylen > 16) {
- return FALSE;
+ return false;
}
} else {
if (keylen > 32) {
@@ -913,16 +913,16 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int key
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size,
+bool CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size,
CFX_BinaryBuf& dest_buf)
{
- return CryptStream(context, src_buf, src_size, dest_buf, FALSE);
+ return CryptStream(context, src_buf, src_size, dest_buf, false);
}
-FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf)
+bool CPDF_StandardCryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf)
{
- return CryptFinish(context, dest_buf, FALSE);
+ return CryptFinish(context, dest_buf, false);
}
FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size)
{
@@ -931,11 +931,11 @@ FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD ve
}
return src_size;
}
-FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
+bool CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
uint8_t* dest_buf, FX_DWORD& dest_size)
{
- CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
- return TRUE;
+ CryptBlock(true, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
+ return true;
}
void CPDF_CryptoHandler::Decrypt(FX_DWORD objnum, FX_DWORD gennum, CFX_ByteString& str)
{
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index 1958fab280..ffce46bdd2 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -9,7 +9,7 @@ CFDF_Document::CFDF_Document() : CPDF_IndirectObjects(NULL)
{
m_pRootDict = NULL;
m_pFile = NULL;
- m_bOwnFile = FALSE;
+ m_bOwnFile = false;
}
CFDF_Document::~CFDF_Document()
{
@@ -26,7 +26,7 @@ CFDF_Document* CFDF_Document::CreateNewDoc()
pDoc->m_pRootDict->SetAt(FX_BSTRC("FDF"), pFDFDict);
return pDoc;
}
-CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile)
+CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, bool bOwnFile)
{
if (!pFile) {
return NULL;
@@ -41,16 +41,16 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile)
}
CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size)
{
- return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), TRUE);
+ return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), true);
}
-void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile)
+void CFDF_Document::ParseStream(IFX_FileRead *pFile, bool bOwnFile)
{
m_pFile = pFile;
m_bOwnFile = bOwnFile;
CPDF_SyntaxParser parser;
parser.InitParser(m_pFile, 0);
while (1) {
- FX_BOOL bNumber;
+ bool bNumber;
CFX_ByteString word = parser.GetNextWord(bNumber);
if (bNumber) {
FX_DWORD objnum = FXSYS_atoi(word);
@@ -85,10 +85,10 @@ void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile)
}
}
}
-FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const
+bool CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const
{
if (m_pRootDict == NULL) {
- return FALSE;
+ return false;
}
buf << FX_BSTRC("%FDF-1.2\r\n");
FX_POSITION pos = m_IndirectObjs.GetStartPosition();
@@ -99,7 +99,7 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const
buf << (FX_DWORD)objnum << FX_BSTRC(" 0 obj\r\n") << pObj << FX_BSTRC("\r\nendobj\r\n\r\n");
}
buf << FX_BSTRC("trailer\r\n<</Root ") << m_pRootDict->GetObjNum() << FX_BSTRC(" 0 R>>\r\n%%EOF\r\n");
- return TRUE;
+ return true;
}
CFX_WideString CFDF_Document::GetWin32Path() const
{
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
index fed4546fab..f81aa73cb3 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
@@ -25,7 +25,7 @@ static void my_free_func(void* opaque, void* address)
CFX_DataFilter::CFX_DataFilter()
{
- m_bEOF = FALSE;
+ m_bEOF = false;
m_pDestFilter = NULL;
m_SrcPos = 0;
}
@@ -68,14 +68,14 @@ void CFX_DataFilter::FilterFinish(CFX_BinaryBuf& dest_buf)
} else {
v_FilterFinish(dest_buf);
}
- m_bEOF = TRUE;
+ m_bEOF = true;
}
void CFX_DataFilter::ReportEOF(FX_DWORD left_input)
{
if (m_bEOF) {
return;
}
- m_bEOF = TRUE;
+ m_bEOF = true;
m_SrcPos -= left_input;
}
CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictionary* pParam, int width, int height)
@@ -113,9 +113,9 @@ CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictio
return new CPDF_RunLenFilter;
case FXBSTR_ID('C', 'C', 'I', 'T'): {
int Encoding = 0;
- int bEndOfLine = FALSE;
- int bByteAlign = FALSE;
- int bBlack = FALSE;
+ int bEndOfLine = false;
+ int bByteAlign = false;
+ int bBlack = false;
int nRows = 0;
int nColumns = 1728;
if (pParam) {
@@ -178,7 +178,7 @@ CFX_DataFilter* _FPDF_CreateFilterFromDict(CPDF_Dictionary* pDict)
}
return pFirstFilter;
}
-CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(FX_BOOL bRaw) const
+CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(bool bRaw) const
{
CFX_DataFilter* pFirstFilter = NULL;
if (m_pCryptoHandler) {
@@ -294,7 +294,7 @@ void CPDF_DecryptFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, C
}
void CPDF_DecryptFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf)
{
- m_bEOF = TRUE;
+ m_bEOF = true;
if (m_pContext == NULL) {
return;
}
@@ -330,7 +330,7 @@ void CPDF_FlateFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX
}
}
}
-CPDF_LzwFilter::CPDF_LzwFilter(FX_BOOL bEarlyChange)
+CPDF_LzwFilter::CPDF_LzwFilter(bool bEarlyChange)
{
m_bEarlyChange = bEarlyChange ? 1 : 0;
m_CodeLen = 9;
@@ -697,7 +697,7 @@ void CPDF_RunLenFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CF
CPDF_JpegFilter::CPDF_JpegFilter()
{
m_pContext = NULL;
- m_bGotHeader = FALSE;
+ m_bGotHeader = false;
m_pScanline = NULL;
m_iLine = 0;
}
@@ -742,7 +742,7 @@ void CPDF_JpegFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_
return;
}
CPDF_ModuleMgr::Get()->GetJpegModule()->StartScanline(m_pContext, 1);
- m_bGotHeader = TRUE;
+ m_bGotHeader = true;
m_Pitch = m_Width * m_nComps;
}
if (m_pScanline == NULL) {
@@ -765,9 +765,9 @@ void CPDF_JpegFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_
CPDF_FaxFilter::CPDF_FaxFilter()
{
m_Encoding = 0;
- m_bEndOfLine = FALSE;
- m_bByteAlign = FALSE;
- m_bBlack = FALSE;
+ m_bEndOfLine = false;
+ m_bByteAlign = false;
+ m_bBlack = false;
m_nRows = 0;
m_nColumns = 0;
m_Pitch = 0;
@@ -785,7 +785,7 @@ CPDF_FaxFilter::~CPDF_FaxFilter()
FX_Free(m_pRefBuf);
}
}
-FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns)
+bool CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns)
{
m_Encoding = Encoding;
m_bEndOfLine = bEndOfLine;
@@ -800,7 +800,7 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign,
FXSYS_memset(m_pRefBuf, 0xff, m_Pitch);
m_iRow = 0;
m_InputBitPos = 0;
- return TRUE;
+ return true;
}
void CPDF_FaxFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
@@ -821,19 +821,19 @@ void CPDF_FaxFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_B
fax_src_size = src_size;
bitpos = 0;
}
- ProcessData(fax_src_buf, fax_src_size, bitpos, FALSE, dest_buf);
+ ProcessData(fax_src_buf, fax_src_size, bitpos, false, dest_buf);
int left_bits = fax_src_size * 8 - bitpos;
m_InputBuf.AppendBlock(fax_src_buf + bitpos / 8, (left_bits + 7) / 8);
m_InputBitPos = bitpos % 8;
}
void CPDF_FaxFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf)
{
- ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, TRUE, dest_buf);
+ ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, true, dest_buf);
}
-FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos);
-FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns);
-FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns);
-void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
+bool _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos);
+bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns);
+bool _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns);
+void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, bool bFinish,
CFX_BinaryBuf& dest_buf)
{
int bitsize = src_size * 8;
@@ -863,21 +863,21 @@ void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int&
}
}
}
-FX_BOOL CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos)
+bool CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos)
{
if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) {
- return FALSE;
+ return false;
}
- FX_BOOL ret;
+ bool ret;
if (m_Encoding < 0) {
ret = _FaxG4GetRow(src_buf, bitsize, bitpos, m_pScanlineBuf, m_pRefBuf, m_nColumns);
} else if (m_Encoding == 0) {
ret = _FaxGet1DLine(src_buf, bitsize, bitpos, m_pScanlineBuf, m_nColumns);
} else {
if (bitpos == bitsize) {
- return FALSE;
+ return false;
}
- FX_BOOL bNext1D = src_buf[bitpos / 8] & (1 << (7 - bitpos % 8));
+ bool bNext1D = src_buf[bitpos / 8] & (1 << (7 - bitpos % 8));
bitpos ++;
if (bNext1D) {
ret = _FaxGet1DLine(src_buf, bitsize, bitpos, m_pScanlineBuf, m_nColumns);
@@ -886,14 +886,14 @@ FX_BOOL CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpo
}
}
if (!ret) {
- return FALSE;
+ return false;
}
if (m_bEndOfLine)
if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) {
- return FALSE;
+ return false;
}
if (m_bByteAlign) {
bitpos = (bitpos + 7) / 8 * 8;
}
- return TRUE;
+ return true;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index c7d1dece25..96e6807102 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -180,7 +180,7 @@ void CPDF_Object::SetString(const CFX_ByteString& str)
((CPDF_Name*)this)->m_Name = str;
return;
}
- ASSERT(FALSE);
+ ASSERT(false);
}
int CPDF_Object::GetDirectType() const
{
@@ -190,13 +190,13 @@ int CPDF_Object::GetDirectType() const
CPDF_Reference* pRef = (CPDF_Reference*)this;
return pRef->m_pObjList->GetIndirectType(pRef->m_RefObjNum);
}
-FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const
+bool CPDF_Object::IsIdentical(CPDF_Object* pOther) const
{
if (this == pOther) {
- return TRUE;
+ return true;
}
if (pOther == NULL) {
- return FALSE;
+ return false;
}
if (pOther->m_Type != m_Type) {
if (m_Type == PDFOBJ_REFERENCE && GetDirect()) {
@@ -205,7 +205,7 @@ FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const
if (pOther->m_Type == PDFOBJ_REFERENCE) {
return IsIdentical(pOther->GetDirect());
}
- return FALSE;
+ return false;
}
switch (m_Type) {
case PDFOBJ_BOOLEAN:
@@ -221,13 +221,13 @@ FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const
case PDFOBJ_DICTIONARY:
return (((CPDF_Dictionary*)this)->Identical((CPDF_Dictionary*)pOther));
case PDFOBJ_NULL:
- return TRUE;
+ return true;
case PDFOBJ_STREAM:
return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther));
case PDFOBJ_REFERENCE:
return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther));
}
- return FALSE;
+ return false;
}
CPDF_Object* CPDF_Object::GetDirect() const
{
@@ -240,12 +240,12 @@ CPDF_Object* CPDF_Object::GetDirect() const
}
return pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum);
}
-CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const
+CPDF_Object* CPDF_Object::Clone(bool bDirect) const
{
CFX_MapPtrToPtr visited;
return CloneInternal(bDirect, &visited);
}
-CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const
+CPDF_Object* CPDF_Object::CloneInternal(bool bDirect, CFX_MapPtrToPtr* visited) const
{
switch (m_Type) {
case PDFOBJ_BOOLEAN:
@@ -284,7 +284,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite
case PDFOBJ_STREAM: {
CPDF_Stream* pThis = (CPDF_Stream*)this;
CPDF_StreamAcc acc;
- acc.LoadAllData(pThis, TRUE);
+ acc.LoadAllData(pThis, true);
FX_DWORD streamSize = acc.GetSize();
CPDF_Dictionary* pDict = pThis->GetDict();
if (pDict)
@@ -299,7 +299,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite
if (!pRef->GetDirect())
return nullptr;
- return pRef->GetDirect()->CloneInternal(TRUE, visited);
+ return pRef->GetDirect()->CloneInternal(true, visited);
}
return new CPDF_Reference(pRef->m_pObjList, obj_num);
}
@@ -320,7 +320,7 @@ CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const
}
if (m_Type == PDFOBJ_STREAM) {
CPDF_StreamAcc stream;
- stream.LoadAllData((CPDF_Stream*)this, FALSE);
+ stream.LoadAllData((CPDF_Stream*)this, false);
CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize(), pCharMap);
return result;
}
@@ -335,19 +335,19 @@ void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len)
((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len);
} else if (m_Type == PDFOBJ_STREAM) {
CFX_ByteString result = PDF_EncodeText(pUnicodes, len);
- ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength(), FALSE, FALSE);
+ ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength(), false, false);
}
}
CPDF_Number::CPDF_Number(int value)
- : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) {
+ : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(true), m_Integer(value) {
}
CPDF_Number::CPDF_Number(FX_FLOAT value)
- : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) {
+ : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Float(value) {
}
-CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData)
+CPDF_Number::CPDF_Number(bool bInteger, void* pData)
: CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData) {
}
@@ -359,7 +359,7 @@ void CPDF_Number::SetString(const CFX_ByteStringC& str)
{
FX_atonum(str, m_bInteger, &m_Integer);
}
-FX_BOOL CPDF_Number::Identical(CPDF_Number* pOther) const
+bool CPDF_Number::Identical(CPDF_Number* pOther) const
{
return m_bInteger == pOther->m_bInteger && m_Integer == pOther->m_Integer;
}
@@ -369,10 +369,10 @@ CFX_ByteString CPDF_Number::GetString() const
}
void CPDF_Number::SetNumber(FX_FLOAT value)
{
- m_bInteger = FALSE;
+ m_bInteger = false;
m_Float = value;
}
-CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) {
+CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING), m_bHex(false) {
m_String = PDF_EncodeText(str);
}
CPDF_Array::~CPDF_Array()
@@ -553,16 +553,16 @@ void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum)
ASSERT(m_Type == PDFOBJ_ARRAY);
Add(new CPDF_Reference(pDoc, objnum));
}
-FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const
+bool CPDF_Array::Identical(CPDF_Array* pOther) const
{
if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) {
- return FALSE;
+ return false;
}
for (int i = 0; i < m_Objects.GetSize(); i ++)
if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_Objects[i])) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
CPDF_Dictionary::~CPDF_Dictionary()
{
@@ -677,7 +677,7 @@ FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const
}
return 0;
}
-FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, FX_BOOL bDefault) const
+bool CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, bool bDefault) const
{
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
@@ -734,7 +734,7 @@ CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const
}
return matrix;
}
-FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const
+bool CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const
{
void* value;
return m_Map.Lookup(key, value);
@@ -786,13 +786,13 @@ void CPDF_Dictionary::ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteSt
m_Map.RemoveKey(oldkey);
m_Map.SetAt(newkey, p);
}
-FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const
+bool CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const
{
if (pOther == NULL) {
- return FALSE;
+ return false;
}
if (m_Map.GetCount() != pOther->m_Map.GetCount()) {
- return FALSE;
+ return false;
}
FX_POSITION pos = m_Map.GetStartPosition();
while (pos) {
@@ -800,12 +800,12 @@ FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const
void* value;
m_Map.GetNextAssoc(pos, key, value);
if (!value)
- return FALSE;
+ return false;
if (!((CPDF_Object*)value)->IsIdentical(pOther->GetElement(key))) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
void CPDF_Dictionary::SetAtInteger(const CFX_ByteStringC& key, int i)
{
@@ -833,7 +833,7 @@ void CPDF_Dictionary::SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f)
pNumber->SetNumber(f);
SetAt(key, pNumber);
}
-void CPDF_Dictionary::SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue)
+void CPDF_Dictionary::SetAtBoolean(const CFX_ByteStringC& key, bool bValue)
{
SetAt(key, new CPDF_Boolean(bValue));
}
@@ -905,7 +905,7 @@ void CPDF_Stream::InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDi
m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
}
}
-void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf)
+void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, bool bCompressed, bool bKeepBuf)
{
if (m_GenNum == (FX_DWORD) - 1) {
if (m_pDataBuf) {
@@ -933,7 +933,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompress
m_pDict->RemoveAt(FX_BSTRC("DecodeParms"));
}
}
-FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) const
+bool CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) const
{
if ((m_GenNum != (FX_DWORD) - 1) && m_pFile) {
return m_pFile->ReadBlock(buf, m_FileOffset + offset, size);
@@ -941,7 +941,7 @@ FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size
if (m_pDataBuf) {
FXSYS_memcpy(buf, m_pDataBuf + offset, size);
}
- return TRUE;
+ return true;
}
void CPDF_Stream::InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict)
{
@@ -952,23 +952,23 @@ void CPDF_Stream::InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict)
m_pDict->SetAtInteger(FX_BSTRC("Length"), m_dwSize);
}
}
-FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
+bool CPDF_Stream::Identical(CPDF_Stream* pOther) const
{
if (!m_pDict)
- return pOther->m_pDict ? FALSE : TRUE;
+ return pOther->m_pDict ? false : true;
if (!m_pDict->Identical(pOther->m_pDict)) {
- return FALSE;
+ return false;
}
if (m_dwSize != pOther->m_dwSize) {
- return FALSE;
+ return false;
}
if (m_GenNum != (FX_DWORD) - 1 && pOther->m_GenNum != (FX_DWORD) - 1) {
if (m_pFile == pOther->m_pFile && m_pFile == NULL) {
- return TRUE;
+ return true;
}
if (!m_pFile || !pOther->m_pFile) {
- return FALSE;
+ return false;
}
uint8_t srcBuf[1024];
uint8_t destBuf[1024];
@@ -976,20 +976,20 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
FX_DWORD srcOffset = m_FileOffset;
FX_DWORD destOffset = pOther->m_FileOffset;
if (m_pFile == pOther->m_pFile && srcOffset == destOffset) {
- return TRUE;
+ return true;
}
while (size > 0) {
FX_DWORD actualSize = size > 1024 ? 1024 : size;
m_pFile->ReadBlock(srcBuf, srcOffset, actualSize);
pOther->m_pFile->ReadBlock(destBuf, destOffset, actualSize);
if (FXSYS_memcmp(srcBuf, destBuf, actualSize) != 0) {
- return FALSE;
+ return false;
}
size -= actualSize;
srcOffset += actualSize;
destOffset += actualSize;
}
- return TRUE;
+ return true;
}
if (m_GenNum != (FX_DWORD) - 1 || pOther->m_GenNum != (FX_DWORD) - 1) {
IFX_FileRead* pFile = NULL;
@@ -1005,7 +1005,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
offset = m_FileOffset;
}
if (NULL == pBuf) {
- return FALSE;
+ return false;
}
uint8_t srcBuf[1024];
FX_DWORD size = m_dwSize;
@@ -1013,17 +1013,17 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
FX_DWORD actualSize = std::min(size, 1024U);
pFile->ReadBlock(srcBuf, offset, actualSize);
if (FXSYS_memcmp(srcBuf, pBuf, actualSize) != 0) {
- return FALSE;
+ return false;
}
pBuf += actualSize;
size -= actualSize;
offset += actualSize;
}
- return TRUE;
+ return true;
}
return FXSYS_memcmp(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0;
}
-CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const
+CPDF_Stream* CPDF_Stream::Clone(bool bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const
{
CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect);
IFX_FileStream *pFS = NULL;
@@ -1032,12 +1032,12 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf
}
if (!pFS) {
CPDF_StreamAcc acc;
- acc.LoadAllData(this, TRUE);
+ acc.LoadAllData(this, true);
FX_DWORD streamSize = acc.GetSize();
return new CPDF_Stream(acc.DetachData(), streamSize, pCloneDict);
}
CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL);
- CPDF_StreamFilter *pSF = GetStreamFilter(TRUE);
+ CPDF_StreamFilter *pSF = GetStreamFilter(true);
if (pSF) {
uint8_t* pBuf = FX_Alloc(uint8_t, 4096);
FX_DWORD dwRead;
@@ -1054,20 +1054,20 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf
pObj->InitStream((IFX_FileRead*)pFS, pCloneDict);
return pObj;
}
-extern FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
+extern bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding,
- CPDF_Dictionary*& pImageParms, FX_DWORD estimated_size, FX_BOOL bImageAcc);
+ CPDF_Dictionary*& pImageParms, FX_DWORD estimated_size, bool bImageAcc);
CPDF_StreamAcc::CPDF_StreamAcc()
{
- m_bNewBuf = FALSE;
+ m_bNewBuf = false;
m_pData = NULL;
m_dwSize = 0;
m_pImageParam = NULL;
m_pStream = NULL;
m_pSrcData = NULL;
}
-void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, FX_DWORD estimated_size,
- FX_BOOL bImageAcc)
+void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, bool bRawAccess, FX_DWORD estimated_size,
+ bool bImageAcc)
{
if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
return;
@@ -1111,7 +1111,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess,
m_pData = pDecryptedData;
m_dwSize = dwDecryptedSize;
} else {
- FX_BOOL bRet = PDF_DataDecode(pDecryptedData, dwDecryptedSize, m_pStream->GetDict(),
+ bool bRet = PDF_DataDecode(pDecryptedData, dwDecryptedSize, m_pStream->GetDict(),
m_pData, m_dwSize, m_ImageDecoder, m_pImageParam, estimated_size, bImageAcc);
if (!bRet) {
m_pData = pDecryptedData;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 854be75ad4..07f6ca783c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -13,19 +13,19 @@
#include "../../../include/fxcrt/fx_safe_types.h"
#include "../fpdf_page/pageint.h"
-FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict)
+bool IsSignatureDict(const CPDF_Dictionary* pDict)
{
CPDF_Object* pType = pDict->GetElementValue(FX_BSTRC("Type"));
if (!pType) {
pType = pDict->GetElementValue(FX_BSTRC("FT"));
if (!pType) {
- return FALSE;
+ return false;
}
}
if (pType->GetString() == FX_BSTRC("Sig")) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static int _CompareFileSize(const void* p1, const void* p2)
{
@@ -48,13 +48,13 @@ CPDF_Parser::CPDF_Parser()
m_pLinearized = NULL;
m_dwFirstPageNo = 0;
m_dwXrefStartObjNum = 0;
- m_bOwnFileRead = TRUE;
+ m_bOwnFileRead = true;
m_FileVersion = 0;
- m_bForceUseSecurityHandler = FALSE;
+ m_bForceUseSecurityHandler = false;
}
CPDF_Parser::~CPDF_Parser()
{
- CloseParser(FALSE);
+ CloseParser(false);
}
FX_DWORD CPDF_Parser::GetLastObjNum()
{
@@ -65,9 +65,9 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict)
{
m_pEncryptDict = pDict;
}
-void CPDF_Parser::CloseParser(FX_BOOL bReParse)
+void CPDF_Parser::CloseParser(bool bReParse)
{
- m_bVersionUpdated = FALSE;
+ m_bVersionUpdated = false;
if (!bReParse) {
delete m_pDocument;
m_pDocument = NULL;
@@ -124,7 +124,7 @@ static int32_t GetHeaderOffset(IFX_FileRead* pFile)
}
return -1;
}
-FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse)
+FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, bool bReParse)
{
IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
if (!pFileAccess) {
@@ -132,7 +132,7 @@ FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse)
}
return StartParse(pFileAccess, bReParse);
}
-FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse)
+FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, bool bReParse)
{
IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
if (!pFileAccess) {
@@ -142,10 +142,10 @@ FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse)
}
CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler();
CPDF_SecurityHandler* FPDF_CreatePubKeyHandler(void*);
-FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX_BOOL bOwnFileRead)
+FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, bool bReParse, bool bOwnFileRead)
{
CloseParser(bReParse);
- m_bXRefStream = FALSE;
+ m_bXRefStream = false;
m_LastXRefOffset = 0;
m_bOwnFileRead = bOwnFileRead;
int32_t offset = GetHeaderOffset(pFileAccess);
@@ -176,15 +176,15 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX
if (!bReParse) {
m_pDocument = new CPDF_Document(this);
}
- FX_BOOL bXRefRebuilt = FALSE;
- if (m_Syntax.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, 4096)) {
+ bool bXRefRebuilt = false;
+ if (m_Syntax.SearchWord(FX_BSTRC("startxref"), true, false, 4096)) {
FX_FILESIZE startxref_offset = m_Syntax.SavePos();
void* pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(startxref_offset);
}
m_Syntax.GetKeyword();
- FX_BOOL bNumber;
+ bool bNumber;
CFX_ByteString xrefpos_str = m_Syntax.GetNextWord(bNumber);
if (!bNumber) {
return PDFPARSE_ERROR_FORMAT;
@@ -194,14 +194,14 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX
if (!RebuildCrossRef()) {
return PDFPARSE_ERROR_FORMAT;
}
- bXRefRebuilt = TRUE;
+ bXRefRebuilt = true;
m_LastXRefOffset = 0;
}
} else {
if (!RebuildCrossRef()) {
return PDFPARSE_ERROR_FORMAT;
}
- bXRefRebuilt = TRUE;
+ bXRefRebuilt = true;
}
FX_DWORD dwRet = SetEncryptHandler();
if (dwRet != PDFPARSE_ERROR_SUCCESS) {
@@ -340,26 +340,26 @@ static int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& k
}
return 0;
}
-static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, const CFX_ByteStringC& key, int32_t iType)
+static bool CheckDirectType(CPDF_Dictionary* pDict, const CFX_ByteStringC& key, int32_t iType)
{
CPDF_Object* pObj = pDict->GetElement(key);
if (!pObj) {
- return TRUE;
+ return true;
}
return pObj->GetType() == iType;
}
-FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos)
+bool CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos)
{
- if (!LoadCrossRefV4(xrefpos, 0, TRUE, FALSE)) {
- return FALSE;
+ if (!LoadCrossRefV4(xrefpos, 0, true, false)) {
+ return false;
}
m_pTrailer = LoadTrailerV4();
if (m_pTrailer == NULL) {
- return FALSE;
+ return false;
}
int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
if (xrefsize <= 0 || xrefsize > (1 << 20)) {
- return FALSE;
+ return false;
}
m_CrossRef.SetSize(xrefsize);
m_V5Type.SetSize(xrefsize);
@@ -367,51 +367,51 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos)
CrossRefList.Add(xrefpos);
XRefStreamList.Add(GetDirectInteger(m_pTrailer, FX_BSTRC("XRefStm")));
if (!CheckDirectType(m_pTrailer, FX_BSTRC("Prev"), PDFOBJ_NUMBER)) {
- return FALSE;
+ return false;
}
FX_FILESIZE newxrefpos = GetDirectInteger(m_pTrailer, FX_BSTRC("Prev"));
if (newxrefpos == xrefpos) {
- return FALSE;
+ return false;
}
xrefpos = newxrefpos;
while (xrefpos) {
CrossRefList.InsertAt(0, xrefpos);
- LoadCrossRefV4(xrefpos, 0, TRUE, FALSE);
+ LoadCrossRefV4(xrefpos, 0, true, false);
CPDF_Dictionary* pDict = LoadTrailerV4();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
if (!CheckDirectType(pDict, FX_BSTRC("Prev"), PDFOBJ_NUMBER)) {
pDict->Release();
- return FALSE;
+ return false;
}
newxrefpos = GetDirectInteger(pDict, FX_BSTRC("Prev"));
if (newxrefpos == xrefpos) {
pDict->Release();
- return FALSE;
+ return false;
}
xrefpos = newxrefpos;
XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm")));
m_Trailers.Add(pDict);
}
for (int32_t i = 0; i < CrossRefList.GetSize(); i ++)
- if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) {
- return FALSE;
+ if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], false, i == 0)) {
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD dwObjCount)
+bool CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD dwObjCount)
{
if (!LoadLinearizedCrossRefV4(xrefpos, dwObjCount)) {
- return FALSE;
+ return false;
}
m_pTrailer = LoadTrailerV4();
if (m_pTrailer == NULL) {
- return FALSE;
+ return false;
}
int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
if (xrefsize == 0) {
- return FALSE;
+ return false;
}
CFX_FileSizeArray CrossRefList, XRefStreamList;
CrossRefList.Add(xrefpos);
@@ -419,22 +419,22 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d
xrefpos = GetDirectInteger(m_pTrailer, FX_BSTRC("Prev"));
while (xrefpos) {
CrossRefList.InsertAt(0, xrefpos);
- LoadCrossRefV4(xrefpos, 0, TRUE, FALSE);
+ LoadCrossRefV4(xrefpos, 0, true, false);
CPDF_Dictionary* pDict = LoadTrailerV4();
if (pDict == NULL) {
- return FALSE;
+ return false;
}
xrefpos = GetDirectInteger(pDict, FX_BSTRC("Prev"));
XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm")));
m_Trailers.Add(pDict);
}
for (int32_t i = 1; i < CrossRefList.GetSize(); i ++)
- if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) {
- return FALSE;
+ if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], false, i == 0)) {
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount)
+bool CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount)
{
FX_FILESIZE dwStartPos = pos - m_Syntax.m_HeaderOffset;
m_Syntax.RestorePos(dwStartPos);
@@ -454,11 +454,11 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
FX_DWORD dwReadSize = block_size * recordsize;
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) {
FX_Free(pBuf);
- return FALSE;
+ return false;
}
if (!m_Syntax.ReadBlock((uint8_t*)pBuf, dwReadSize)) {
FX_Free(pBuf);
- return FALSE;
+ return false;
}
for (int32_t i = 0; i < block_size; i ++) {
FX_DWORD objnum = start_objnum + block * 1024 + i;
@@ -472,14 +472,14 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
for (int32_t c = 0; c < 10; c ++) {
if (pEntry[c] < '0' || pEntry[c] > '9') {
FX_Free(pBuf);
- return FALSE;
+ return false;
}
}
}
m_CrossRef.SetAtGrow(objnum, offset);
int32_t version = FXSYS_atoi(pEntry + 11);
if (version >= 1) {
- m_bVersionUpdated = TRUE;
+ m_bVersionUpdated = true;
}
m_ObjVersion.SetAtGrow(objnum, version);
if (m_CrossRef[objnum] < m_Syntax.m_FileLen) {
@@ -494,13 +494,13 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
}
FX_Free(pBuf);
m_Syntax.RestorePos(SavedPos + count * recordsize);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip, FX_BOOL bFirst)
+bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bSkip, bool bFirst)
{
m_Syntax.RestorePos(pos);
if (m_Syntax.GetKeyword() != FX_BSTRC("xref")) {
- return FALSE;
+ return false;
}
void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
@@ -514,10 +514,10 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
}
while (1) {
FX_FILESIZE SavedPos = m_Syntax.SavePos();
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString word = m_Syntax.GetNextWord(bIsNumber);
if (word.IsEmpty()) {
- return FALSE;
+ return false;
}
if (!bIsNumber) {
m_Syntax.RestorePos(SavedPos);
@@ -525,22 +525,22 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
}
FX_DWORD start_objnum = FXSYS_atoi(word);
if (start_objnum >= (1 << 20)) {
- return FALSE;
+ return false;
}
FX_DWORD count = m_Syntax.GetDirectNum();
m_Syntax.ToNextWord();
SavedPos = m_Syntax.SavePos();
- FX_BOOL bFirstItem = FALSE;
+ bool bFirstItem = false;
int32_t recordsize = 20;
if (bFirst) {
- bFirstItem = TRUE;
+ bFirstItem = true;
}
m_dwXrefStartObjNum = start_objnum;
if (!bSkip) {
char* pBuf = FX_Alloc(char, 1024 * recordsize + 1);
pBuf[1024 * recordsize] = '\0';
int32_t nBlocks = count / 1024 + 1;
- FX_BOOL bFirstBlock = TRUE;
+ bool bFirstBlock = true;
for (int32_t block = 0; block < nBlocks; block ++) {
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
m_Syntax.ReadBlock((uint8_t*)pBuf, block_size * recordsize);
@@ -550,7 +550,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
if (pEntry[17] == 'f') {
if (bFirstItem) {
objnum = 0;
- bFirstItem = FALSE;
+ bFirstItem = false;
}
if (bFirstBlock) {
FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry);
@@ -568,14 +568,14 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
for (int32_t c = 0; c < 10; c ++) {
if (pEntry[c] < '0' || pEntry[c] > '9') {
FX_Free(pBuf);
- return FALSE;
+ return false;
}
}
}
m_CrossRef.SetAtGrow(objnum, offset);
int32_t version = FXSYS_atoi(pEntry + 11);
if (version >= 1) {
- m_bVersionUpdated = TRUE;
+ m_bVersionUpdated = true;
}
m_ObjVersion.SetAtGrow(objnum, version);
if (m_CrossRef[objnum] < m_Syntax.m_FileLen) {
@@ -587,7 +587,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
m_V5Type.SetAtGrow(objnum, 1);
}
if (bFirstBlock) {
- bFirstBlock = FALSE;
+ bFirstBlock = false;
}
}
}
@@ -596,25 +596,25 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
m_Syntax.RestorePos(SavedPos + count * recordsize);
}
if (streampos)
- if (!LoadCrossRefV5(streampos, streampos, FALSE)) {
- return FALSE;
+ if (!LoadCrossRefV5(streampos, streampos, false)) {
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Parser::LoadAllCrossRefV5(FX_FILESIZE xrefpos)
+bool CPDF_Parser::LoadAllCrossRefV5(FX_FILESIZE xrefpos)
{
- if (!LoadCrossRefV5(xrefpos, xrefpos, TRUE)) {
- return FALSE;
+ if (!LoadCrossRefV5(xrefpos, xrefpos, true)) {
+ return false;
}
while (xrefpos)
- if (!LoadCrossRefV5(xrefpos, xrefpos, FALSE)) {
- return FALSE;
+ if (!LoadCrossRefV5(xrefpos, xrefpos, false)) {
+ return false;
}
- m_ObjectStreamMap.InitHashTable(101, FALSE);
- m_bXRefStream = TRUE;
- return TRUE;
+ m_ObjectStreamMap.InitHashTable(101, false);
+ m_bXRefStream = true;
+ return true;
}
-FX_BOOL CPDF_Parser::RebuildCrossRef()
+bool CPDF_Parser::RebuildCrossRef()
{
m_CrossRef.RemoveAll();
m_V5Type.RemoveAll();
@@ -633,7 +633,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
FX_FILESIZE start_pos = 0, start_pos1 = 0;
FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1;
while (pos < m_Syntax.m_FileLen) {
- FX_BOOL bOverFlow = FALSE;
+ bool bOverFlow = false;
FX_DWORD size = (FX_DWORD)(m_Syntax.m_FileLen - pos);
if (size > 4096) {
size = 4096;
@@ -812,7 +812,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
FX_FILESIZE nLen = obj_end - obj_pos - offset;
if ((FX_DWORD)nLen > size - i) {
pos = obj_end + m_Syntax.m_HeaderOffset;
- bOverFlow = TRUE;
+ bOverFlow = true;
} else {
i += (FX_DWORD)nLen;
}
@@ -822,7 +822,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
m_CrossRef[objnum] = obj_pos;
m_ObjVersion.SetAt(objnum, (int16_t)gennum);
if (oldgen != gennum) {
- m_bVersionUpdated = TRUE;
+ m_bVersionUpdated = true;
}
}
} else {
@@ -881,7 +881,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
FX_FILESIZE dwSavePos = m_Syntax.SavePos();
CFX_ByteString strWord = m_Syntax.GetKeyword();
if (!strWord.Compare(FX_BSTRC("startxref"))) {
- FX_BOOL bNumber = FALSE;
+ bool bNumber = false;
CFX_ByteString bsOffset = m_Syntax.GetNextWord(bNumber);
if (bNumber) {
m_LastXRefOffset = FXSYS_atoi(bsOffset);
@@ -982,7 +982,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
m_SortedOffset.Add(offset);
}
FX_Free(buffer);
- return TRUE;
+ return true;
}
static FX_DWORD _GetVarInt(const uint8_t* p, int32_t n)
{
@@ -992,11 +992,11 @@ static FX_DWORD _GetVarInt(const uint8_t* p, int32_t n)
}
return result;
}
-FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL bMainXRef)
+bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainXRef)
{
CPDF_Stream* pStream = (CPDF_Stream*)ParseIndirectObjectAt(m_pDocument, pos, 0, NULL);
if (!pStream) {
- return FALSE;
+ return false;
}
if (m_pDocument) {
CPDF_Dictionary * pDict = m_pDocument->GetRoot();
@@ -1006,17 +1006,17 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
if (pStream->GetType() == PDFOBJ_STREAM) {
pStream->Release();
}
- return FALSE;
+ return false;
}
}
if (pStream->GetType() != PDFOBJ_STREAM) {
- return FALSE;
+ return false;
}
prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev"));
int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size"));
if (size < 0) {
pStream->Release();
- return FALSE;
+ return false;
}
if (bMainXRef) {
m_pTrailer = (CPDF_Dictionary*)pStream->GetDict()->Clone();
@@ -1050,7 +1050,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
pArray = pStream->GetDict()->GetArray(FX_BSTRC("W"));
if (pArray == NULL) {
pStream->Release();
- return FALSE;
+ return false;
}
CFX_DWordArray WidthArray;
FX_SAFE_DWORD dwAccWidth = 0;
@@ -1060,7 +1060,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
}
if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3) {
pStream->Release();
- return FALSE;
+ return false;
}
FX_DWORD totalWidth = dwAccWidth.ValueOrDie();
CPDF_StreamAcc acc;
@@ -1120,7 +1120,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
} else {
if (offset < 0 || offset >= m_V5Type.GetSize()) {
pStream->Release();
- return FALSE;
+ return false;
}
m_V5Type[offset] = 255;
}
@@ -1129,7 +1129,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
segindex += count;
}
pStream->Release();
- return TRUE;
+ return true;
}
CPDF_Array* CPDF_Parser::GetIDArray()
{
@@ -1162,32 +1162,32 @@ FX_DWORD CPDF_Parser::GetInfoObjNum()
}
return ((CPDF_Reference*) pRef)->GetRefObjNum();
}
-FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm)
+bool CPDF_Parser::IsFormStream(FX_DWORD objnum, bool& bForm)
{
- bForm = FALSE;
+ bForm = false;
if (objnum >= (FX_DWORD)m_CrossRef.GetSize()) {
- return TRUE;
+ return true;
}
if (m_V5Type[objnum] == 0) {
- return TRUE;
+ return true;
}
if (m_V5Type[objnum] == 2) {
- return TRUE;
+ return true;
}
FX_FILESIZE pos = m_CrossRef[objnum];
void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
- return TRUE;
+ return true;
}
if ((FX_FILESIZE*)pResult - (FX_FILESIZE*)m_SortedOffset.GetData() == m_SortedOffset.GetSize() - 1) {
- return FALSE;
+ return false;
}
FX_FILESIZE size = ((FX_FILESIZE*)pResult)[1] - pos;
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
- bForm = m_Syntax.SearchMultiWord(FX_BSTRC("/Form\0stream"), TRUE, size) == 0;
+ bForm = m_Syntax.SearchMultiWord(FX_BSTRC("/Form\0stream"), true, size) == 0;
m_Syntax.RestorePos(SavedPos);
- return TRUE;
+ return true;
}
CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext)
{
@@ -1209,7 +1209,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX
int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
CPDF_SyntaxParser syntax;
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), false));
syntax.InitParser(file.Get(), 0);
CPDF_Object* pRet = NULL;
while (n) {
@@ -1282,7 +1282,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD
CPDF_SyntaxParser syntax;
const uint8_t* pData = pObjStream->GetData();
FX_DWORD totalsize = pObjStream->GetSize();
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, false));
syntax.InitParser(file.Get(), 0);
while (n) {
FX_DWORD thisnum = syntax.GetDirectNum();
@@ -1310,7 +1310,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD
}
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString word = m_Syntax.GetNextWord(bIsNumber);
if (!bIsNumber) {
m_Syntax.RestorePos(SavedPos);
@@ -1336,16 +1336,16 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD
return;
}
FX_FILESIZE nextoff = ((FX_FILESIZE*)pResult)[1];
- FX_BOOL bNextOffValid = FALSE;
+ bool bNextOffValid = false;
if (nextoff != pos) {
m_Syntax.RestorePos(nextoff);
word = m_Syntax.GetNextWord(bIsNumber);
if (word == FX_BSTRC("xref")) {
- bNextOffValid = TRUE;
+ bNextOffValid = true;
} else if (bIsNumber) {
word = m_Syntax.GetNextWord(bIsNumber);
if (bIsNumber && m_Syntax.GetKeyword() == FX_BSTRC("obj")) {
- bNextOffValid = TRUE;
+ bNextOffValid = true;
}
}
}
@@ -1373,7 +1373,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList,
{
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString word = m_Syntax.GetNextWord(bIsNumber);
if (!bIsNumber) {
m_Syntax.RestorePos(SavedPos);
@@ -1416,7 +1416,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pO
{
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString word = m_Syntax.GetNextWord(bIsNumber);
if (!bIsNumber) {
m_Syntax.RestorePos(SavedPos);
@@ -1458,7 +1458,7 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4()
}
return (CPDF_Dictionary*)pObj;
}
-FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision)
+FX_DWORD CPDF_Parser::GetPermissions(bool bCheckRevision)
{
if (m_pSecurityHandler == NULL) {
return (FX_DWORD) - 1;
@@ -1473,11 +1473,11 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision)
}
return dwPermission;
}
-FX_BOOL CPDF_Parser::IsOwner()
+bool CPDF_Parser::IsOwner()
{
- return m_pSecurityHandler == NULL ? TRUE : m_pSecurityHandler->IsOwner();
+ return m_pSecurityHandler == NULL ? true : m_pSecurityHandler->IsOwner();
}
-void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, FX_BOOL bForced)
+void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, bool bForced)
{
ASSERT(m_pSecurityHandler == NULL);
if (!m_bForceUseSecurityHandler) {
@@ -1492,29 +1492,29 @@ void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, FX_
m_Syntax.m_pCryptoHandler = pSecurityHandler->CreateCryptoHandler();
m_Syntax.m_pCryptoHandler->Init(NULL, pSecurityHandler);
}
-FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset)
+bool CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset)
{
m_Syntax.InitParser(pFileAccess, offset);
m_Syntax.RestorePos(m_Syntax.m_HeaderOffset + 9);
FX_FILESIZE SavedPos = m_Syntax.SavePos();
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString word = m_Syntax.GetNextWord(bIsNumber);
if (!bIsNumber) {
- return FALSE;
+ return false;
}
FX_DWORD objnum = FXSYS_atoi(word);
word = m_Syntax.GetNextWord(bIsNumber);
if (!bIsNumber) {
- return FALSE;
+ return false;
}
FX_DWORD gennum = FXSYS_atoi(word);
if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) {
m_Syntax.RestorePos(SavedPos);
- return FALSE;
+ return false;
}
m_pLinearized = m_Syntax.GetObject(NULL, objnum, gennum, 0);
if (!m_pLinearized) {
- return FALSE;
+ return false;
}
if (m_pLinearized->GetDict() && m_pLinearized->GetDict()->GetElement(FX_BSTRC("Linearized"))) {
m_Syntax.GetNextWord(bIsNumber);
@@ -1522,10 +1522,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset
if (!pLen) {
m_pLinearized->Release();
m_pLinearized = NULL;
- return FALSE;
+ return false;
}
if (pLen->GetInteger() != (int)pFileAccess->GetSize()) {
- return FALSE;
+ return false;
}
CPDF_Object *pNo = m_pLinearized->GetDict()->GetElement(FX_BSTRC("P"));
if (pNo && pNo->GetType() == PDFOBJ_NUMBER) {
@@ -1535,16 +1535,16 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset
if (pTable && pTable->GetType() == PDFOBJ_NUMBER) {
m_LastXRefOffset = pTable->GetInteger();
}
- return TRUE;
+ return true;
}
m_pLinearized->Release();
m_pLinearized = NULL;
- return FALSE;
+ return false;
}
-FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX_BOOL bOwnFileRead)
+FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, bool bReParse, bool bOwnFileRead)
{
CloseParser(bReParse);
- m_bXRefStream = FALSE;
+ m_bXRefStream = false;
m_LastXRefOffset = 0;
m_bOwnFileRead = bOwnFileRead;
int32_t offset = GetHeaderOffset(pFileAccess);
@@ -1559,19 +1559,19 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse
m_pDocument = new CPDF_Document(this);
}
FX_FILESIZE dwFirstXRefOffset = m_Syntax.SavePos();
- FX_BOOL bXRefRebuilt = FALSE;
- FX_BOOL bLoadV4 = FALSE;
- if (!(bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, FALSE, FALSE)) && !LoadCrossRefV5(dwFirstXRefOffset, dwFirstXRefOffset, TRUE)) {
+ bool bXRefRebuilt = false;
+ bool bLoadV4 = false;
+ if (!(bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, false, false)) && !LoadCrossRefV5(dwFirstXRefOffset, dwFirstXRefOffset, true)) {
if (!RebuildCrossRef()) {
return PDFPARSE_ERROR_FORMAT;
}
- bXRefRebuilt = TRUE;
+ bXRefRebuilt = true;
m_LastXRefOffset = 0;
}
if (bLoadV4) {
m_pTrailer = LoadTrailerV4();
if (m_pTrailer == NULL) {
- return FALSE;
+ return false;
}
int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
if (xrefsize > 0) {
@@ -1623,18 +1623,18 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse
}
return PDFPARSE_ERROR_SUCCESS;
}
-FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos)
+bool CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos)
{
- if (!LoadCrossRefV5(xrefpos, xrefpos, FALSE)) {
- return FALSE;
+ if (!LoadCrossRefV5(xrefpos, xrefpos, false)) {
+ return false;
}
while (xrefpos)
- if (!LoadCrossRefV5(xrefpos, xrefpos, FALSE)) {
- return FALSE;
+ if (!LoadCrossRefV5(xrefpos, xrefpos, false)) {
+ return false;
}
- m_ObjectStreamMap.InitHashTable(101, FALSE);
- m_bXRefStream = TRUE;
- return TRUE;
+ m_ObjectStreamMap.InitHashTable(101, false);
+ m_bXRefStream = true;
+ return true;
}
FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable()
{
@@ -1688,7 +1688,7 @@ CPDF_SyntaxParser::CPDF_SyntaxParser()
m_pFileBuf = NULL;
m_MetadataObjnum = 0;
m_dwWordPos = 0;
- m_bFileStream = FALSE;
+ m_bFileStream = false;
}
CPDF_SyntaxParser::~CPDF_SyntaxParser()
{
@@ -1696,19 +1696,19 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser()
FX_Free(m_pFileBuf);
}
}
-FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch)
+bool CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch)
{
FX_FILESIZE save_pos = m_Pos;
m_Pos = pos;
- FX_BOOL ret = GetNextChar(ch);
+ bool ret = GetNextChar(ch);
m_Pos = save_pos;
return ret;
}
-FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch)
+bool CPDF_SyntaxParser::GetNextChar(uint8_t& ch)
{
FX_FILESIZE pos = m_Pos + m_HeaderOffset;
if (pos >= m_FileLen) {
- return FALSE;
+ return false;
}
if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) {
FX_FILESIZE read_pos = pos;
@@ -1725,19 +1725,19 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch)
}
}
if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size)) {
- return FALSE;
+ return false;
}
m_BufOffset = read_pos;
}
ch = m_pFileBuf[pos - m_BufOffset];
m_Pos ++;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch)
+bool CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch)
{
pos += m_HeaderOffset;
if (pos >= m_FileLen) {
- return FALSE;
+ return false;
}
if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) {
FX_FILESIZE read_pos;
@@ -1756,26 +1756,26 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch)
}
}
if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size)) {
- return FALSE;
+ return false;
}
m_BufOffset = read_pos;
}
ch = m_pFileBuf[pos - m_BufOffset];
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size)
+bool CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size)
{
if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size)) {
- return FALSE;
+ return false;
}
m_Pos += size;
- return TRUE;
+ return true;
}
#define MAX_WORD_BUFFER 256
void CPDF_SyntaxParser::GetNextWord()
{
m_WordSize = 0;
- m_bIsNumber = TRUE;
+ m_bIsNumber = true;
uint8_t ch;
if (!GetNextChar(ch)) {
return;
@@ -1802,7 +1802,7 @@ void CPDF_SyntaxParser::GetNextWord()
type = PDF_CharType[ch];
}
if (type == 'D') {
- m_bIsNumber = FALSE;
+ m_bIsNumber = false;
m_WordBuffer[m_WordSize++] = ch;
if (ch == '/') {
while (1) {
@@ -1844,7 +1844,7 @@ void CPDF_SyntaxParser::GetNextWord()
m_WordBuffer[m_WordSize++] = ch;
}
if (type != 'N') {
- m_bIsNumber = FALSE;
+ m_bIsNumber = false;
}
if (!GetNextChar(ch)) {
return;
@@ -1950,7 +1950,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString()
return CFX_ByteString();
}
CFX_BinaryBuf buf;
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
uint8_t code = 0;
while (1) {
if (ch == '>') {
@@ -2036,7 +2036,7 @@ void CPDF_SyntaxParser::ToNextWord()
}
m_Pos --;
}
-CFX_ByteString CPDF_SyntaxParser::GetNextWord(FX_BOOL& bIsNumber)
+CFX_ByteString CPDF_SyntaxParser::GetNextWord(bool& bIsNumber)
{
GetNextWord();
bIsNumber = m_bIsNumber;
@@ -2047,15 +2047,15 @@ CFX_ByteString CPDF_SyntaxParser::GetKeyword()
GetNextWord();
return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize);
}
-CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, FX_BOOL bDecrypt)
+CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, bool bDecrypt)
{
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
return NULL;
}
FX_FILESIZE SavedPos = m_Pos;
- FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
- FX_BOOL bIsNumber;
+ bool bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
+ bool bIsNumber;
CFX_ByteString word = GetNextWord(bIsNumber);
if (word.GetLength() == 0) {
if (bTypeOnly) {
@@ -2102,7 +2102,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (m_pCryptoHandler && bDecrypt) {
m_pCryptoHandler->Decrypt(objnum, gennum, str);
}
- return CPDF_String::Create(str, FALSE);
+ return CPDF_String::Create(str, false);
}
if (word == FX_BSTRC("<")) {
if (bTypeOnly) {
@@ -2112,7 +2112,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (m_pCryptoHandler && bDecrypt) {
m_pCryptoHandler->Decrypt(objnum, gennum, str);
}
- return CPDF_String::Create(str, TRUE);
+ return CPDF_String::Create(str, true);
}
if (word == FX_BSTRC("[")) {
if (bTypeOnly) {
@@ -2145,7 +2145,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
int32_t nKeys = 0;
FX_FILESIZE dwSignValuePos = 0;
while (1) {
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString key = GetNextWord(bIsNumber);
if (key.IsEmpty()) {
if (pDict)
@@ -2183,7 +2183,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (IsSignatureDict(pDict)) {
FX_FILESIZE dwSavePos = m_Pos;
m_Pos = dwSignValuePos;
- CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE);
+ CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, false);
pDict->SetAt(FX_BSTRC("Contents"), pObj);
m_Pos = dwSavePos;
}
@@ -2194,7 +2194,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
}
}
FX_FILESIZE SavedPos = m_Pos;
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString nextword = GetNextWord(bIsNumber);
if (nextword == FX_BSTRC("stream")) {
CPDF_Stream* pStream = ReadStream(pDict, pContext, objnum, gennum);
@@ -2225,8 +2225,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
return NULL;
}
FX_FILESIZE SavedPos = m_Pos;
- FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
- FX_BOOL bIsNumber;
+ bool bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
+ bool bIsNumber;
CFX_ByteString word = GetNextWord(bIsNumber);
if (word.GetLength() == 0) {
if (bTypeOnly) {
@@ -2273,7 +2273,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
if (m_pCryptoHandler) {
m_pCryptoHandler->Decrypt(objnum, gennum, str);
}
- return CPDF_String::Create(str, FALSE);
+ return CPDF_String::Create(str, false);
}
if (word == FX_BSTRC("<")) {
if (bTypeOnly) {
@@ -2283,7 +2283,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
if (m_pCryptoHandler) {
m_pCryptoHandler->Decrypt(objnum, gennum, str);
}
- return CPDF_String::Create(str, TRUE);
+ return CPDF_String::Create(str, true);
}
if (word == FX_BSTRC("[")) {
if (bTypeOnly) {
@@ -2319,7 +2319,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
while (1) {
- FX_BOOL bIsNumber;
+ bool bIsNumber;
FX_FILESIZE SavedPos = m_Pos;
CFX_ByteString key = GetNextWord(bIsNumber);
if (key.IsEmpty()) {
@@ -2366,7 +2366,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
}
}
FX_FILESIZE SavedPos = m_Pos;
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString nextword = GetNextWord(bIsNumber);
if (nextword == FX_BSTRC("stream")) {
CPDF_Stream* pStream = ReadStream(pDict, pContext, objnum, gennum);
@@ -2495,32 +2495,32 @@ int32_t CPDF_SyntaxParser::GetDirectNum()
m_WordBuffer[m_WordSize] = 0;
return FXSYS_atoi((const FX_CHAR*)m_WordBuffer);
}
-FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen)
+bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen)
{
uint8_t type = PDF_CharType[tag[0]];
- FX_BOOL bCheckLeft = type != 'D' && type != 'W';
+ bool bCheckLeft = type != 'D' && type != 'W';
type = PDF_CharType[tag[taglen - 1]];
- FX_BOOL bCheckRight = type != 'D' && type != 'W';
+ bool bCheckRight = type != 'D' && type != 'W';
uint8_t ch;
if (bCheckRight && startpos + (int32_t)taglen <= limit && GetCharAt(startpos + (int32_t)taglen, ch)) {
uint8_t type = PDF_CharType[ch];
if (type == 'N' || type == 'R') {
- return FALSE;
+ return false;
}
}
if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) {
uint8_t type = PDF_CharType[ch];
if (type == 'N' || type == 'R') {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit)
+bool CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, bool bWholeWord, bool bForward, FX_FILESIZE limit)
{
int32_t taglen = tag.GetLength();
if (taglen == 0) {
- return FALSE;
+ return false;
}
FX_FILESIZE pos = m_Pos;
int32_t offset = 0;
@@ -2533,20 +2533,20 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, FX_BOOL bWhole
if (bForward) {
if (limit) {
if (pos >= m_Pos + limit) {
- return FALSE;
+ return false;
}
}
if (!GetCharAt(pos, byte)) {
- return FALSE;
+ return false;
}
} else {
if (limit) {
if (pos <= m_Pos - limit) {
- return FALSE;
+ return false;
}
}
if (!GetCharAtBackward(pos, byte)) {
- return FALSE;
+ return false;
}
}
if (byte == tag_data[offset]) {
@@ -2566,7 +2566,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, FX_BOOL bWhole
FX_FILESIZE startpos = bForward ? pos - taglen + 1 : pos;
if (!bWholeWord || IsWholeWord(startpos, limit, tag.GetPtr(), taglen)) {
m_Pos = startpos;
- return TRUE;
+ return true;
}
}
if (bForward) {
@@ -2577,17 +2577,17 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, FX_BOOL bWhole
pos --;
}
if (pos < 0) {
- return FALSE;
+ return false;
}
}
- return FALSE;
+ return false;
}
struct _SearchTagRecord {
const uint8_t* m_pTag;
FX_DWORD m_Len;
FX_DWORD m_Offset;
};
-int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, FX_BOOL bWholeWord, FX_FILESIZE limit)
+int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, bool bWholeWord, FX_FILESIZE limit)
{
int32_t ntags = 1, i;
for (i = 0; i < tags.GetLength(); i ++)
@@ -2695,17 +2695,17 @@ public:
CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead);
~CPDF_DataAvail();
- virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) override;
+ virtual bool IsDocAvail(IFX_DownloadHints* pHints) override;
virtual void SetDocument(CPDF_Document* pDoc) override;
- virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override;
+ virtual bool IsPageAvail(int iPage, IFX_DownloadHints* pHints) override;
virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override;
virtual int32_t IsLinearizedPDF() override;
- virtual FX_BOOL IsLinearized() override
+ virtual bool IsLinearized() override
{
return m_bLinearized;
}
@@ -2717,52 +2717,52 @@ protected:
static int s_CurrentDataAvailRecursionDepth;
FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset);
- FX_BOOL IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret_array);
- FX_BOOL CheckDocStatus(IFX_DownloadHints *pHints);
- FX_BOOL CheckHeader(IFX_DownloadHints* pHints);
- FX_BOOL CheckFirstPage(IFX_DownloadHints *pHints);
- FX_BOOL CheckEnd(IFX_DownloadHints *pHints);
- FX_BOOL CheckCrossRef(IFX_DownloadHints* pHints);
- FX_BOOL CheckCrossRefItem(IFX_DownloadHints *pHints);
- FX_BOOL CheckTrailer(IFX_DownloadHints* pHints);
- FX_BOOL CheckRoot(IFX_DownloadHints* pHints);
- FX_BOOL CheckInfo(IFX_DownloadHints* pHints);
- FX_BOOL CheckPages(IFX_DownloadHints* pHints);
- FX_BOOL CheckPage(IFX_DownloadHints* pHints);
- FX_BOOL CheckResources(IFX_DownloadHints* pHints);
- FX_BOOL CheckAnnots(IFX_DownloadHints* pHints);
- FX_BOOL CheckAcroForm(IFX_DownloadHints* pHints);
- FX_BOOL CheckAcroFormSubObject(IFX_DownloadHints* pHints);
- FX_BOOL CheckTrailerAppend(IFX_DownloadHints* pHints);
- FX_BOOL CheckPageStatus(IFX_DownloadHints* pHints);
- FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints);
+ bool IsObjectsAvail(CFX_PtrArray& obj_array, bool bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret_array);
+ bool CheckDocStatus(IFX_DownloadHints *pHints);
+ bool CheckHeader(IFX_DownloadHints* pHints);
+ bool CheckFirstPage(IFX_DownloadHints *pHints);
+ bool CheckEnd(IFX_DownloadHints *pHints);
+ bool CheckCrossRef(IFX_DownloadHints* pHints);
+ bool CheckCrossRefItem(IFX_DownloadHints *pHints);
+ bool CheckTrailer(IFX_DownloadHints* pHints);
+ bool CheckRoot(IFX_DownloadHints* pHints);
+ bool CheckInfo(IFX_DownloadHints* pHints);
+ bool CheckPages(IFX_DownloadHints* pHints);
+ bool CheckPage(IFX_DownloadHints* pHints);
+ bool CheckResources(IFX_DownloadHints* pHints);
+ bool CheckAnnots(IFX_DownloadHints* pHints);
+ bool CheckAcroForm(IFX_DownloadHints* pHints);
+ bool CheckAcroFormSubObject(IFX_DownloadHints* pHints);
+ bool CheckTrailerAppend(IFX_DownloadHints* pHints);
+ bool CheckPageStatus(IFX_DownloadHints* pHints);
+ bool CheckAllCrossRefStream(IFX_DownloadHints *pHints);
int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset);
- FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
+ bool IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- FX_BOOL GetNextToken(CFX_ByteString &token);
- FX_BOOL GetNextChar(uint8_t &ch);
+ bool GetNextToken(CFX_ByteString &token);
+ bool GetNextChar(uint8_t &ch);
CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum);
- CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile);
- FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages);
- FX_BOOL PreparePageItem();
- FX_BOOL LoadPages(IFX_DownloadHints* pHints);
- FX_BOOL LoadAllXref(IFX_DownloadHints* pHints);
- FX_BOOL LoadAllFile(IFX_DownloadHints* pHints);
- FX_BOOL CheckLinearizedData(IFX_DownloadHints* pHints);
- FX_BOOL CheckFileResources(IFX_DownloadHints* pHints);
- FX_BOOL CheckPageAnnots(int iPage, IFX_DownloadHints* pHints);
+ CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, bool *pExistInFile);
+ bool GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages);
+ bool PreparePageItem();
+ bool LoadPages(IFX_DownloadHints* pHints);
+ bool LoadAllXref(IFX_DownloadHints* pHints);
+ bool LoadAllFile(IFX_DownloadHints* pHints);
+ bool CheckLinearizedData(IFX_DownloadHints* pHints);
+ bool CheckFileResources(IFX_DownloadHints* pHints);
+ bool CheckPageAnnots(int iPage, IFX_DownloadHints* pHints);
- FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints);
- FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pDict);
- FX_BOOL CheckPage(int32_t iPage, IFX_DownloadHints* pHints);
- FX_BOOL LoadDocPages(IFX_DownloadHints* pHints);
- FX_BOOL LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints);
- FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints);
- FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
- FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
- FX_BOOL CheckPageCount(IFX_DownloadHints* pHints);
- FX_BOOL IsFirstCheck(int iPage);
+ bool CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints);
+ bool HaveResourceAncestor(CPDF_Dictionary *pDict);
+ bool CheckPage(int32_t iPage, IFX_DownloadHints* pHints);
+ bool LoadDocPages(IFX_DownloadHints* pHints);
+ bool LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints);
+ bool CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints);
+ bool CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
+ bool CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
+ bool CheckPageCount(IFX_DownloadHints* pHints);
+ bool IsFirstCheck(int iPage);
void ResetFirstCheck(int iPage);
CPDF_Parser m_parser;
@@ -2779,7 +2779,7 @@ protected:
CPDF_Object *m_pTrailer;
- FX_BOOL m_bDocAvail;
+ bool m_bDocAvail;
FX_FILESIZE m_dwHeaderOffset;
@@ -2823,31 +2823,31 @@ protected:
FX_DWORD m_PagesObjNum;
- FX_BOOL m_bLinearized;
+ bool m_bLinearized;
FX_DWORD m_dwFirstPageNo;
- FX_BOOL m_bLinearedDataOK;
+ bool m_bLinearedDataOK;
- FX_BOOL m_bMainXRefLoadTried;
+ bool m_bMainXRefLoadTried;
- FX_BOOL m_bMainXRefLoadedOK;
+ bool m_bMainXRefLoadedOK;
- FX_BOOL m_bPagesTreeLoad;
+ bool m_bPagesTreeLoad;
- FX_BOOL m_bPagesLoad;
+ bool m_bPagesLoad;
CPDF_Parser * m_pCurrentParser;
FX_FILESIZE m_dwCurrentXRefSteam;
- FX_BOOL m_bAnnotsLoad;
+ bool m_bAnnotsLoad;
- FX_BOOL m_bHaveAcroForm;
+ bool m_bHaveAcroForm;
FX_DWORD m_dwAcroFormObjNum;
- FX_BOOL m_bAcroFormLoad;
+ bool m_bAcroFormLoad;
CPDF_Object * m_pAcroForm;
@@ -2857,11 +2857,11 @@ protected:
CPDF_Object * m_pPageResource;
- FX_BOOL m_bNeedDownLoadResource;
+ bool m_bNeedDownLoadResource;
- FX_BOOL m_bPageLoadedOK;
+ bool m_bPageLoadedOK;
- FX_BOOL m_bLinearizedFormParamLoad;
+ bool m_bLinearizedFormParamLoad;
CFX_PtrArray m_PagesArray;
@@ -2869,9 +2869,9 @@ protected:
FX_FILESIZE m_dwPrevXRefOffset;
- FX_BOOL m_bTotalLoadPageTree;
+ bool m_bTotalLoadPageTree;
- FX_BOOL m_bCurPageDictLoadOK;
+ bool m_bCurPageDictLoadOK;
CPDF_PageNode m_pageNodes;
@@ -2916,19 +2916,19 @@ CPDF_DataAvail::CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRea
m_dwEncryptObjNum = 0;
m_dwPrevXRefOffset = 0;
m_dwLastXRefOffset = 0;
- m_bDocAvail = FALSE;
- m_bMainXRefLoadTried = FALSE;
- m_bDocAvail = FALSE;
- m_bLinearized = FALSE;
- m_bPagesLoad = FALSE;
- m_bPagesTreeLoad = FALSE;
- m_bMainXRefLoadedOK = FALSE;
- m_bAnnotsLoad = FALSE;
- m_bHaveAcroForm = FALSE;
- m_bAcroFormLoad = FALSE;
- m_bPageLoadedOK = FALSE;
- m_bNeedDownLoadResource = FALSE;
- m_bLinearizedFormParamLoad = FALSE;
+ m_bDocAvail = false;
+ m_bMainXRefLoadTried = false;
+ m_bDocAvail = false;
+ m_bLinearized = false;
+ m_bPagesLoad = false;
+ m_bPagesTreeLoad = false;
+ m_bMainXRefLoadedOK = false;
+ m_bAnnotsLoad = false;
+ m_bHaveAcroForm = false;
+ m_bAcroFormLoad = false;
+ m_bPageLoadedOK = false;
+ m_bNeedDownLoadResource = false;
+ m_bLinearizedFormParamLoad = false;
m_pLinearized = NULL;
m_pRoot = NULL;
m_pTrailer = NULL;
@@ -2938,10 +2938,10 @@ CPDF_DataAvail::CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRea
m_pPageResource = NULL;
m_pageMapCheckState = NULL;
m_docStatus = PDF_DATAAVAIL_HEADER;
- m_parser.m_bOwnFileRead = FALSE;
- m_bTotalLoadPageTree = FALSE;
- m_bCurPageDictLoadOK = FALSE;
- m_bLinearedDataOK = FALSE;
+ m_parser.m_bOwnFileRead = false;
+ m_bTotalLoadPageTree = false;
+ m_bCurPageDictLoadOK = false;
+ m_bLinearedDataOK = false;
m_pagesLoadState = NULL;
}
CPDF_DataAvail::~CPDF_DataAvail()
@@ -2995,10 +2995,10 @@ FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset)
}
return 0;
}
-FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret_array)
+bool CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, bool bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret_array)
{
if (!obj_array.GetSize()) {
- return TRUE;
+ return true;
}
FX_DWORD count = 0;
CFX_PtrArray new_obj_array;
@@ -3088,42 +3088,42 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa
ret_array.Add(pObj);
}
}
- return FALSE;
+ return false;
}
obj_array.RemoveAll();
obj_array.Append(new_obj_array);
- return IsObjectsAvail(obj_array, FALSE, pHints, ret_array);
+ return IsObjectsAvail(obj_array, false, pHints, ret_array);
}
-FX_BOOL CPDF_DataAvail::IsDocAvail(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::IsDocAvail(IFX_DownloadHints* pHints)
{
if (!m_dwFileLen && m_pFileRead) {
m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize();
if (!m_dwFileLen) {
- return TRUE;
+ return true;
}
}
while (!m_bDocAvail) {
if (!CheckDocStatus(pHints)) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints)
{
if (!m_objs_array.GetSize()) {
m_objs_array.RemoveAll();
m_objnum_array.RemoveAll();
CFX_PtrArray obj_array;
obj_array.Append(m_arrayAcroforms);
- FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array);
+ bool bRet = IsObjectsAvail(obj_array, false, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
}
return bRet;
}
CFX_PtrArray new_objs_array;
- FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
+ bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
if (bRet) {
int32_t iSize = m_arrayAcroforms.GetSize();
for (int32_t i = 0; i < iSize; ++i) {
@@ -3136,26 +3136,26 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints)
}
return bRet;
}
-FX_BOOL CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
m_pAcroForm = GetObject(m_dwAcroFormObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_PAGETREE;
- return TRUE;
+ return true;
}
if (!m_pAcroForm) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
m_arrayAcroforms.Add(m_pAcroForm);
m_docStatus = PDF_DATAAVAIL_PAGETREE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckDocStatus(IFX_DownloadHints *pHints)
+bool CPDF_DataAvail::CheckDocStatus(IFX_DownloadHints *pHints)
{
switch (m_docStatus) {
case PDF_DATAAVAIL_HEADER:
@@ -3195,17 +3195,17 @@ FX_BOOL CPDF_DataAvail::CheckDocStatus(IFX_DownloadHints *pHints)
return CheckPage(pHints);
}
m_docStatus = PDF_DATAAVAIL_PAGE_LATERLOAD;
- return TRUE;
+ return true;
case PDF_DATAAVAIL_ERROR:
return LoadAllFile(pHints);
case PDF_DATAAVAIL_PAGE_LATERLOAD:
m_docStatus = PDF_DATAAVAIL_PAGE;
default:
- m_bDocAvail = TRUE;
- return TRUE;
+ m_bDocAvail = true;
+ return true;
}
}
-FX_BOOL CPDF_DataAvail::CheckPageStatus(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPageStatus(IFX_DownloadHints* pHints)
{
switch (m_docStatus) {
case PDF_DATAAVAIL_PAGETREE:
@@ -3215,36 +3215,36 @@ FX_BOOL CPDF_DataAvail::CheckPageStatus(IFX_DownloadHints* pHints)
case PDF_DATAAVAIL_ERROR:
return LoadAllFile(pHints);
default:
- m_bPagesTreeLoad = TRUE;
- m_bPagesLoad = TRUE;
- return TRUE;
+ m_bPagesTreeLoad = true;
+ m_bPagesLoad = true;
+ return true;
}
}
-FX_BOOL CPDF_DataAvail::LoadAllFile(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::LoadAllFile(IFX_DownloadHints* pHints)
{
if (m_pFileAvail->IsDataAvail(0, (FX_DWORD)m_dwFileLen)) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
pHints->AddSegment(0, (FX_DWORD)m_dwFileLen);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::LoadAllXref(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::LoadAllXref(IFX_DownloadHints* pHints)
{
m_parser.m_Syntax.InitParser(m_pFileRead, (FX_DWORD)m_dwHeaderOffset);
- m_parser.m_bOwnFileRead = FALSE;
+ m_parser.m_bOwnFileRead = false;
if (!m_parser.LoadAllCrossRefV4(m_dwLastXRefOffset) && !m_parser.LoadAllCrossRefV5(m_dwLastXRefOffset)) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return FALSE;
+ return false;
}
FXSYS_qsort(m_parser.m_SortedOffset.GetData(), m_parser.m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
m_dwRootObjNum = m_parser.GetRootObjNum();
m_dwInfoObjNum = m_parser.GetInfoObjNum();
m_pCurrentParser = &m_parser;
m_docStatus = PDF_DATAAVAIL_ROOT;
- return TRUE;
+ return true;
}
-CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile)
+CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, bool *pExistInFile)
{
CPDF_Object *pRet = NULL;
FX_DWORD original_size = 0;
@@ -3252,7 +3252,7 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHint
CPDF_Parser *pParser = NULL;
if (pExistInFile) {
- *pExistInFile = TRUE;
+ *pExistInFile = true;
}
if (m_pDocument == NULL) {
@@ -3267,7 +3267,7 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHint
pdfium::base::CheckedNumeric<FX_DWORD> size = original_size;
if (size.ValueOrDefault(0) == 0 || offset < 0 || offset >= m_dwFileLen) {
if (pExistInFile)
- *pExistInFile = FALSE;
+ *pExistInFile = false;
return NULL;
}
@@ -3298,15 +3298,15 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHint
}
if (!pRet && pExistInFile) {
- *pExistInFile = FALSE;
+ *pExistInFile = false;
}
return pRet;
}
-FX_BOOL CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object *pInfo = GetObject(m_dwInfoObjNum, pHints, &bExist);
if (!bExist) {
if (m_bHaveAcroForm) {
@@ -3314,17 +3314,17 @@ FX_BOOL CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
} else {
m_docStatus = PDF_DATAAVAIL_PAGETREE;
}
- return TRUE;
+ return true;
}
if (!pInfo) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
if (m_Pos == m_dwFileLen) {
m_docStatus = PDF_DATAAVAIL_ERROR;
}
- return FALSE;
+ return false;
}
if (pInfo) {
pInfo->Release();
@@ -3334,37 +3334,37 @@ FX_BOOL CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
} else {
m_docStatus = PDF_DATAAVAIL_PAGETREE;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
m_pRoot = GetObject(m_dwRootObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
if (!m_pRoot) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDict = m_pRoot->GetDict();
if (!pDict) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Reference* pRef = (CPDF_Reference*)pDict->GetElement(FX_BSTRC("Pages"));
if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_PagesObjNum = pRef->GetRefObjNum();
CPDF_Reference* pAcroFormRef = (CPDF_Reference*)m_pRoot->GetDict()->GetElement(FX_BSTRC("AcroForm"));
if (pAcroFormRef && pAcroFormRef->GetType() == PDFOBJ_REFERENCE) {
- m_bHaveAcroForm = TRUE;
+ m_bHaveAcroForm = true;
m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum();
}
if (m_dwInfoObjNum) {
@@ -3376,22 +3376,22 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints)
m_docStatus = PDF_DATAAVAIL_PAGETREE;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::PreparePageItem()
+bool CPDF_DataAvail::PreparePageItem()
{
CPDF_Dictionary *pRoot = m_pDocument->GetRoot();
CPDF_Reference* pRef = pRoot ? (CPDF_Reference*)pRoot->GetElement(FX_BSTRC("Pages")) : NULL;
if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_PagesObjNum = pRef->GetRefObjNum();
m_pCurrentParser = (CPDF_Parser *)m_pDocument->GetParser();
m_docStatus = PDF_DATAAVAIL_PAGETREE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::IsFirstCheck(int iPage)
+bool CPDF_DataAvail::IsFirstCheck(int iPage)
{
if (NULL == m_pageMapCheckState) {
m_pageMapCheckState = new CFX_CMapDWordToDWord();
@@ -3399,13 +3399,13 @@ FX_BOOL CPDF_DataAvail::IsFirstCheck(int iPage)
FX_DWORD dwValue = 0;
if (!m_pageMapCheckState->Lookup(iPage, dwValue)) {
m_pageMapCheckState->SetAt(iPage, 1);
- return TRUE;
+ return true;
}
if (dwValue != 0) {
- return FALSE;
+ return false;
}
m_pageMapCheckState->SetAt(iPage, 1);
- return TRUE;
+ return true;
}
void CPDF_DataAvail::ResetFirstCheck(int iPage)
{
@@ -3418,13 +3418,13 @@ void CPDF_DataAvail::ResetFirstCheck(int iPage)
}
m_pageMapCheckState->SetAt(iPage, 0);
}
-FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
{
FX_DWORD iPageObjs = m_PageObjList.GetSize();
CFX_DWordArray UnavailObjList;
for (FX_DWORD i = 0; i < iPageObjs; ++i) {
FX_DWORD dwPageObjNum = m_PageObjList.GetAt(i);
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object *pObj = GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
if (bExist) {
@@ -3459,7 +3459,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
m_PageObjList.RemoveAll();
if (UnavailObjList.GetSize()) {
m_PageObjList.Append(UnavailObjList);
- return FALSE;
+ return false;
}
FX_DWORD iPages = m_PagesArray.GetSize();
for (FX_DWORD i = 0; i < iPages; i++) {
@@ -3475,7 +3475,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
}
m_PagesArray.RemoveAll();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPages->Release();
}
@@ -3483,18 +3483,18 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
if (!m_PageObjList.GetSize()) {
m_docStatus = PDF_DATAAVAIL_DONE;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages)
+bool CPDF_DataAvail::GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages)
{
if (!pParser) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDict = pPages->GetDict();
CPDF_Object *pKids = pDict ? pDict->GetElement(FX_BSTRC("Kids")) : NULL;
if (!pKids) {
- return TRUE;
+ return true;
}
switch (pKids->GetType()) {
case PDFOBJ_REFERENCE: {
@@ -3514,35 +3514,35 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages)
break;
default:
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckPages(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPages(IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object *pPages = GetObject(m_PagesObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
if (!pPages) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (!GetPageKids(m_pCurrentParser, pPages)) {
pPages->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPages->Release();
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
{
FX_DWORD req_size = 1024;
if ((FX_FILESIZE)req_size > m_dwFileLen) {
@@ -3555,34 +3555,34 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
m_docStatus = PDF_DATAAVAIL_FIRSTPAGE;
} else {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
- return FALSE;
+ return false;
}
m_docStatus = PDF_DATAAVAIL_END;
}
- return TRUE;
+ return true;
}
pHints->AddSegment(0, req_size);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
+bool CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
{
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
CPDF_Object *pEndOffSet = pDict ? pDict->GetElement(FX_BSTRC("E")) : NULL;
if (!pEndOffSet) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Object *pXRefOffset = pDict ? pDict->GetElement(FX_BSTRC("T")) : NULL;
if (!pXRefOffset) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
CPDF_Object *pFileLen = pDict ? pDict->GetElement(FX_BSTRC("L")) : NULL;
if (!pFileLen) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- FX_BOOL bNeedDownLoad = FALSE;
+ bool bNeedDownLoad = false;
if (pEndOffSet->GetType() == PDFOBJ_NUMBER) {
FX_DWORD dwEnd = pEndOffSet->GetInteger();
dwEnd += 512;
@@ -3593,7 +3593,7 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) {
pHints->AddSegment(iStartPos, iSize);
- bNeedDownLoad = TRUE;
+ bNeedDownLoad = true;
}
}
m_dwLastXRefOffset = 0;
@@ -3619,16 +3619,16 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
}
if (!bNeedDownLoad && m_docStatus == PDF_DATAAVAIL_FIRSTPAGE_PREPARE) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
m_docStatus = PDF_DATAAVAIL_FIRSTPAGE_PREPARE;
- return FALSE;
+ return false;
}
CPDF_Object * CPDF_DataAvail::ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum)
{
FX_FILESIZE SavedPos = m_syntaxParser.SavePos();
m_syntaxParser.RestorePos(pos);
- FX_BOOL bIsNumber;
+ bool bIsNumber;
CFX_ByteString word = m_syntaxParser.GetNextWord(bIsNumber);
if (!bIsNumber) {
return NULL;
@@ -3670,21 +3670,21 @@ int32_t CPDF_DataAvail::IsLinearizedPDF()
}
return PDF_NOT_LINEARIZED;
}
-FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen)
+bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen)
{
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, false));
int32_t offset = GetHeaderOffset(file.Get());
if (offset == -1) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_dwHeaderOffset = offset;
m_syntaxParser.InitParser(file.Get(), offset);
m_syntaxParser.RestorePos(m_syntaxParser.m_HeaderOffset + 9);
- FX_BOOL bNumber = FALSE;
+ bool bNumber = false;
CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(bNumber);
if (!bNumber) {
- return FALSE;
+ return false;
}
FX_DWORD objnum = FXSYS_atoi(wordObjNum);
if (m_pLinearized) {
@@ -3693,58 +3693,58 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen)
}
m_pLinearized = ParseIndirectObjectAt(m_syntaxParser.m_HeaderOffset + 9, objnum);
if (!m_pLinearized) {
- return FALSE;
+ return false;
}
if (m_pLinearized->GetDict() && m_pLinearized->GetDict()->GetElement(FX_BSTRC("Linearized"))) {
CPDF_Object *pLen = m_pLinearized->GetDict()->GetElement(FX_BSTRC("L"));
if (!pLen) {
- return FALSE;
+ return false;
}
if ((FX_FILESIZE)pLen->GetInteger() != m_pFileRead->GetSize()) {
- return FALSE;
+ return false;
}
- m_bLinearized = TRUE;
+ m_bLinearized = true;
CPDF_Object *pNo = m_pLinearized->GetDict()->GetElement(FX_BSTRC("P"));
if (pNo && pNo->GetType() == PDFOBJ_NUMBER) {
m_dwFirstPageNo = pNo->GetInteger();
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints)
{
FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos);
if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) {
uint8_t buffer[1024];
m_pFileRead->ReadBlock(buffer, req_pos, dwSize);
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(buffer, (size_t)dwSize, false));
m_syntaxParser.InitParser(file.Get(), 0);
m_syntaxParser.RestorePos(dwSize - 1);
- if (m_syntaxParser.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, dwSize)) {
- FX_BOOL bNumber;
+ if (m_syntaxParser.SearchWord(FX_BSTRC("startxref"), true, false, dwSize)) {
+ bool bNumber;
m_syntaxParser.GetNextWord(bNumber);
CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(bNumber);
if (!bNumber) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
m_dwXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str);
if (!m_dwXRefOffset || m_dwXRefOffset > m_dwFileLen) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
m_dwLastXRefOffset = m_dwXRefOffset;
SetStartOffset(m_dwXRefOffset);
m_docStatus = PDF_DATAAVAIL_CROSSREF;
- return TRUE;
+ return true;
}
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
pHints->AddSegment(req_pos, dwSize);
- return FALSE;
+ return false;
}
int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset)
{
@@ -3755,9 +3755,9 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESI
CFX_BinaryBuf buf(iSize);
uint8_t* pBuf = buf.GetBuffer();
m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false));
m_parser.m_Syntax.InitParser(file.Get(), 0);
- FX_BOOL bNumber = FALSE;
+ bool bNumber = false;
CFX_ByteString objnum = m_parser.m_Syntax.GetNextWord(bNumber);
if (!bNumber) {
return -1;
@@ -3789,18 +3789,18 @@ inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset)
m_Pos = dwOffset;
}
#define MAX_WORD_BUFFER 256
-FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
+bool CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
{
m_WordSize = 0;
uint8_t ch;
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
uint8_t type = PDF_CharType[ch];
while (1) {
while (type == 'W') {
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
type = PDF_CharType[ch];
}
@@ -3809,7 +3809,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
}
while (1) {
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
if (ch == '\r' || ch == '\n') {
break;
@@ -3822,14 +3822,14 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
if (ch == '/') {
while (1) {
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
type = PDF_CharType[ch];
if (type != 'R' && type != 'N') {
m_Pos --;
CFX_ByteString ret(m_WordBuffer, m_WordSize);
token = ret;
- return TRUE;
+ return true;
}
if (m_WordSize < MAX_WORD_BUFFER) {
m_WordBuffer[m_WordSize++] = ch;
@@ -3837,7 +3837,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
}
} else if (ch == '<') {
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
if (ch == '<') {
m_WordBuffer[m_WordSize++] = ch;
@@ -3846,7 +3846,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
}
} else if (ch == '>') {
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
if (ch == '>') {
m_WordBuffer[m_WordSize++] = ch;
@@ -3856,14 +3856,14 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
}
CFX_ByteString ret(m_WordBuffer, m_WordSize);
token = ret;
- return TRUE;
+ return true;
}
while (1) {
if (m_WordSize < MAX_WORD_BUFFER) {
m_WordBuffer[m_WordSize++] = ch;
}
if (!GetNextChar(ch)) {
- return FALSE;
+ return false;
}
type = PDF_CharType[ch];
if (type == 'D' || type == 'W') {
@@ -3873,13 +3873,13 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
}
CFX_ByteString ret(m_WordBuffer, m_WordSize);
token = ret;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch)
+bool CPDF_DataAvail::GetNextChar(uint8_t &ch)
{
FX_FILESIZE pos = m_Pos;
if (pos >= m_dwFileLen) {
- return FALSE;
+ return false;
}
if (m_bufferOffset >= pos || (FX_FILESIZE)(m_bufferOffset + m_bufferSize) <= pos) {
FX_FILESIZE read_pos = pos;
@@ -3891,16 +3891,16 @@ FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch)
read_pos = m_dwFileLen - read_size;
}
if (!m_pFileRead->ReadBlock(m_bufferData, read_pos, read_size)) {
- return FALSE;
+ return false;
}
m_bufferOffset = read_pos;
m_bufferSize = read_size;
}
ch = m_bufferData[pos - m_bufferOffset];
m_Pos ++;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
+bool CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
{
int32_t iSize = 0;
CFX_ByteString token;
@@ -3908,16 +3908,16 @@ FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
if (!GetNextToken(token)) {
iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
- return FALSE;
+ return false;
}
if (token == "trailer") {
m_dwTrailerOffset = m_Pos;
m_docStatus = PDF_DATAAVAIL_TRAILER;
- return TRUE;
+ return true;
}
}
}
-FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
+bool CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
{
FX_FILESIZE xref_offset = 0;
int32_t nRet = CheckCrossRefStream(pHints, xref_offset);
@@ -3928,21 +3928,21 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
m_dwCurrentXRefSteam = xref_offset;
m_Pos = xref_offset;
}
- return TRUE;
+ return true;
}
if (nRet == -1) {
m_docStatus = PDF_DATAAVAIL_ERROR;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
{
int32_t iSize = 0;
CFX_ByteString token;
if (!GetNextToken(token)) {
iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
- return FALSE;
+ return false;
}
if (token == "xref") {
m_CrossOffset.InsertAt(0, m_dwXRefOffset);
@@ -3951,28 +3951,28 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM;
- return FALSE;
+ return false;
}
if (token == "trailer") {
m_dwTrailerOffset = m_Pos;
m_docStatus = PDF_DATAAVAIL_TRAILER;
- return TRUE;
+ return true;
}
}
} else {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
{
if (m_Pos < m_dwFileLen) {
FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos();
int32_t iSize = (int32_t)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512);
if (!m_pFileAvail->IsDataAvail(dwAppendPos, iSize)) {
pHints->AddSegment(dwAppendPos, iSize);
- return FALSE;
+ return false;
}
}
if (m_dwPrevXRefOffset) {
@@ -3981,9 +3981,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
} else {
m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
{
int32_t iTrailerSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) {
@@ -3992,21 +3992,21 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
uint8_t* pBuf = buf.GetBuffer();
if (!pBuf) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) {
- return FALSE;
+ return false;
}
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false));
m_syntaxParser.InitParser(file.Get(), 0);
CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0);
if (!pTrailer) {
m_Pos += m_syntaxParser.SavePos();
pHints->AddSegment(m_Pos, iTrailerSize);
- return FALSE;
+ return false;
}
if (pTrailer->GetType() != PDFOBJ_DICTIONARY) {
- return FALSE;
+ return false;
}
CPDF_Dictionary *pTrailerDict = pTrailer->GetDict();
if (pTrailerDict) {
@@ -4014,7 +4014,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
pTrailer->Release();
- return TRUE;
+ return true;
}
}
FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"));
@@ -4032,60 +4032,60 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
}
}
- return TRUE;
+ return true;
}
m_dwPrevXRefOffset = 0;
m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
pTrailer->Release();
- return TRUE;
+ return true;
}
pHints->AddSegment(m_Pos, iTrailerSize);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints)
{
- while (TRUE) {
+ while (true) {
switch (m_docStatus) {
case PDF_DATAAVAIL_PAGETREE:
if (!LoadDocPages(pHints)) {
- return FALSE;
+ return false;
}
break;
case PDF_DATAAVAIL_PAGE:
if (!LoadDocPage(iPage, pHints)) {
- return FALSE;
+ return false;
}
break;
case PDF_DATAAVAIL_ERROR:
return LoadAllFile(pHints);
default:
- m_bPagesTreeLoad = TRUE;
- m_bPagesLoad = TRUE;
- m_bCurPageDictLoadOK = TRUE;
+ m_bPagesTreeLoad = true;
+ m_bPagesLoad = true;
+ m_bCurPageDictLoadOK = true;
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
}
}
-FX_BOOL CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object *pPages = GetObject(dwPageNo, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPages) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
if (pPages->GetType() != PDFOBJ_ARRAY) {
pPages->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPageNode->m_type = PDF_PAGENODE_PAGES;
CPDF_Array* pArray = (CPDF_Array*)pPages;
@@ -4099,33 +4099,33 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPa
pNode->m_dwPageNo = ((CPDF_Reference*)pKid)->GetRefObjNum();
}
pPages->Release();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object *pPage = GetObject(dwPageNo, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPage) {
if (m_docStatus == PDF_DATAAVAIL_ERROR) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
if (pPage->GetType() == PDFOBJ_ARRAY) {
pPageNode->m_dwPageNo = dwPageNo;
pPageNode->m_type = PDF_PAGENODE_ARRAY;
pPage->Release();
- return TRUE;
+ return true;
}
if (pPage->GetType() != PDFOBJ_DICTIONARY) {
pPage->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
@@ -4135,7 +4135,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP
CPDF_Object *pKids = pDict->GetElement(FX_BSTRC("Kids"));
if (!pKids) {
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
switch (pKids->GetType()) {
case PDFOBJ_REFERENCE: {
@@ -4166,17 +4166,17 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP
} else {
pPage->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
pPage->Release();
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints)
{
int32_t iSize = pageNodes.m_childNode.GetSize();
if (iSize <= 0 || iPage >= iSize) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
for (int32_t i = 0; i < iSize; ++i) {
CPDF_PageNode *pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i);
@@ -4186,7 +4186,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, i
switch (pNode->m_type) {
case PDF_PAGENODE_UNKOWN:
if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) {
- return FALSE;
+ return false;
}
--i;
break;
@@ -4198,199 +4198,199 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, i
break;
case PDF_PAGENODE_PAGES:
if (!CheckPageNode(*pNode, iPage, iCount, pHints)) {
- return FALSE;
+ return false;
}
break;
case PDF_PAGENODE_ARRAY:
if (!CheckArrayPageNode(pNode->m_dwPageNo, pNode, pHints)) {
- return FALSE;
+ return false;
}
--i;
break;
}
if (iPage == iCount) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints)
{
if (m_pDocument->GetPageCount() <= iPage || m_pDocument->m_PageList.GetAt(iPage)) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
if (m_pageNodes.m_type == PDF_PAGENODE_PAGE) {
if (iPage == 0) {
m_docStatus = PDF_DATAAVAIL_DONE;
- return TRUE;
+ return true;
}
m_docStatus = PDF_DATAAVAIL_ERROR;
- return TRUE;
+ return true;
}
int32_t iCount = -1;
return CheckPageNode(m_pageNodes, iPage, iCount, pHints);
}
-FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints)
{
- FX_BOOL bExist = FALSE;
+ bool bExist = false;
CPDF_Object *pPages = GetObject(m_PagesObjNum, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPages) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pPagesDict = pPages->GetDict();
if (!pPagesDict) {
pPages->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return FALSE;
+ return false;
}
if (!pPagesDict->KeyExist(FX_BSTRC("Kids"))) {
pPages->Release();
- return TRUE;
+ return true;
}
int count = pPagesDict->GetInteger(FX_BSTRC("Count"));
if (count > 0) {
pPages->Release();
- return TRUE;
+ return true;
}
pPages->Release();
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::LoadDocPages(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::LoadDocPages(IFX_DownloadHints* pHints)
{
if (!CheckUnkownPageNode(m_PagesObjNum, &m_pageNodes, pHints)) {
- return FALSE;
+ return false;
}
if (CheckPageCount(pHints)) {
m_docStatus = PDF_DATAAVAIL_PAGE;
- return TRUE;
+ return true;
}
- m_bTotalLoadPageTree = TRUE;
- return FALSE;
+ m_bTotalLoadPageTree = true;
+ return false;
}
-FX_BOOL CPDF_DataAvail::LoadPages(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::LoadPages(IFX_DownloadHints* pHints)
{
while (!m_bPagesTreeLoad) {
if (!CheckPageStatus(pHints)) {
- return FALSE;
+ return false;
}
}
if (m_bPagesLoad) {
- return TRUE;
+ return true;
}
m_pDocument->LoadPages();
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints)
{
if (m_bLinearedDataOK) {
- return TRUE;
+ return true;
}
if (!m_bMainXRefLoadTried) {
FX_SAFE_DWORD data_size = m_dwFileLen;
data_size -= m_dwLastXRefOffset;
if (!data_size.IsValid()) {
- return FALSE;
+ return false;
}
if (!m_pFileAvail->IsDataAvail(m_dwLastXRefOffset, data_size.ValueOrDie())) {
pHints->AddSegment(m_dwLastXRefOffset, data_size.ValueOrDie());
- return FALSE;
+ return false;
}
FX_DWORD dwRet = ((CPDF_Parser *)m_pDocument->GetParser())->LoadLinearizedMainXRefTable();
- m_bMainXRefLoadTried = TRUE;
+ m_bMainXRefLoadTried = true;
if (dwRet != PDFPARSE_ERROR_SUCCESS) {
- return FALSE;
+ return false;
}
if (!PreparePageItem()) {
- return FALSE;
+ return false;
}
- m_bMainXRefLoadedOK = TRUE;
- m_bLinearedDataOK = TRUE;
+ m_bMainXRefLoadedOK = true;
+ m_bLinearedDataOK = true;
}
return m_bLinearedDataOK;
}
-FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints)
{
if (!m_objs_array.GetSize()) {
m_objs_array.RemoveAll();
m_objnum_array.RemoveAll();
CPDF_Dictionary *pPageDict = m_pDocument->GetPage(iPage);
if (!pPageDict) {
- return TRUE;
+ return true;
}
CPDF_Object *pAnnots = pPageDict->GetElement(FX_BSTRC("Annots"));
if (!pAnnots) {
- return TRUE;
+ return true;
}
CFX_PtrArray obj_array;
obj_array.Add(pAnnots);
- FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array);
+ bool bRet = IsObjectsAvail(obj_array, false, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
}
return bRet;
}
CFX_PtrArray new_objs_array;
- FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
+ bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
m_objs_array.RemoveAll();
if (!bRet) {
m_objs_array.Append(new_objs_array);
}
return bRet;
}
-FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints)
{
if (!m_bAnnotsLoad) {
if (!CheckPageAnnots(iPage, pHints)) {
- return FALSE;
+ return false;
}
- m_bAnnotsLoad = TRUE;
+ m_bAnnotsLoad = true;
}
if (m_bAnnotsLoad) {
if (!CheckLinearizedData(pHints))
- return FALSE;
+ return false;
}
- m_bPageLoadedOK = FALSE;
- return TRUE;
+ m_bPageLoadedOK = false;
+ return true;
}
-FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict)
+bool CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict)
{
CFX_AutoRestorer<int> restorer(&s_CurrentDataAvailRecursionDepth);
if (++s_CurrentDataAvailRecursionDepth > kMaxDataAvailRecursionDepth) {
- return FALSE;
+ return false;
}
CPDF_Object *pParent = pDict->GetElement("Parent");
if (!pParent) {
- return FALSE;
+ return false;
}
CPDF_Dictionary *pParentDict = pParent->GetDict();
if (!pParentDict) {
- return FALSE;
+ return false;
}
CPDF_Object *pRet = pParentDict->GetElement("Resources");
if (pRet) {
m_pPageResource = pRet;
- return TRUE;
+ return true;
}
return HaveResourceAncestor(pParentDict);
}
-FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
{
if (!m_pDocument) {
- return FALSE;
+ return false;
}
if (IsFirstCheck(iPage)) {
- m_bCurPageDictLoadOK = FALSE;
- m_bPageLoadedOK = FALSE;
- m_bAnnotsLoad = FALSE;
- m_bNeedDownLoadResource = FALSE;
+ m_bCurPageDictLoadOK = false;
+ m_bPageLoadedOK = false;
+ m_bAnnotsLoad = false;
+ m_bNeedDownLoadResource = false;
m_objs_array.RemoveAll();
m_objnum_array.RemoveAll();
}
@@ -4399,46 +4399,46 @@ FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
}
FX_DWORD dwPageLoad = 0;
if (m_pagesLoadState->Lookup(iPage, dwPageLoad) && dwPageLoad != 0) {
- return TRUE;
+ return true;
}
if (m_bLinearized) {
if ((FX_DWORD)iPage == m_dwFirstPageNo) {
- m_pagesLoadState->SetAt(iPage, TRUE);
- return TRUE;
+ m_pagesLoadState->SetAt(iPage, true);
+ return true;
}
if (!CheckLinearizedData(pHints)) {
- return FALSE;
+ return false;
}
if (m_bMainXRefLoadedOK) {
if (m_bTotalLoadPageTree) {
if (!LoadPages(pHints)) {
- return FALSE;
+ return false;
}
} else {
if (!m_bCurPageDictLoadOK && !CheckPage(iPage, pHints)) {
- return FALSE;
+ return false;
}
}
} else {
if (!LoadAllFile(pHints)) {
- return FALSE;
+ return false;
}
((CPDF_Parser *)m_pDocument->GetParser())->RebuildCrossRef();
ResetFirstCheck(iPage);
- return TRUE;
+ return true;
}
} else {
if (!m_bTotalLoadPageTree) {
if (!m_bCurPageDictLoadOK && !CheckPage(iPage, pHints)) {
- return FALSE;
+ return false;
}
}
}
if (m_bHaveAcroForm && !m_bAcroFormLoad) {
if (!CheckAcroFormSubObject(pHints)) {
- return FALSE;
+ return false;
}
- m_bAcroFormLoad = TRUE;
+ m_bAcroFormLoad = true;
}
if (!m_bPageLoadedOK) {
if (!m_objs_array.GetSize()) {
@@ -4447,23 +4447,23 @@ FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
m_pPageDict = m_pDocument->GetPage(iPage);
if (!m_pPageDict) {
ResetFirstCheck(iPage);
- return TRUE;
+ return true;
}
CFX_PtrArray obj_array;
obj_array.Add(m_pPageDict);
- FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array);
+ bool bRet = IsObjectsAvail(obj_array, true, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
- m_bPageLoadedOK = TRUE;
+ m_bPageLoadedOK = true;
} else {
return bRet;
}
} else {
CFX_PtrArray new_objs_array;
- FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
+ bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
m_objs_array.RemoveAll();
if (bRet) {
- m_bPageLoadedOK = TRUE;
+ m_bPageLoadedOK = true;
} else {
m_objs_array.Append(new_objs_array);
return bRet;
@@ -4473,9 +4473,9 @@ FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
if (m_bPageLoadedOK) {
if (!m_bAnnotsLoad) {
if (!CheckPageAnnots(iPage, pHints)) {
- return FALSE;
+ return false;
}
- m_bAnnotsLoad = TRUE;
+ m_bAnnotsLoad = true;
}
}
if (m_pPageDict && !m_bNeedDownLoadResource) {
@@ -4483,37 +4483,37 @@ FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
if (!m_pPageResource) {
m_bNeedDownLoadResource = HaveResourceAncestor(m_pPageDict);
} else {
- m_bNeedDownLoadResource = TRUE;
+ m_bNeedDownLoadResource = true;
}
}
if (m_bNeedDownLoadResource) {
- FX_BOOL bRet = CheckResources(pHints);
+ bool bRet = CheckResources(pHints);
if (!bRet) {
- return FALSE;
+ return false;
}
- m_bNeedDownLoadResource = FALSE;
+ m_bNeedDownLoadResource = false;
}
- m_bPageLoadedOK = FALSE;
- m_bAnnotsLoad = FALSE;
- m_bCurPageDictLoadOK = FALSE;
+ m_bPageLoadedOK = false;
+ m_bAnnotsLoad = false;
+ m_bCurPageDictLoadOK = false;
ResetFirstCheck(iPage);
- m_pagesLoadState->SetAt(iPage, TRUE);
- return TRUE;
+ m_pagesLoadState->SetAt(iPage, true);
+ return true;
}
-FX_BOOL CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints)
+bool CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints)
{
if (!m_objs_array.GetSize()) {
m_objs_array.RemoveAll();
CFX_PtrArray obj_array;
obj_array.Add(m_pPageResource);
- FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array);
+ bool bRet = IsObjectsAvail(obj_array, true, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
}
return bRet;
}
CFX_PtrArray new_objs_array;
- FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
+ bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
m_objs_array.RemoveAll();
if (!bRet) {
m_objs_array.Append(new_objs_array);
@@ -4549,10 +4549,10 @@ int32_t CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints)
if (!m_objs_array.GetSize()) {
m_objs_array.Add(pAcroForm->GetDict());
}
- m_bLinearizedFormParamLoad = TRUE;
+ m_bLinearizedFormParamLoad = true;
}
CFX_PtrArray new_objs_array;
- FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
+ bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
m_objs_array.RemoveAll();
if (!bRet) {
m_objs_array.Append(new_objs_array);
@@ -4568,12 +4568,12 @@ void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum)
}
m_number_array.InsertAt(iNext, dwObjNum);
}
-FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum)
+bool CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum)
{
int32_t iNext = 0;
return BinarySearch(dwObjNum, iNext);
}
-FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext)
+bool CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext)
{
int32_t iLow = 0;
int32_t iHigh = m_number_array.GetSize() - 1;
@@ -4581,7 +4581,7 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext)
int32_t iMid = (iLow + iHigh) / 2;
if (m_number_array.GetAt(iMid) == value) {
iNext = iMid;
- return TRUE;
+ return true;
}
if (m_number_array.GetAt(iMid) > value) {
iHigh = iMid - 1;
@@ -4590,7 +4590,7 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext)
}
}
iNext = iLow;
- return FALSE;
+ return false;
}
CPDF_PageNode::~CPDF_PageNode()
{
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 4903312645..76e245ad92 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -195,7 +195,7 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord()
}
return CFX_ByteStringC(pStart, dwSize);
}
-FX_BOOL CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token)
+bool CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token)
{
int token_len = token.GetLength();
while (m_dwCurPos < m_dwSize - token_len) {
@@ -205,30 +205,30 @@ FX_BOOL CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token)
m_dwCurPos ++;
}
if (m_dwCurPos == m_dwSize - token_len) {
- return FALSE;
+ return false;
}
m_dwCurPos += token_len;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_SimpleParser::SkipWord(const CFX_ByteStringC& token)
+bool CPDF_SimpleParser::SkipWord(const CFX_ByteStringC& token)
{
while (1) {
CFX_ByteStringC word = GetWord();
if (word.IsEmpty()) {
- return FALSE;
+ return false;
}
if (word == token) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_SimpleParser::FindTagPair(const CFX_ByteStringC& start_token, const CFX_ByteStringC& end_token,
+bool CPDF_SimpleParser::FindTagPair(const CFX_ByteStringC& start_token, const CFX_ByteStringC& end_token,
FX_DWORD& start_pos, FX_DWORD& end_pos)
{
if (!start_token.IsEmpty()) {
if (!SkipWord(start_token)) {
- return FALSE;
+ return false;
}
start_pos = m_dwCurPos;
}
@@ -236,15 +236,15 @@ FX_BOOL CPDF_SimpleParser::FindTagPair(const CFX_ByteStringC& start_token, const
end_pos = m_dwCurPos;
CFX_ByteStringC word = GetWord();
if (word.IsEmpty()) {
- return FALSE;
+ return false;
}
if (word == end_token) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams)
+bool CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams)
{
nParams ++;
FX_DWORD* pBuf = FX_Alloc(FX_DWORD, nParams);
@@ -262,7 +262,7 @@ FX_BOOL CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParam
CFX_ByteStringC word = GetWord();
if (word.IsEmpty()) {
FX_Free(pBuf);
- return FALSE;
+ return false;
}
if (word == token) {
if (buf_count < nParams) {
@@ -270,10 +270,10 @@ FX_BOOL CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParam
}
m_dwCurPos = pBuf[buf_index];
FX_Free(pBuf);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
static int _hex2dec(char ch)
{
@@ -368,7 +368,7 @@ CFX_ByteTextBuf& operator << (CFX_ByteTextBuf& buf, const CPDF_Object* pObj)
break;
case PDFOBJ_STRING: {
CFX_ByteString str = pObj->GetString();
- FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex();
+ bool bHex = ((CPDF_String*)pObj)->IsHex();
buf << PDF_EncodeString(str, bHex);
break;
}
@@ -417,13 +417,13 @@ CFX_ByteTextBuf& operator << (CFX_ByteTextBuf& buf, const CPDF_Object* pObj)
CPDF_Stream* p = (CPDF_Stream*)pObj;
buf << p->GetDict() << FX_BSTRC("stream\r\n");
CPDF_StreamAcc acc;
- acc.LoadAllData(p, TRUE);
+ acc.LoadAllData(p, true);
buf.AppendBlock(acc.GetData(), acc.GetSize());
buf << FX_BSTRC("\r\nendstream");
break;
}
default:
- ASSERT(FALSE);
+ ASSERT(false);
break;
}
return buf;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index f8b59913e4..a70f5bfdf9 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -18,10 +18,10 @@ CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc)
CPDF_DocRenderData::~CPDF_DocRenderData()
{
- Clear(TRUE);
+ Clear(true);
}
-void CPDF_DocRenderData::Clear(FX_BOOL bRelease)
+void CPDF_DocRenderData::Clear(bool bRelease)
{
for (auto it = m_Type3FaceMap.begin(); it != m_Type3FaceMap.end();) {
auto curr_it = it++;
@@ -48,7 +48,7 @@ void CPDF_DocRenderData::Clear(FX_BOOL bRelease)
delete m_pFontCache;
m_pFontCache = NULL;
} else {
- m_pFontCache->FreeCache(FALSE);
+ m_pFontCache->FreeCache(false);
}
}
}
@@ -118,7 +118,7 @@ void CPDF_RenderModule::DestroyDocData(CPDF_DocRenderData* pDocData)
void CPDF_RenderModule::ClearDocData(CPDF_DocRenderData* p)
{
if (p) {
- p->Clear(FALSE);
+ p->Clear(false);
}
}
void CPDF_RenderModule::DestroyPageCache(CPDF_PageRenderCache* pCache)
@@ -180,19 +180,19 @@ int CPDF_RenderStatus::s_CurrentRecursionDepth = 0;
CPDF_RenderStatus::CPDF_RenderStatus()
{
m_pContext = NULL;
- m_bStopped = FALSE;
+ m_bStopped = false;
m_pDevice = NULL;
m_pCurObj = NULL;
m_pStopObj = NULL;
m_HalftoneLimit = 0;
m_pObjectRenderer = NULL;
- m_bPrint = FALSE;
+ m_bPrint = false;
m_Transparency = 0;
m_DitherBits = 0;
- m_bDropObjects = FALSE;
- m_bStdCS = FALSE;
+ m_bDropObjects = false;
+ m_bStdCS = false;
m_GroupFamily = 0;
- m_bLoadMask = FALSE;
+ m_bLoadMask = false;
m_pType3Char = NULL;
m_T3FillColor = 0;
m_pFormResource = NULL;
@@ -205,13 +205,13 @@ CPDF_RenderStatus::~CPDF_RenderStatus()
delete m_pObjectRenderer;
}
-FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice,
+bool CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice,
const CFX_AffineMatrix* pDeviceMatrix, const CPDF_PageObject* pStopObj,
const CPDF_RenderStatus* pParentState, const CPDF_GraphicStates* pInitialStates,
- const CPDF_RenderOptions* pOptions, int transparency, FX_BOOL bDropObjects,
- CPDF_Dictionary* pFormResource, FX_BOOL bStdCS, CPDF_Type3Char* pType3Char,
+ const CPDF_RenderOptions* pOptions, int transparency, bool bDropObjects,
+ CPDF_Dictionary* pFormResource, bool bStdCS, CPDF_Type3Char* pType3Char,
FX_ARGB fill_color, FX_DWORD GroupFamily,
- FX_BOOL bLoadMask)
+ bool bLoadMask)
{
m_pContext = pContext;
m_pDevice = pDevice;
@@ -253,7 +253,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, CFX_RenderDe
}
m_pObjectRenderer = NULL;
m_Transparency = transparency;
- return TRUE;
+ return true;
}
void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, const CFX_AffineMatrix* pObj2Device)
{
@@ -267,7 +267,7 @@ void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, const CF
index ++;
CPDF_PageObject* pCurObj = pObjs->GetNextObject(pos);
if (pCurObj == m_pStopObj) {
- m_bStopped = TRUE;
+ m_bStopped = true;
return;
}
if (!pCurObj) {
@@ -301,42 +301,42 @@ void CPDF_RenderStatus::RenderSingleObject(const CPDF_PageObject* pObj, const CF
}
ProcessObjectNoClip(pObj, pObj2Device);
}
-FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause)
+bool CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause)
{
if (m_pObjectRenderer) {
if (m_pObjectRenderer->Continue(pPause)) {
- return TRUE;
+ return true;
}
if (!m_pObjectRenderer->m_Result) {
DrawObjWithBackground(pObj, pObj2Device);
}
delete m_pObjectRenderer;
m_pObjectRenderer = NULL;
- return FALSE;
+ return false;
}
m_pCurObj = pObj;
if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull())
if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
- return FALSE;
+ return false;
}
ProcessClipPath(pObj->m_ClipPath, pObj2Device);
if (ProcessTransparency(pObj, pObj2Device)) {
- return FALSE;
+ return false;
}
if (pObj->m_Type == PDFPAGE_IMAGE) {
m_pObjectRenderer = IPDF_ObjectRenderer::Create(pObj->m_Type);
- if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) {
+ if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, false)) {
if (!m_pObjectRenderer->m_Result) {
DrawObjWithBackground(pObj, pObj2Device);
}
delete m_pObjectRenderer;
m_pObjectRenderer = NULL;
- return FALSE;
+ return false;
}
return ContinueSingleObject(pObj, pObj2Device, pPause);
}
ProcessObjectNoClip(pObj, pObj2Device);
- return FALSE;
+ return false;
}
IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type)
{
@@ -345,7 +345,7 @@ IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type)
}
return new CPDF_ImageRenderer;
}
-FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bLogical, FX_RECT &rect) const
+bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, bool bLogical, FX_RECT &rect) const
{
rect = pObj->GetBBox(pObj2Device);
FX_RECT rtClip = m_pDevice->GetClipBox();
@@ -370,7 +370,7 @@ void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj, const CFX_
return;
}
FX_RECT rect;
- if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) {
+ if (GetObjectClippedRect(pObj, pObj2Device, false, rect)) {
return;
}
if (m_DitherBits == 2) {
@@ -386,7 +386,7 @@ void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj, const CFX_
}
void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device)
{
- FX_BOOL bRet = FALSE;
+ bool bRet = false;
switch (pObj->m_Type) {
case PDFPAGE_TEXT:
bRet = ProcessText((CPDF_TextObject*)pObj, pObj2Device, NULL);
@@ -408,9 +408,9 @@ void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, const C
DrawObjWithBackground(pObj, pObj2Device);
}
}
-FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device)
{
- FX_BOOL bRet = FALSE;
+ bool bRet = false;
switch (pObj->m_Type) {
case PDFPAGE_PATH:
bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device);
@@ -433,7 +433,7 @@ void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix &matrix) const
void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device)
{
FX_RECT rect;
- if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) {
+ if (GetObjectClippedRect(pObj, pObj2Device, false, rect)) {
return;
}
int res = 300;
@@ -459,11 +459,11 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, const
status.RenderSingleObject(pObj, &matrix);
buffer.OutputToDevice();
}
-FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device)
{
CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC"));
if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
- return TRUE;
+ return true;
}
CFX_AffineMatrix matrix = pFormObj->m_FormMatrix;
matrix.Concat(*pObj2Device);
@@ -473,15 +473,15 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_Affi
}
CPDF_RenderStatus status;
status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj,
- this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, FALSE);
+ this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, false);
status.m_curBlend = m_curBlend;
m_pDevice->SaveState();
status.RenderObjectList(pFormObj->m_pForm, &matrix);
m_bStopped = status.m_bStopped;
m_pDevice->RestoreState();
- return TRUE;
+ return true;
}
-FX_BOOL IsAvailableMatrix(const CFX_AffineMatrix& matrix)
+bool IsAvailableMatrix(const CFX_AffineMatrix& matrix)
{
if (matrix.a == 0 || matrix.d == 0) {
return matrix.b != 0 && matrix.c != 0;
@@ -489,15 +489,15 @@ FX_BOOL IsAvailableMatrix(const CFX_AffineMatrix& matrix)
if (matrix.b == 0 || matrix.c == 0) {
return matrix.a != 0 && matrix.d != 0;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device)
{
int FillType = pPathObj->m_FillType;
- FX_BOOL bStroke = pPathObj->m_bStroke;
+ bool bStroke = pPathObj->m_bStroke;
ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke);
if (FillType == 0 && !bStroke) {
- return TRUE;
+ return true;
}
FX_DWORD fill_argb = 0;
if (FillType) {
@@ -510,7 +510,7 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_Affi
CFX_AffineMatrix path_matrix = pPathObj->m_Matrix;
path_matrix.Concat(*pObj2Device);
if (!IsAvailableMatrix(path_matrix)) {
- return TRUE;
+ return true;
}
if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) {
FillType |= FXFILL_RECT_AA;
@@ -546,7 +546,7 @@ CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const
}
return pDocCache->GetTransferFunc(pObj);
}
-FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bType3) const
+FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, bool bType3) const
{
CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)pObj->m_ColorState;
if (m_pType3Char && !bType3 && (!m_pType3Char->m_bColored || (m_pType3Char->m_bColored && (!pColorData || pColorData->m_FillColor.IsNull())))) {
@@ -612,7 +612,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Affine
if (m_LastClipPath.IsNull()) {
return;
}
- m_pDevice->RestoreState(TRUE);
+ m_pDevice->RestoreState(true);
m_LastClipPath.SetNull();
return;
}
@@ -620,7 +620,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Affine
return;
}
m_LastClipPath = ClipPath;
- m_pDevice->RestoreState(TRUE);
+ m_pDevice->RestoreState(true);
int nClipPath = ClipPath.GetPathCount();
int i;
for (i = 0; i < nClipPath; i++) {
@@ -690,7 +690,7 @@ void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, const CFX_AffineMat
m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000, fill_mode);
}
}
-FX_BOOL CPDF_RenderStatus::SelectClipPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke)
+bool CPDF_RenderStatus::SelectClipPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, bool bStroke)
{
CFX_AffineMatrix path_matrix = pPathObj->m_Matrix;
path_matrix.Concat(*pObj2Device);
@@ -707,12 +707,12 @@ FX_BOOL CPDF_RenderStatus::SelectClipPath(CPDF_PathObject* pPathObj, const CFX_A
}
return m_pDevice->SetClip_PathFill(pPathObj->m_Path, &path_matrix, fill_mode);
}
-FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device)
{
const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState;
int blend_type = pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL;
if (blend_type == FXDIB_BLEND_UNSUPPORTED) {
- return TRUE;
+ return true;
}
CPDF_Dictionary* pSMaskDict = pGeneralState ? (CPDF_Dictionary*)pGeneralState->m_pSoftMask : NULL;
if (pSMaskDict) {
@@ -724,7 +724,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
CPDF_Dictionary* pFormResource = NULL;
FX_FLOAT group_alpha = 1.0f;
int Transparency = m_Transparency;
- FX_BOOL bGroupTransparent = FALSE;
+ bool bGroupTransparent = false;
if (pPageObj->m_Type == PDFPAGE_FORM) {
CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj;
const CPDF_GeneralStateData *pStateData = pFormObj->m_GeneralState.GetObject();
@@ -732,15 +732,15 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
group_alpha = pStateData->m_FillAlpha;
}
Transparency = pFormObj->m_pForm->m_Transparency;
- bGroupTransparent = Transparency & PDFTRANS_ISOLATED ? TRUE : FALSE;
+ bGroupTransparent = Transparency & PDFTRANS_ISOLATED ? true : false;
if (pFormObj->m_pForm->m_pFormDict) {
pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict("Resources");
}
}
- FX_BOOL bTextClip = FALSE;
+ bool bTextClip = false;
if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() &&
m_pDevice->GetDeviceClass() == FXDC_DISPLAY && !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) {
- bTextClip = TRUE;
+ bTextClip = true;
}
if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->m_Type == PDFPAGE_IMAGE && pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) {
CPDF_Document* pDocument = NULL;
@@ -763,11 +763,11 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
}
}
if (pSMaskDict == NULL && group_alpha == 1.0f && blend_type == FXDIB_BLEND_NORMAL && !bTextClip && !bGroupTransparent) {
- return FALSE;
+ return false;
}
- FX_BOOL isolated = Transparency & PDFTRANS_ISOLATED;
+ bool isolated = Transparency & PDFTRANS_ISOLATED;
if (m_bPrint) {
- FX_BOOL bRet = FALSE;
+ bool bRet = false;
int rendCaps = m_pDevice->GetRenderCaps();
if (!((Transparency & PDFTRANS_ISOLATED) || pSMaskDict || bTextClip) && (rendCaps & FXRC_BLEND_MODE)) {
int oldBlend = m_curBlend;
@@ -778,12 +778,12 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
if (!bRet) {
DrawObjWithBackground(pPageObj, pObj2Device);
}
- return TRUE;
+ return true;
}
FX_RECT rect = pPageObj->GetBBox(pObj2Device);
rect.Intersect(m_pDevice->GetClipBox());
if (rect.IsEmpty()) {
- return TRUE;
+ return true;
}
CFX_Matrix deviceCTM = m_pDevice->GetCTM();
FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);
@@ -795,12 +795,12 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
oriDevice = new CFX_DIBitmap;
if (!m_pDevice->CreateCompatibleBitmap(oriDevice, width, height)) {
- return TRUE;
+ return true;
}
m_pDevice->GetDIBits(oriDevice, rect.left, rect.top);
}
if (!bitmap_device.Create(width, height, FXDIB_Argb, 0, oriDevice)) {
- return TRUE;
+ return true;
}
CFX_DIBitmap* bitmap = bitmap_device.GetBitmap();
bitmap->Clear(0);
@@ -812,7 +812,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
pTextMask = new CFX_DIBitmap;
if (!pTextMask->Create(width, height, FXDIB_8bppMask)) {
delete pTextMask;
- return TRUE;
+ return true;
}
pTextMask->Clear(0);
CFX_FxgeDevice text_device;
@@ -831,7 +831,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
}
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pContext, &bitmap_device, NULL,
- m_pStopObj, NULL, NULL, &m_Options, 0, m_bDropObjects, pFormResource, TRUE);
+ m_pStopObj, NULL, NULL, &m_Options, 0, m_bDropObjects, pFormResource, true);
bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix);
m_bStopped = bitmap_render.m_bStopped;
if (pSMaskDict) {
@@ -858,10 +858,10 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
}
CompositeDIBitmap(bitmap, rect.left, rect.top, 0, 255, blend_type, Transparency);
delete oriDevice;
- return TRUE;
+ return true;
}
CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, int& top,
- FX_BOOL bBackAlphaRequired)
+ bool bBackAlphaRequired)
{
FX_RECT bbox = rect;
bbox.Intersect(m_pDevice->GetClipBox());
@@ -882,7 +882,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, const
delete pBackdrop;
return NULL;
}
- FX_BOOL bNeedDraw;
+ bool bNeedDraw;
if (pBackdrop->HasAlpha()) {
bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT);
} else {
@@ -911,7 +911,7 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, const CPDF_PageObj
device.FillRect(&rect, 0xffffffff);
Render(&device, pObj, pOptions, pFinalMatrix);
}
-CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(const CPDF_GraphicStates* pSrcStates, FX_BOOL bStroke)
+CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(const CPDF_GraphicStates* pSrcStates, bool bStroke)
{
if (!pSrcStates) {
return NULL;
@@ -932,14 +932,14 @@ CPDF_RenderContext::CPDF_RenderContext()
{
}
void CPDF_RenderContext::Create(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache,
- CPDF_Dictionary* pPageResources, FX_BOOL bFirstLayer)
+ CPDF_Dictionary* pPageResources, bool bFirstLayer)
{
m_pDocument = pDoc;
m_pPageResources = pPageResources;
m_pPageCache = pPageCache;
m_bFirstLayer = bFirstLayer;
}
-void CPDF_RenderContext::Create(CPDF_Page* pPage, FX_BOOL bFirstLayer)
+void CPDF_RenderContext::Create(CPDF_Page* pPage, bool bFirstLayer)
{
m_pDocument = pPage->m_pDocument;
m_pPageResources = pPage->m_pPageResources;
@@ -954,7 +954,7 @@ void CPDF_RenderContext::Clear()
m_pDocument = NULL;
m_pPageResources = NULL;
m_pPageCache = NULL;
- m_bFirstLayer = TRUE;
+ m_bFirstLayer = true;
m_ContentList.RemoveAll();
}
void CPDF_RenderContext::AppendObjectList(CPDF_PageObjects* pObjs, const CFX_AffineMatrix* pObject2Device)
@@ -984,7 +984,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_PageObject
FinalMatrix.Concat(*pLastMatrix);
CPDF_RenderStatus status;
status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL, pOptions,
- pItem->m_pObjectList->m_Transparency, FALSE, NULL);
+ pItem->m_pObjectList->m_Transparency, false, NULL);
status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix);
if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
@@ -996,7 +996,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_PageObject
} else {
CPDF_RenderStatus status;
status.Initialize(this, pDevice, NULL, pStopObj, NULL, NULL, pOptions,
- pItem->m_pObjectList->m_Transparency, FALSE, NULL);
+ pItem->m_pObjectList->m_Transparency, false, NULL);
status.RenderObjectList(pItem->m_pObjectList, &pItem->m_Matrix);
if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
@@ -1090,7 +1090,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause)
m_pRenderStatus.reset(new CPDF_RenderStatus());
m_pRenderStatus->Initialize(
m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions,
- pItem->m_pObjectList->m_Transparency, FALSE, NULL);
+ pItem->m_pObjectList->m_Transparency, false, NULL);
m_pDevice->SaveState();
m_ClipRect = m_pDevice->GetClipBox();
CFX_AffineMatrix device2object;
@@ -1171,10 +1171,10 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj)
}
CPDF_Function* pFuncs[3] = { nullptr, nullptr, nullptr };
- FX_BOOL bUniTransfer = TRUE;
- FX_BOOL bIdentity = TRUE;
+ bool bUniTransfer = true;
+ bool bIdentity = true;
if (pObj->GetType() == PDFOBJ_ARRAY) {
- bUniTransfer = FALSE;
+ bUniTransfer = false;
CPDF_Array* pArray = (CPDF_Array*)pObj;
if (pArray->GetCount() < 3)
return nullptr;
@@ -1208,7 +1208,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj)
pFuncs[0]->Call(&input, 1, output, noutput);
int o = FXSYS_round(output[0] * 255);
if (o != v)
- bIdentity = FALSE;
+ bIdentity = false;
for (int i = 0; i < 3; ++i) {
pTransfer->m_Samples[i * 256 + v] = o;
}
@@ -1218,7 +1218,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj)
pFuncs[i]->Call(&input, 1, output, noutput);
int o = FXSYS_round(output[0] * 255);
if (o != v)
- bIdentity = FALSE;
+ bIdentity = false;
pTransfer->m_Samples[i * 256 + v] = o;
} else {
pTransfer->m_Samples[i * 256 + v] = v;
@@ -1258,7 +1258,7 @@ CPDF_DeviceBuffer::~CPDF_DeviceBuffer()
{
delete m_pBitmap;
}
-FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
+bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
const CPDF_PageObject* pObj, int max_dpi)
{
m_pDevice = pDevice;
@@ -1289,7 +1289,7 @@ FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDe
FX_RECT bitmap_rect = rect.GetOutterRect();
m_pBitmap = new CFX_DIBitmap;
m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb);
- return TRUE;
+ return true;
}
void CPDF_DeviceBuffer::OutputToDevice()
{
@@ -1316,13 +1316,13 @@ CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer()
delete m_pBitmapDevice;
}
#define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024)
-FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
+bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
const CPDF_PageObject* pObj, const CPDF_RenderOptions *pOptions, int max_dpi)
{
FXSYS_assert(pRect != NULL);
m_pDevice = pDevice;
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) {
- return TRUE;
+ return true;
}
m_pContext = pContext;
m_Rect = *pRect;
@@ -1357,7 +1357,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re
iHeight = bitmap_rect.Height();
iPitch = (iWidth * bpp + 31) / 32 * 4;
if (iWidth * iHeight < 1) {
- return FALSE;
+ return false;
}
if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ &&
m_pBitmapDevice->Create(iWidth, iHeight, dibFormat)) {
@@ -1366,7 +1366,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re
m_Matrix.Scale(0.5f, 0.5f);
}
m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, &m_Matrix);
- return TRUE;
+ return true;
}
void CPDF_ScaledRenderBuffer::OutputToDevice()
{
@@ -1374,7 +1374,7 @@ void CPDF_ScaledRenderBuffer::OutputToDevice()
m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, m_Rect.top, m_Rect.Width(), m_Rect.Height());
}
}
-FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj)
+bool IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj)
{
const CPDF_ContentMarkData* pData = pObj->m_ContentMark;
int nItems = pData->CountItems();
@@ -1383,9 +1383,9 @@ FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj)
if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) {
CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam();
if (!CheckOCGVisible(pOCG)) {
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index cdbecd65ea..d9767b4817 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -108,16 +108,16 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const
return pImageCache->EstimateSize();
}
void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor,
- FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus,
+ bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth, int32_t downsampleHeight)
{
CPDF_ImageCache* pImageCache;
- FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (void*&)pImageCache);
+ bool bFind = m_ImageCaches.Lookup(pStream, (void*&)pImageCache);
if (!bFind) {
pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream);
}
m_nTimeCount ++;
- FX_BOOL bCached = pImageCache->GetCachedBitmap(pBitmap, pMask, MatteColor, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight);
+ bool bCached = pImageCache->GetCachedBitmap(pBitmap, pMask, MatteColor, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight);
if (!bFind) {
m_ImageCaches.SetAt(pStream, pImageCache);
}
@@ -125,7 +125,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*&
m_nCacheSize += pImageCache->EstimateSize();
}
}
-FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight)
+bool CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight)
{
m_bCurFindCache = m_ImageCaches.Lookup(pStream, (void*&)m_pCurImageCache);
if (!m_bCurFindCache) {
@@ -133,7 +133,7 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL
}
int ret = m_pCurImageCache->StartGetCachedBitmap(pRenderStatus->m_pFormResource, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight);
if (ret == 2) {
- return TRUE;
+ return true;
}
m_nTimeCount ++;
if (!m_bCurFindCache) {
@@ -142,13 +142,13 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL
if (!ret) {
m_nCacheSize += m_pCurImageCache->EstimateSize();
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause)
+bool CPDF_PageRenderCache::Continue(IFX_Pause* pPause)
{
int ret = m_pCurImageCache->Continue(pPause);
if (ret == 2) {
- return TRUE;
+ return true;
}
m_nTimeCount ++;
if (!m_bCurFindCache) {
@@ -157,7 +157,7 @@ FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause)
if (!ret) {
m_nCacheSize += m_pCurImageCache->EstimateSize();
}
- return FALSE;
+ return false;
}
void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap)
{
@@ -222,18 +222,18 @@ static FX_DWORD FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB)
{
return pDIB && pDIB->GetBuffer() ? (FX_DWORD)pDIB->GetHeight() * pDIB->GetPitch() + (FX_DWORD)pDIB->GetPaletteSize() * 4 : 0;
}
-FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus,
+bool CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources,
+ bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth, int32_t downsampleHeight)
{
if (m_pCachedBitmap) {
pBitmap = m_pCachedBitmap;
pMask = m_pCachedMask;
MatteColor = m_MatteColor;
- return TRUE;
+ return true;
}
if (!pRenderStatus) {
- return FALSE;
+ return false;
}
CPDF_RenderContext*pContext = pRenderStatus->GetContext();
CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache;
@@ -243,7 +243,7 @@ FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*
if (!pSrc->Load(m_pDocument, m_pStream, &pMaskSrc, &MatteColor, pRenderStatus->m_pFormResource, pPageResources, bStdCS, GroupFamily, bLoadMask)) {
delete pSrc;
pBitmap = NULL;
- return FALSE;
+ return false;
}
m_MatteColor = MatteColor;
if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) {
@@ -260,7 +260,7 @@ FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*
pBitmap = m_pCachedBitmap;
pMask = m_pCachedMask;
CalcSize();
- return FALSE;
+ return false;
}
CFX_DIBSource* CPDF_ImageCache::DetachBitmap()
{
@@ -274,8 +274,8 @@ CFX_DIBSource* CPDF_ImageCache::DetachMask()
m_pCurMask = NULL;
return pDIBSource;
}
-int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS,
- FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus,
+int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, bool bStdCS,
+ FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth, int32_t downsampleHeight)
{
if (m_pCachedBitmap) {
@@ -288,7 +288,7 @@ int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_
}
m_pRenderStatus = pRenderStatus;
m_pCurBitmap = new CPDF_DIBSource;
- int ret = ((CPDF_DIBSource*)m_pCurBitmap)->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResources, pPageResources, bStdCS, GroupFamily, bLoadMask);
+ int ret = ((CPDF_DIBSource*)m_pCurBitmap)->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResources, pPageResources, bStdCS, GroupFamily, bLoadMask);
if (ret == 2) {
return ret;
}
@@ -347,7 +347,7 @@ void CPDF_Document::ClearRenderFont()
if (m_pDocRender) {
CFX_FontCache* pCache = m_pDocRender->GetFontCache();
if (pCache) {
- pCache->FreeCache(FALSE);
+ pCache->FreeCache(false);
}
}
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index fa9325a4d2..258ad111fa 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -13,7 +13,7 @@
#include "../fpdf_page/pageint.h"
#include "render_int.h"
-FX_BOOL CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pObj2Device)
{
CPDF_ImageRenderer render;
if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) {
@@ -27,8 +27,8 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int
if (pDIBitmap == NULL) {
return;
}
- FX_BOOL bIsolated = Transparency & PDFTRANS_ISOLATED;
- FX_BOOL bGroup = Transparency & PDFTRANS_GROUP;
+ bool bIsolated = Transparency & PDFTRANS_ISOLATED;
+ bool bGroup = Transparency & PDFTRANS_GROUP;
if (blend_mode == FXDIB_BLEND_NORMAL) {
if (!pDIBitmap->IsAlphaMask()) {
if (bitmap_alpha < 255) {
@@ -47,8 +47,8 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int
}
}
}
- FX_BOOL bBackAlphaRequired = blend_mode && bIsolated && !m_bDropObjects;
- FX_BOOL bGetBackGround = ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
+ bool bBackAlphaRequired = blend_mode && bIsolated && !m_bDropObjects;
+ bool bGetBackGround = ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
(!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) && (m_pDevice->GetRenderCaps()
& FXRC_GET_BITS) && !bBackAlphaRequired);
if (bGetBackGround) {
@@ -61,9 +61,9 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight());
rect.Intersect(m_pDevice->GetClipBox());
CFX_DIBitmap* pClone = NULL;
- FX_BOOL bClone = FALSE;
+ bool bClone = false;
if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
- bClone = TRUE;
+ bClone = true;
pClone = m_pDevice->GetBackDrop()->Clone(&rect);
CFX_DIBitmap *pForeBitmap = m_pDevice->GetBitmap();
pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), pForeBitmap, rect.left, rect.top);
@@ -118,7 +118,7 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb)
return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)], m_Samples[256 + FXSYS_GetGValue(rgb)],
m_Samples[512 + FXSYS_GetBValue(rgb)]);
}
-CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc)
+CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc)
{
CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this);
pDest->LoadSrc(pSrc, bAutoDropSrc);
@@ -144,7 +144,7 @@ CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFun
void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const
{
int i;
- FX_BOOL bSkip = FALSE;
+ bool bSkip = false;
switch (m_pSrc->GetFormat()) {
case FXDIB_1bppRgb: {
int r0 = m_RampR[0], g0 = m_RampG[0], b0 = m_RampB[0];
@@ -213,7 +213,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, const uint8_t* s
}
break;
case FXDIB_Rgb32:
- bSkip = TRUE;
+ bSkip = true;
case FXDIB_Argb:
for (i = 0; i < m_Width; i ++) {
*dest_buf++ = m_RampB[*(src_buf++)];
@@ -266,31 +266,31 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, const uint8_t
}
}
}
-static FX_BOOL _IsSupported(CPDF_ColorSpace* pCS)
+static bool _IsSupported(CPDF_ColorSpace* pCS)
{
if (pCS->GetFamily() == PDFCS_DEVICERGB || pCS->GetFamily() == PDFCS_DEVICEGRAY ||
pCS->GetFamily() == PDFCS_DEVICECMYK || pCS->GetFamily() == PDFCS_CALGRAY ||
pCS->GetFamily() == PDFCS_CALRGB) {
- return TRUE;
+ return true;
}
if (pCS->GetFamily() == PDFCS_INDEXED && _IsSupported(pCS->GetBaseCS())) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CPDF_ImageRenderer::CPDF_ImageRenderer()
{
m_pRenderStatus = NULL;
m_pImageObject = NULL;
- m_Result = TRUE;
+ m_Result = true;
m_Status = 0;
m_pQuickStretcher = NULL;
m_pTransformer = NULL;
m_DeviceHandle = NULL;
m_LoadHandle = NULL;
m_pClone = NULL;
- m_bStdCS = FALSE;
- m_bPatternColor = FALSE;
+ m_bStdCS = false;
+ m_bPatternColor = false;
m_BlendType = FXDIB_BLEND_NORMAL;
m_pPattern = NULL;
m_pObj2Device = NULL;
@@ -305,7 +305,7 @@ CPDF_ImageRenderer::~CPDF_ImageRenderer()
delete (CPDF_ProgressiveImageLoaderHandle*)m_LoadHandle;
delete m_pClone;
}
-FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource()
+bool CPDF_ImageRenderer::StartLoadDIBSource()
{
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOutterRect();
@@ -321,16 +321,16 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource()
m_pRenderStatus->m_GroupFamily, m_pRenderStatus->m_bLoadMask, m_pRenderStatus, dest_width, dest_height)) {
if (m_LoadHandle != NULL) {
m_Status = 4;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
+bool CPDF_ImageRenderer::StartRenderDIBSource()
{
if (m_Loader.m_pBitmap == NULL) {
- return FALSE;
+ return false;
}
m_BitmapAlpha = 255;
const CPDF_GeneralStateData* pGeneralState = m_pImageObject->m_GeneralState;
@@ -350,18 +350,18 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
if (m_Loader.m_bCached && m_Loader.m_pMask) {
m_Loader.m_pMask = m_Loader.m_pMask->Clone();
}
- m_Loader.m_bCached = FALSE;
+ m_Loader.m_bCached = false;
}
}
m_FillArgb = 0;
- m_bPatternColor = FALSE;
+ m_bPatternColor = false;
m_pPattern = NULL;
if (m_pDIBSource->IsAlphaMask()) {
CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor();
if (pColor && pColor->IsPattern()) {
m_pPattern = pColor->GetPattern();
if (m_pPattern != NULL) {
- m_bPatternColor = TRUE;
+ m_bPatternColor = true;
}
}
m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject);
@@ -430,7 +430,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
}
return StartDIBSource();
}
-FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType)
+bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, bool bStdCS, int blendType)
{
m_pRenderStatus = pStatus;
m_bStdCS = bStdCS;
@@ -439,17 +439,17 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObj
m_pObj2Device = pObj2Device;
CPDF_Dictionary* pOC = m_pImageObject->m_pImage->GetOC();
if (pOC && m_pRenderStatus->m_Options.m_pOCContext && !m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
- return FALSE;
+ return false;
}
m_ImageMatrix = m_pImageObject->m_Matrix;
m_ImageMatrix.Concat(*pObj2Device);
if (StartLoadDIBSource()) {
- return TRUE;
+ return true;
}
return StartRenderDIBSource();
}
-FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* pDIBSource, FX_ARGB bitmap_argb,
- int bitmap_alpha, const CFX_AffineMatrix* pImage2Device, FX_DWORD flags, FX_BOOL bStdCS, int blendType)
+bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* pDIBSource, FX_ARGB bitmap_argb,
+ int bitmap_alpha, const CFX_AffineMatrix* pImage2Device, FX_DWORD flags, bool bStdCS, int blendType)
{
m_pRenderStatus = pStatus;
m_pDIBSource = pDIBSource;
@@ -461,16 +461,16 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CFX_DIBSourc
m_BlendType = blendType;
return StartDIBSource();
}
-FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device)
+bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device)
{
if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return FALSE;
+ m_Result = false;
+ return false;
}
FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOutterRect();
rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox());
if (rect.IsEmpty()) {
- return FALSE;
+ return false;
}
CFX_AffineMatrix new_matrix = m_ImageMatrix;
new_matrix.TranslateI(-rect.left, -rect.top);
@@ -478,32 +478,32 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device)
int height = rect.Height();
CFX_FxgeDevice bitmap_device1;
if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32)) {
- return TRUE;
+ return true;
}
bitmap_device1.GetBitmap()->Clear(0xffffff);
{
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, NULL,
- NULL, NULL, &m_pRenderStatus->m_Options, 0, m_pRenderStatus->m_bDropObjects, NULL, TRUE);
+ NULL, NULL, &m_pRenderStatus->m_Options, 0, m_pRenderStatus->m_bDropObjects, NULL, true);
CFX_Matrix patternDevice = *pObj2Device;
patternDevice.Translate((FX_FLOAT) - rect.left, (FX_FLOAT) - rect.top);
if(m_pPattern->m_PatternType == PATTERN_TILING) {
- bitmap_render.DrawTilingPattern((CPDF_TilingPattern*)m_pPattern, m_pImageObject, &patternDevice, FALSE);
+ bitmap_render.DrawTilingPattern((CPDF_TilingPattern*)m_pPattern, m_pImageObject, &patternDevice, false);
} else {
- bitmap_render.DrawShadingPattern((CPDF_ShadingPattern*)m_pPattern, m_pImageObject, &patternDevice, FALSE);
+ bitmap_render.DrawShadingPattern((CPDF_ShadingPattern*)m_pPattern, m_pImageObject, &patternDevice, false);
}
}
{
CFX_FxgeDevice bitmap_device2;
if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb)) {
- return TRUE;
+ return true;
}
bitmap_device2.GetBitmap()->Clear(0);
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, NULL,
- NULL, NULL, NULL, 0, m_pRenderStatus->m_bDropObjects, NULL, TRUE);
+ NULL, NULL, NULL, 0, m_pRenderStatus->m_bDropObjects, NULL, true);
CPDF_ImageRenderer image_render;
- if (image_render.Start(&bitmap_render, m_pDIBSource, 0xffffffff, 255, &new_matrix, m_Flags, TRUE)) {
+ if (image_render.Start(&bitmap_render, m_pDIBSource, 0xffffffff, 255, &new_matrix, m_Flags, true)) {
image_render.Continue(NULL);
}
if (m_Loader.m_MatteColor != 0xffffffff) {
@@ -549,18 +549,18 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device)
bitmap_device1.GetBitmap()->MultiplyAlpha(255);
}
m_pRenderStatus->m_pDevice->SetDIBits(bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::DrawMaskedImage()
+bool CPDF_ImageRenderer::DrawMaskedImage()
{
if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return FALSE;
+ m_Result = false;
+ return false;
}
FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOutterRect();
rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox());
if (rect.IsEmpty()) {
- return FALSE;
+ return false;
}
CFX_AffineMatrix new_matrix = m_ImageMatrix;
new_matrix.TranslateI(-rect.left, -rect.top);
@@ -568,29 +568,29 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage()
int height = rect.Height();
CFX_FxgeDevice bitmap_device1;
if (!bitmap_device1.Create(width, height, FXDIB_Rgb32)) {
- return TRUE;
+ return true;
}
bitmap_device1.GetBitmap()->Clear(0xffffff);
{
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, NULL,
- NULL, NULL, NULL, 0, m_pRenderStatus->m_bDropObjects, NULL, TRUE);
+ NULL, NULL, NULL, 0, m_pRenderStatus->m_bDropObjects, NULL, true);
CPDF_ImageRenderer image_render;
- if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, m_Flags, TRUE)) {
+ if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, m_Flags, true)) {
image_render.Continue(NULL);
}
}
{
CFX_FxgeDevice bitmap_device2;
if (!bitmap_device2.Create(width, height, FXDIB_8bppRgb)) {
- return TRUE;
+ return true;
}
bitmap_device2.GetBitmap()->Clear(0);
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, NULL,
- NULL, NULL, NULL, 0, m_pRenderStatus->m_bDropObjects, NULL, TRUE);
+ NULL, NULL, NULL, 0, m_pRenderStatus->m_bDropObjects, NULL, true);
CPDF_ImageRenderer image_render;
- if (image_render.Start(&bitmap_render, m_Loader.m_pMask, 0xffffffff, 255, &new_matrix, m_Flags, TRUE)) {
+ if (image_render.Start(&bitmap_render, m_Loader.m_pMask, 0xffffffff, 255, &new_matrix, m_Flags, true)) {
image_render.Continue(NULL);
}
if (m_Loader.m_MatteColor != 0xffffffff) {
@@ -638,9 +638,9 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage()
}
}
m_pRenderStatus->m_pDevice->SetDIBits(bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::StartDIBSource()
+bool CPDF_ImageRenderer::StartDIBSource()
{
if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBSource->GetBPP() > 1) {
int image_size = m_pDIBSource->GetBPP() / 8 * m_pDIBSource->GetWidth() * m_pDIBSource->GetHeight();
@@ -652,9 +652,9 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
&m_ImageMatrix, m_Flags, m_DeviceHandle, 0, NULL, m_BlendType)) {
if (m_DeviceHandle != NULL) {
m_Status = 3;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOutterRect();
@@ -663,15 +663,15 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
(FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0) ) {
if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return FALSE;
+ m_Result = false;
+ return false;
}
FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox();
clip_box.Intersect(image_rect);
m_Status = 2;
m_pTransformer = new CFX_ImageTransformer;
m_pTransformer->Start(m_pDIBSource, &m_ImageMatrix, m_Flags, &clip_box);
- return TRUE;
+ return true;
}
if (m_ImageMatrix.a < 0) {
dest_width = -dest_width;
@@ -685,7 +685,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) {
if (m_pRenderStatus->m_pDevice->StretchDIBits(m_pDIBSource, dest_left, dest_top,
dest_width, dest_height, m_Flags, NULL, m_BlendType)) {
- return FALSE;
+ return false;
}
}
if (m_pDIBSource->IsAlphaMask()) {
@@ -693,12 +693,12 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
}
if (m_pRenderStatus->m_pDevice->StretchBitMask(m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_FillArgb, m_Flags)) {
- return FALSE;
+ return false;
}
}
if (m_pRenderStatus->m_bPrint && !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = FALSE;
- return TRUE;
+ m_Result = false;
+ return true;
}
FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox();
FX_RECT dest_rect = clip_box;
@@ -708,13 +708,13 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
CFX_DIBitmap* pStretched = m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip);
if (pStretched) {
m_pRenderStatus->CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, m_FillArgb,
- m_BitmapAlpha, m_BlendType, FALSE);
+ m_BitmapAlpha, m_BlendType, false);
delete pStretched;
pStretched = NULL;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
+bool CPDF_ImageRenderer::StartBitmapAlpha()
{
if (m_pDIBSource->IsOpaqueImage()) {
CFX_PathData path;
@@ -728,7 +728,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
int left, top;
CFX_DIBitmap* pTransformed = pAlphaMask->TransformTo(&m_ImageMatrix, left, top);
if (pTransformed == NULL) {
- return TRUE;
+ return true;
}
m_pRenderStatus->m_pDevice->SetBitMask(pTransformed, left, top, ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
delete pTransformed;
@@ -746,13 +746,13 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
delete pAlphaMask;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
+bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
{
if (m_Status == 1) {
if (m_pQuickStretcher->Continue(pPause)) {
- return TRUE;
+ return true;
}
if (m_pQuickStretcher->m_pBitmap->IsAlphaMask())
m_pRenderStatus->m_pDevice->SetBitMask(m_pQuickStretcher->m_pBitmap, m_pQuickStretcher->m_ResultLeft,
@@ -760,15 +760,15 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
else
m_pRenderStatus->m_pDevice->SetDIBits(m_pQuickStretcher->m_pBitmap, m_pQuickStretcher->m_ResultLeft,
m_pQuickStretcher->m_ResultTop, m_BlendType);
- return FALSE;
+ return false;
}
if (m_Status == 2) {
if (m_pTransformer->Continue(pPause)) {
- return TRUE;
+ return true;
}
CFX_DIBitmap* pBitmap = m_pTransformer->m_Storer.Detach();
if (pBitmap == NULL) {
- return FALSE;
+ return false;
}
if (pBitmap->IsAlphaMask()) {
if (m_BitmapAlpha != 255) {
@@ -784,20 +784,20 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
m_pTransformer->m_ResultLeft, m_pTransformer->m_ResultTop, m_BlendType);
}
delete pBitmap;
- return FALSE;
+ return false;
}
if (m_Status == 3) {
return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
}
if (m_Status == 4) {
if (m_Loader.Continue(m_LoadHandle, pPause)) {
- return TRUE;
+ return true;
}
if (StartRenderDIBSource()) {
return Continue(pPause);
}
}
- return FALSE;
+ return false;
}
CPDF_QuickStretcher::CPDF_QuickStretcher()
{
@@ -815,10 +815,10 @@ CPDF_QuickStretcher::~CPDF_QuickStretcher()
}
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, const CPDF_Dictionary* pParams);
-FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox)
+bool CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox)
{
if (FXSYS_fabs(pImage2Device->a) < FXSYS_fabs(pImage2Device->b) * 10 && FXSYS_fabs(pImage2Device->d) < FXSYS_fabs(pImage2Device->c) * 10) {
- return FALSE;
+ return false;
}
CFX_FloatRect image_rect_f = pImage2Device->GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOutterRect();
@@ -829,7 +829,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix
FX_RECT result_rect = *pClipBox;
result_rect.Intersect(image_rect);
if (result_rect.IsEmpty()) {
- return FALSE;
+ return false;
}
m_ResultWidth = result_rect.Width();
m_ResultHeight = result_rect.Height();
@@ -839,10 +839,10 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix
m_ClipTop = result_rect.top - image_rect.top;
CPDF_Dictionary* pDict = pImageObj->m_pImage->GetDict();
if (pDict->GetInteger(FX_BSTRC("BitsPerComponent")) != 8) {
- return FALSE;
+ return false;
}
if (pDict->KeyExist(FX_BSTRC("SMask")) || pDict->KeyExist(FX_BSTRC("Mask"))) {
- return FALSE;
+ return false;
}
m_SrcWidth = pDict->GetInteger(FX_BSTRC("Width"));
m_SrcHeight = pDict->GetInteger(FX_BSTRC("Height"));
@@ -850,14 +850,14 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix
m_Bpp = 3;
CPDF_Object* pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj == NULL) {
- return FALSE;
+ return false;
}
m_pCS = CPDF_ColorSpace::Load(pImageObj->m_pImage->GetDocument(), pCSObj);
if (m_pCS == NULL) {
- return FALSE;
+ return false;
}
if (!_IsSupported(m_pCS)) {
- return FALSE;
+ return false;
}
m_Bpp = m_pCS->CountComponents();
if (m_pCS->sRGB()) {
@@ -865,7 +865,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix
m_pCS = NULL;
}
CPDF_Stream* pStream = pImageObj->m_pImage->GetStream();
- m_StreamAcc.LoadAllData(pStream, FALSE, m_SrcWidth * m_SrcHeight * m_Bpp, TRUE);
+ m_StreamAcc.LoadAllData(pStream, false, m_SrcWidth * m_SrcHeight * m_Bpp, true);
m_pDecoder = NULL;
if (!m_StreamAcc.GetImageDecoder().IsEmpty()) {
if (m_StreamAcc.GetImageDecoder() == FX_BSTRC("DCTDecode")) {
@@ -878,7 +878,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix
m_StreamAcc.GetData(), m_StreamAcc.GetSize(), m_SrcWidth, m_SrcHeight, m_Bpp, 8,
m_StreamAcc.GetImageParam());
} else {
- return FALSE;
+ return false;
}
m_pDecoder->DownScale(m_DestWidth, m_DestHeight);
}
@@ -889,9 +889,9 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix
m_pBitmap->Create(m_ResultWidth, m_ResultHeight, FXDIB_Rgb);
#endif
m_LineIndex = 0;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause)
+bool CPDF_QuickStretcher::Continue(IFX_Pause* pPause)
{
uint8_t* result_buf = m_pBitmap->GetBuffer();
int src_width = m_pDecoder ? m_pDecoder->GetWidth() : m_SrcWidth;
@@ -945,10 +945,10 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause)
}
m_LineIndex ++;
if (pPause && pPause->NeedToPauseNow()) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect, const CFX_AffineMatrix* pMatrix)
@@ -959,7 +959,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
CFX_DIBitmap* pMask = NULL;
int width = pClipRect->right - pClipRect->left;
int height = pClipRect->bottom - pClipRect->top;
- FX_BOOL bLuminosity = FALSE;
+ bool bLuminosity = false;
bLuminosity = pSMaskDict->GetConstString(FX_BSTRC("S")) != FX_BSTRC("Alpha");
CPDF_Stream* pGroup = pSMaskDict->GetStream(FX_BSTRC("G"));
if (pGroup == NULL) {
@@ -1032,7 +1032,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA;
CPDF_RenderStatus status;
status.Initialize(m_pContext, &bitmap_device, NULL, NULL, NULL, NULL,
- &options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, pCS ? pCS->GetFamily() : 0, bLuminosity);
+ &options, 0, m_bDropObjects, pFormResource, true, NULL, 0, pCS ? pCS->GetFamily() : 0, bLuminosity);
status.RenderObjectList(&form, &matrix);
pMask = new CFX_DIBitmap;
if (!pMask->Create(width, height, FXDIB_8bppMask)) {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 7d17e78e24..0861048eb7 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -105,7 +105,7 @@ class JpxBitMapContext
} // namespace
-CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, FX_DWORD* pMatteColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) const
+CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, FX_DWORD* pMatteColor, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask) const
{
CPDF_DIBSource* pSource = new CPDF_DIBSource;
if (pSource->Load(m_pDocument, m_pStream, (CPDF_DIBSource**)ppMask, pMatteColor, NULL, NULL, bStdCS, GroupFamily, bLoadMask)) {
@@ -126,36 +126,36 @@ CFX_DIBSource* CPDF_Image::DetachMask()
m_pMask = NULL;
return pBitmap;
}
-FX_BOOL CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask)
+bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask)
{
m_pDIBSource = new CPDF_DIBSource;
- int ret = ((CPDF_DIBSource*)m_pDIBSource)->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask);
+ int ret = ((CPDF_DIBSource*)m_pDIBSource)->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask);
if (ret == 2) {
- return TRUE;
+ return true;
}
if (!ret) {
delete m_pDIBSource;
m_pDIBSource = NULL;
- return FALSE;
+ return false;
}
m_pMask = ((CPDF_DIBSource*)m_pDIBSource)->DetachMask();
m_MatteColor = ((CPDF_DIBSource*)m_pDIBSource)->m_MatteColor;
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_Image::Continue(IFX_Pause* pPause)
+bool CPDF_Image::Continue(IFX_Pause* pPause)
{
int ret = ((CPDF_DIBSource*)m_pDIBSource)->ContinueLoadDIBSource(pPause);
if (ret == 2) {
- return TRUE;
+ return true;
}
if (!ret) {
delete m_pDIBSource;
m_pDIBSource = NULL;
- return FALSE;
+ return false;
}
m_pMask = ((CPDF_DIBSource*)m_pDIBSource)->DetachMask();
m_MatteColor = ((CPDF_DIBSource*)m_pDIBSource)->m_MatteColor;
- return FALSE;
+ return false;
}
CPDF_DIBSource::CPDF_DIBSource()
{
@@ -165,26 +165,26 @@ CPDF_DIBSource::CPDF_DIBSource()
m_bpp = 0;
m_Width = m_Height = 0;
m_pColorSpace = NULL;
- m_bDefaultDecode = TRUE;
- m_bImageMask = FALSE;
- m_bDoBpcCheck = TRUE;
+ m_bDefaultDecode = true;
+ m_bImageMask = false;
+ m_bDoBpcCheck = true;
m_pPalette = NULL;
m_pCompData = NULL;
- m_bColorKey = FALSE;
+ m_bColorKey = false;
m_pMaskedLine = m_pLineBuf = NULL;
m_pDecoder = NULL;
m_nComponents = 0;
m_bpc = 0;
- m_bLoadMask = FALSE;
+ m_bLoadMask = false;
m_Family = 0;
m_pMask = NULL;
m_MatteColor = 0;
m_pJbig2Context = NULL;
m_pGlobalStream = NULL;
- m_bStdCS = FALSE;
+ m_bStdCS = false;
m_pMaskStream = NULL;
m_Status = 0;
- m_bHasMask = FALSE;
+ m_bHasMask = false;
}
CPDF_DIBSource::~CPDF_DIBSource()
{
@@ -220,43 +220,43 @@ void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const
delete pBitmap;
}
}
-FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CPDF_DIBSource** ppMask,
- FX_DWORD* pMatteColor, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask)
+bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CPDF_DIBSource** ppMask,
+ FX_DWORD* pMatteColor, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask)
{
if (pStream == NULL) {
- return FALSE;
+ return false;
}
m_pDocument = pDoc;
m_pDict = pStream->GetDict();
if (m_pDict == NULL) {
- return FALSE;
+ return false;
}
m_pStream = pStream;
m_Width = m_pDict->GetInteger(FX_BSTRC("Width"));
m_Height = m_pDict->GetInteger(FX_BSTRC("Height"));
if (m_Width <= 0 || m_Height <= 0 || m_Width > 0x01ffff || m_Height > 0x01ffff) {
- return FALSE;
+ return false;
}
m_GroupFamily = GroupFamily;
m_bLoadMask = bLoadMask;
if (!LoadColorInfo(m_pStream->GetObjNum() != 0 ? NULL : pFormResources, pPageResources)) {
- return FALSE;
+ return false;
}
if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) {
- return FALSE;
+ return false;
}
FX_SAFE_DWORD src_pitch =
CalculatePitch8(m_bpc, m_nComponents, m_Width, m_Height);
if (!src_pitch.IsValid()) {
- return FALSE;
+ return false;
}
m_pStreamAcc = new CPDF_StreamAcc;
- m_pStreamAcc->LoadAllData(pStream, FALSE, src_pitch.ValueOrDie(), TRUE);
+ m_pStreamAcc->LoadAllData(pStream, false, src_pitch.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) {
- return FALSE;
+ return false;
}
if (!CreateDecoder()) {
- return FALSE;
+ return false;
}
if (m_bImageMask) {
m_bpp = 1;
@@ -272,11 +272,11 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP
}
FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width);
if (!pitch.IsValid()) {
- return FALSE;
+ return false;
}
m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie());
if (m_pColorSpace && bStdCS) {
- m_pColorSpace->EnableStdConversion(TRUE);
+ m_pColorSpace->EnableStdConversion(true);
}
LoadPalette();
if (m_bColorKey) {
@@ -284,7 +284,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP
m_AlphaFlag = 2;
pitch = CalculatePitch32(m_bpp, m_Width);
if (!pitch.IsValid()) {
- return FALSE;
+ return false;
}
m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie());
}
@@ -293,9 +293,9 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP
*ppMask = LoadMask(*pMatteColor);
}
if (m_pColorSpace && bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
- return TRUE;
+ return true;
}
int CPDF_DIBSource::ContinueToLoadMask()
{
@@ -320,7 +320,7 @@ int CPDF_DIBSource::ContinueToLoadMask()
}
m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie());
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(TRUE);
+ m_pColorSpace->EnableStdConversion(true);
}
LoadPalette();
if (m_bColorKey) {
@@ -335,9 +335,9 @@ int CPDF_DIBSource::ContinueToLoadMask()
m_Pitch = pitch.ValueOrDie();
return 1;
}
-int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, FX_BOOL bHasMask,
+int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, bool bHasMask,
CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask)
+ bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask)
{
if (pStream == NULL) {
return 0;
@@ -366,7 +366,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* p
return 0;
}
m_pStreamAcc = new CPDF_StreamAcc;
- m_pStreamAcc->LoadAllData(pStream, FALSE, src_pitch.ValueOrDie(), TRUE);
+ m_pStreamAcc->LoadAllData(pStream, false, src_pitch.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) {
return 0;
}
@@ -393,7 +393,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* p
return ret;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
return ret;
}
@@ -412,7 +412,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause)
CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStream(FX_BSTRC("JBIG2Globals"));
if (pGlobals) {
m_pGlobalStream = new CPDF_StreamAcc;
- m_pGlobalStream->LoadAllData(pGlobals, FALSE);
+ m_pGlobalStream->LoadAllData(pGlobals, false);
}
}
ret = pJbig2Module->StartDecode(m_pJbig2Context, m_Width, m_Height, m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(),
@@ -438,7 +438,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause)
return ret1;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
return ret1;
}
@@ -463,7 +463,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause)
return ret1;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
return ret1;
}
@@ -472,11 +472,11 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause)
}
return 0;
}
-FX_BOOL CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources)
+bool CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources)
{
m_bpc_orig = m_pDict->GetInteger(FX_BSTRC("BitsPerComponent"));
if (m_pDict->GetInteger("ImageMask")) {
- m_bImageMask = TRUE;
+ m_bImageMask = true;
}
if (m_bImageMask || !m_pDict->KeyExist(FX_BSTRC("ColorSpace"))) {
if (!m_bImageMask) {
@@ -486,27 +486,27 @@ FX_BOOL CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dict
if (pFilter->GetType() == PDFOBJ_NAME) {
filter = pFilter->GetString();
if (filter == FX_BSTRC("JPXDecode")) {
- m_bDoBpcCheck = FALSE;
- return TRUE;
+ m_bDoBpcCheck = false;
+ return true;
}
} else if (pFilter->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = (CPDF_Array*)pFilter;
if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("JPXDecode")) {
- m_bDoBpcCheck = FALSE;
- return TRUE;
+ m_bDoBpcCheck = false;
+ return true;
}
}
}
}
- m_bImageMask = TRUE;
+ m_bImageMask = true;
m_bpc = m_nComponents = 1;
CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode"));
m_bDefaultDecode = pDecode == NULL || pDecode->GetInteger(0) == 0;
- return TRUE;
+ return true;
}
CPDF_Object* pCSObj = m_pDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj == NULL) {
- return FALSE;
+ return false;
}
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
if (pFormResources) {
@@ -516,7 +516,7 @@ FX_BOOL CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dict
m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources);
}
if (m_pColorSpace == NULL) {
- return FALSE;
+ return false;
}
m_Family = m_pColorSpace->GetFamily();
m_nComponents = m_pColorSpace->CountComponents();
@@ -533,11 +533,11 @@ FX_BOOL CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dict
ValidateDictParam();
m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
if (m_pCompData == NULL) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX_BOOL& bColorKey)
+DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode, bool& bColorKey)
{
if (m_pColorSpace == NULL) {
return NULL;
@@ -556,7 +556,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX
def_max = (FX_FLOAT)max_data;
}
if (def_min != pCompData[i].m_DecodeMin || def_max != max) {
- bDefaultDecode = FALSE;
+ bDefaultDecode = false;
}
}
} else {
@@ -584,7 +584,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX
pCompData[i].m_ColorKeyMax = FX_MIN(max_num, max_data);
}
}
- bColorKey = TRUE;
+ bColorKey = true;
}
}
return pCompData;
@@ -612,7 +612,7 @@ int CPDF_DIBSource::CreateDecoder()
src_data, src_size, m_Width, m_Height, m_nComponents,
pParams ? pParams->GetInteger("ColorTransform", 1) : 1);
if (!m_pDecoder) {
- FX_BOOL bTransform = FALSE;
+ bool bTransform = false;
int comps, bpc;
ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule();
if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps, bpc, bTransform)) {
@@ -693,29 +693,29 @@ void CPDF_DIBSource::LoadJpxBitmap()
return;
int output_nComps;
- FX_BOOL bTranslateColor;
- FX_BOOL bSwapRGB = FALSE;
+ bool bTranslateColor;
+ bool bSwapRGB = false;
if (m_pColorSpace) {
if (codestream_nComps != (FX_DWORD)m_pColorSpace->CountComponents())
return;
output_nComps = codestream_nComps;
- bTranslateColor = FALSE;
+ bTranslateColor = false;
if (m_pColorSpace == CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB)) {
- bSwapRGB = TRUE;
+ bSwapRGB = true;
m_pColorSpace = nullptr;
}
} else {
- bTranslateColor = TRUE;
+ bTranslateColor = true;
if (image_nComps) {
output_nComps = image_nComps;
} else {
output_nComps = codestream_nComps;
}
if (output_nComps == 3) {
- bSwapRGB = TRUE;
+ bSwapRGB = true;
} else if (output_nComps == 4) {
m_pColorSpace = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK);
- bTranslateColor = FALSE;
+ bTranslateColor = false;
}
m_nComponents = output_nComps;
}
@@ -829,7 +829,7 @@ int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause)
return ret;
}
if (m_pColorSpace && m_bStdCS) {
- m_pColorSpace->EnableStdConversion(FALSE);
+ m_pColorSpace->EnableStdConversion(false);
}
if (!ret) {
delete m_pMask;
@@ -847,7 +847,7 @@ CPDF_DIBSource* CPDF_DIBSource::DetachMask()
CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask)
{
CPDF_DIBSource* pMaskSource = new CPDF_DIBSource;
- if (!pMaskSource->Load(m_pDocument, pMask, NULL, NULL, NULL, NULL, TRUE)) {
+ if (!pMaskSource->Load(m_pDocument, pMask, NULL, NULL, NULL, NULL, true)) {
delete pMaskSource;
return NULL;
}
@@ -856,7 +856,7 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask)
int CPDF_DIBSource::StartLoadMaskDIB()
{
m_pMask = new CPDF_DIBSource;
- int ret = m_pMask->StartLoadDIBSource(m_pDocument, (CPDF_Stream*)m_pMaskStream, FALSE, NULL, NULL, TRUE);
+ int ret = m_pMask->StartLoadDIBSource(m_pDocument, (CPDF_Stream*)m_pMaskStream, false, NULL, NULL, true);
if (ret == 2) {
if (m_Status == 0) {
m_Status = 2;
@@ -1209,15 +1209,15 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const
}
return pSrcLine;
}
-FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const
+bool CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const
{
if (m_pDecoder) {
return m_pDecoder->SkipToScanline(line, pPause);
}
- return FALSE;
+ return false;
}
void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp,
- int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const
+ int dest_width, bool bFlipX, int clip_left, int clip_width) const
{
if (line < 0 || dest_scan == NULL || dest_bpp <= 0 ||
dest_width <= 0 || clip_left < 0 || clip_width <= 0) {
@@ -1480,26 +1480,26 @@ CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle()
CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle()
{
}
-FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight)
+bool CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight)
{
m_pImageLoader = pImageLoader;
m_pCache = pCache;
m_pImage = (CPDF_ImageObject*)pImage;
m_nDownsampleWidth = nDownsampleWidth;
m_nDownsampleHeight = nDownsampleHeight;
- FX_BOOL ret;
+ bool ret;
if (pCache) {
ret = pCache->StartGetCachedBitmap(pImage->m_pImage->GetStream(), bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight);
- if (ret == FALSE) {
- m_pImageLoader->m_bCached = TRUE;
+ if (ret == false) {
+ m_pImageLoader->m_bCached = true;
m_pImageLoader->m_pBitmap = pCache->m_pCurImageCache->DetachBitmap();
m_pImageLoader->m_pMask = pCache->m_pCurImageCache->DetachMask();
m_pImageLoader->m_MatteColor = pCache->m_pCurImageCache->m_MatteColor;
}
} else {
ret = pImage->m_pImage->StartLoadDIBSource(pRenderStatus->m_pFormResource, pRenderStatus->m_pPageResource, bStdCS, GroupFamily, bLoadMask);
- if (ret == FALSE) {
- m_pImageLoader->m_bCached = FALSE;
+ if (ret == false) {
+ m_pImageLoader->m_bCached = false;
m_pImageLoader->m_pBitmap = m_pImage->m_pImage->DetachBitmap();
m_pImageLoader->m_pMask = m_pImage->m_pImage->DetachMask();
m_pImageLoader->m_MatteColor = m_pImage->m_pImage->m_MatteColor;
@@ -1507,21 +1507,21 @@ FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
}
return ret;
}
-FX_BOOL CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause)
+bool CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause)
{
- FX_BOOL ret;
+ bool ret;
if (m_pCache) {
ret = m_pCache->Continue(pPause);
- if (ret == FALSE) {
- m_pImageLoader->m_bCached = TRUE;
+ if (ret == false) {
+ m_pImageLoader->m_bCached = true;
m_pImageLoader->m_pBitmap = m_pCache->m_pCurImageCache->DetachBitmap();
m_pImageLoader->m_pMask = m_pCache->m_pCurImageCache->DetachMask();
m_pImageLoader->m_MatteColor = m_pCache->m_pCurImageCache->m_MatteColor;
}
} else {
ret = m_pImage->m_pImage->Continue(pPause);
- if (ret == FALSE) {
- m_pImageLoader->m_bCached = FALSE;
+ if (ret == false) {
+ m_pImageLoader->m_bCached = false;
m_pImageLoader->m_pBitmap = m_pImage->m_pImage->DetachBitmap();
m_pImageLoader->m_pMask = m_pImage->m_pImage->DetachMask();
m_pImageLoader->m_MatteColor = m_pImage->m_pImage->m_MatteColor;
@@ -1529,30 +1529,30 @@ FX_BOOL CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause)
}
return ret;
}
-FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus)
+bool CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus)
{
if (pImage == NULL) {
- return FALSE;
+ return false;
}
if (pCache) {
pCache->GetCachedBitmap(pImage->m_pImage->GetStream(), m_pBitmap, m_pMask, m_MatteColor, bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight);
- m_bCached = TRUE;
+ m_bCached = true;
} else {
m_pBitmap = pImage->m_pImage->LoadDIBSource(&m_pMask, &m_MatteColor, bStdCS, GroupFamily, bLoadMask);
- m_bCached = FALSE;
+ m_bCached = false;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight)
+bool CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight)
{
m_nDownsampleWidth = nDownsampleWidth;
m_nDownsampleHeight = nDownsampleHeight;
CPDF_ProgressiveImageLoaderHandle* pLoaderHandle = new CPDF_ProgressiveImageLoaderHandle;
- FX_BOOL ret = pLoaderHandle->Start(this, pImage, pCache, bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight);
+ bool ret = pLoaderHandle->Start(this, pImage, pCache, bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight);
LoadHandle = pLoaderHandle;
return ret;
}
-FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause)
+bool CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause)
{
return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 3ee2222d8b..e08649062c 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -29,7 +29,7 @@ static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2B
t_min = pArray->GetNumber(0);
t_max = pArray->GetNumber(1);
}
- FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE;
+ bool bStartExtend = false, bEndExtend = false;
pArray = pDict->GetArray(FX_BSTRC("Extend"));
if (pArray) {
bStartExtend = pArray->GetInteger(0);
@@ -116,7 +116,7 @@ static void _DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2
t_min = pArray->GetNumber(0);
t_max = pArray->GetNumber(1);
}
- FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE;
+ bool bStartExtend = false, bEndExtend = false;
pArray = pDict->GetArray(FX_BSTRC("Extend"));
if (pArray) {
bStartExtend = pArray->GetInteger(0);
@@ -155,11 +155,11 @@ static void _DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
int pitch = pBitmap->GetPitch();
- FX_BOOL bDecreasing = FALSE;
+ bool bDecreasing = false;
if (start_r > end_r) {
int length = (int)FXSYS_sqrt((FXSYS_Mul(start_x - end_x, start_x - end_x) + FXSYS_Mul(start_y - end_y, start_y - end_y)));
if (length < start_r - end_r) {
- bDecreasing = TRUE;
+ bDecreasing = true;
}
}
for (int row = 0; row < height; row ++) {
@@ -281,22 +281,22 @@ static void _DrawFuncShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bi
}
}
}
-FX_BOOL _GetScanlineIntersect(int y, FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_FLOAT& x)
+bool _GetScanlineIntersect(int y, FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_FLOAT& x)
{
if (y1 == y2) {
- return FALSE;
+ return false;
}
if (y1 < y2) {
if (y < y1 || y > y2) {
- return FALSE;
+ return false;
}
} else {
if (y < y2 || y > y1) {
- return FALSE;
+ return false;
}
}
x = x1 + FXSYS_MulDiv(x2 - x1, y - y1, y2 - y1);
- return TRUE;
+ return true;
}
static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex triangle[3])
{
@@ -325,7 +325,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian
for (int i = 0; i < 3; i ++) {
CPDF_MeshVertex& vertex1 = triangle[i];
CPDF_MeshVertex& vertex2 = triangle[(i + 1) % 3];
- FX_BOOL bIntersect = _GetScanlineIntersect(y, vertex1.x, vertex1.y,
+ bool bIntersect = _GetScanlineIntersect(y, vertex1.x, vertex1.y,
vertex2.x, vertex2.y, inter_x[nIntersects]);
if (!bIntersect) {
continue;
@@ -601,7 +601,7 @@ struct CPDF_PatchDrawer {
int alpha;
void Draw(int x_scale, int y_scale, int left, int bottom, Coon_Bezier C1, Coon_Bezier C2, Coon_Bezier D1, Coon_Bezier D2)
{
- FX_BOOL bSmall = C1.Distance() < 2 && C2.Distance() < 2 && D1.Distance() < 2 && D2.Distance() < 2;
+ bool bSmall = C1.Distance() < 2 && C2.Distance() < 2 && D1.Distance() < 2 && D2.Distance() < 2;
Coon_Color div_colors[4];
int d_bottom, d_left, d_top, d_right;
div_colors[0].BiInterpol(patch_colors, left, bottom, x_scale, y_scale);
@@ -663,9 +663,9 @@ struct CPDF_PatchDrawer {
}
};
-FX_BOOL _CheckCoonTensorPara(const CPDF_MeshStream &stream)
+bool _CheckCoonTensorPara(const CPDF_MeshStream &stream)
{
- FX_BOOL bCoorBits = ( stream.m_nCoordBits== 1 ||
+ bool bCoorBits = ( stream.m_nCoordBits== 1 ||
stream.m_nCoordBits == 2 ||
stream.m_nCoordBits == 4 ||
stream.m_nCoordBits == 8 ||
@@ -674,21 +674,21 @@ FX_BOOL _CheckCoonTensorPara(const CPDF_MeshStream &stream)
stream.m_nCoordBits == 24 ||
stream.m_nCoordBits == 32 );
- FX_BOOL bCompBits = ( stream.m_nCompBits == 1 ||
+ bool bCompBits = ( stream.m_nCompBits == 1 ||
stream.m_nCompBits == 2 ||
stream.m_nCompBits == 4 ||
stream.m_nCompBits == 8 ||
stream.m_nCompBits == 12 ||
stream.m_nCompBits == 16 );
- FX_BOOL bFlagBits = ( stream.m_nFlagBits == 2 ||
+ bool bFlagBits = ( stream.m_nFlagBits == 2 ||
stream.m_nFlagBits == 4 ||
stream.m_nFlagBits == 8 );
return bCoorBits && bCompBits && bFlagBits;
}
-static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bitmap,
+static void _DrawCoonPatchMeshes(bool bTensor, CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bitmap,
CPDF_Stream* pShadingStream, CPDF_Function** pFuncs, int nFuncs,
CPDF_ColorSpace* pCS, int fill_mode, int alpha)
{
@@ -768,7 +768,7 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff
}
}
void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMatrix* pMatrix,
- FX_RECT& clip_rect, int alpha, FX_BOOL bAlphaMode)
+ FX_RECT& clip_rect, int alpha, bool bAlphaMode)
{
CPDF_Function** pFuncs = pPattern->m_pFunctions;
int nFuncs = pPattern->m_nFuncs;
@@ -840,7 +840,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMat
}
buffer.OutputToDevice();
}
-void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke)
+void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, bool bStroke)
{
if (!pattern->Load()) {
return;
@@ -858,7 +858,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, CPDF_Pa
return;
}
FX_RECT rect;
- if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) {
+ if (GetObjectClippedRect(pPageObj, pObj2Device, false, rect)) {
m_pDevice->RestoreState();
return;
}
@@ -869,19 +869,19 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, CPDF_Pa
DrawShading(pattern, &matrix, rect, alpha, m_Options.m_ColorMode == RENDER_COLOR_ALPHA);
m_pDevice->RestoreState();
}
-FX_BOOL CPDF_RenderStatus::ProcessShading(CPDF_ShadingObject* pShadingObj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::ProcessShading(CPDF_ShadingObject* pShadingObj, const CFX_AffineMatrix* pObj2Device)
{
FX_RECT rect = pShadingObj->GetBBox(pObj2Device);
FX_RECT clip_box = m_pDevice->GetClipBox();
rect.Intersect(clip_box);
if (rect.IsEmpty()) {
- return TRUE;
+ return true;
}
CFX_AffineMatrix matrix = pShadingObj->m_Matrix;
matrix.Concat(*pObj2Device);
- DrawShading(pShadingObj->m_pShading, &matrix, rect, pShadingObj->m_GeneralState.GetAlpha(FALSE),
+ DrawShading(pShadingObj->m_pShading, &matrix, rect, pShadingObj->m_GeneralState.GetAlpha(false),
m_Options.m_ColorMode == RENDER_COLOR_ALPHA);
- return TRUE;
+ return true;
}
static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, CPDF_PageRenderCache* pCache,
CPDF_TilingPattern* pPattern, const CFX_AffineMatrix* pObject2Device,
@@ -914,7 +914,7 @@ static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, CPDF_PageRenderCache
context.DrawObjectList(&bitmap_device, pPattern->m_pForm, &mtPattern2Bitmap, &options);
return pBitmap;
}
-void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke)
+void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, bool bStroke)
{
if (!pPattern->Load()) {
return;
@@ -944,11 +944,11 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag
CFX_AffineMatrix mtPattern2Device = pPattern->m_Pattern2Form;
mtPattern2Device.Concat(*pObj2Device);
GetScaledMatrix(mtPattern2Device);
- FX_BOOL bAligned = FALSE;
+ bool bAligned = false;
if (pPattern->m_BBox.left == 0 && pPattern->m_BBox.bottom == 0 &&
pPattern->m_BBox.right == pPattern->m_XStep && pPattern->m_BBox.top == pPattern->m_YStep &&
(mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) {
- bAligned = TRUE;
+ bAligned = true;
}
CFX_FloatRect cell_bbox = pPattern->m_BBox;
mtPattern2Device.TransformRect(cell_bbox);
@@ -1075,11 +1075,11 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag
}
}
}
- CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255, FXDIB_BLEND_NORMAL, FALSE);
+ CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255, FXDIB_BLEND_NORMAL, false);
m_pDevice->RestoreState();
delete pPatternBitmap;
}
-void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, CPDF_Color* pColor, FX_BOOL bStroke)
+void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, CPDF_Color* pColor, bool bStroke)
{
CPDF_Pattern* pattern = pColor->GetPattern();
if (pattern == NULL) {
@@ -1091,20 +1091,20 @@ void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX
DrawShadingPattern((CPDF_ShadingPattern*)pattern, pPathObj, pObj2Device, bStroke);
}
}
-void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, int& filltype, FX_BOOL& bStroke)
+void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, int& filltype, bool& bStroke)
{
if(filltype) {
CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor();
if(FillColor.m_pCS && FillColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
- DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE);
+ DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, false);
filltype = 0;
}
}
if(bStroke) {
CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
if(StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
- DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
- bStroke = FALSE;
+ DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, true);
+ bStroke = false;
}
}
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index ad5dc58a1c..26138a9fbf 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -9,7 +9,7 @@
#include "../../../include/fpdfapi/fpdf_pageobj.h"
#include "../fpdf_page/pageint.h"
#include "render_int.h"
-extern FX_BOOL IsAvailableMatrix(const CFX_AffineMatrix& matrix);
+extern bool IsAvailableMatrix(const CFX_AffineMatrix& matrix);
CPDF_Type3Cache::~CPDF_Type3Cache()
{
FX_POSITION pos = m_SizeMap.GetStartPosition();
@@ -76,28 +76,28 @@ void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, FX_FLOAT bottom, int& top_line,
top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue);
bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue);
}
-static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width)
+static bool _IsScanLine1bpp(uint8_t* pBuf, int width)
{
int size = width / 8;
for (int i = 0; i < size; i ++)
if (pBuf[i]) {
- return TRUE;
+ return true;
}
if (width % 8)
if (pBuf[width / 8] & (0xff << (8 - width % 8))) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width)
+static bool _IsScanLine8bpp(uint8_t* pBuf, int width)
{
for (int i = 0; i < width; i ++)
if (pBuf[i] > 0x40) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst)
+static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, bool bFirst)
{
int height = pBitmap->GetHeight(), pitch = pBitmap->GetPitch(), width = pBitmap->GetWidth();
int bpp = pBitmap->GetBPP();
@@ -137,12 +137,12 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, FX_DWORD
int left, top;
if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) {
int top_line, bottom_line;
- top_line = _DetectFirstLastScan(pBitmap, TRUE);
- bottom_line = _DetectFirstLastScan(pBitmap, FALSE);
+ top_line = _DetectFirstLastScan(pBitmap, true);
+ bottom_line = _DetectFirstLastScan(pBitmap, false);
if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) {
FX_FLOAT top_y = image_matrix.d + image_matrix.f;
FX_FLOAT bottom_y = image_matrix.f;
- FX_BOOL bFlipped = top_y > bottom_y;
+ bool bFlipped = top_y > bottom_y;
if (bFlipped) {
FX_FLOAT temp = top_y;
top_y = bottom_y;
@@ -185,76 +185,76 @@ void _CPDF_UniqueKeyGen::Generate(int count, ...)
va_end(argList);
m_KeyLen = count * sizeof(FX_DWORD);
}
-FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath)
+bool CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath)
{
if(textobj->m_nChars == 0) {
- return TRUE;
+ return true;
}
int text_render_mode = textobj->m_TextState.GetObject()->m_TextMode;
if (text_render_mode == 3) {
- return TRUE;
+ return true;
}
CPDF_Font* pFont = textobj->m_TextState.GetFont();
if (pFont->GetFontType() == PDFFONT_TYPE3) {
return ProcessType3Text(textobj, pObj2Device);
}
- FX_BOOL bFill = FALSE, bStroke = FALSE, bClip = FALSE;
+ bool bFill = false, bStroke = false, bClip = false;
if (pClippingPath) {
- bClip = TRUE;
+ bClip = true;
} else {
switch (text_render_mode) {
case 0:
case 4:
- bFill = TRUE;
+ bFill = true;
break;
case 1:
case 5:
if (pFont->GetFace() == NULL && !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
- bFill = TRUE;
+ bFill = true;
} else {
- bStroke = TRUE;
+ bStroke = true;
}
break;
case 2:
case 6:
if (pFont->GetFace() == NULL && !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
- bFill = TRUE;
+ bFill = true;
} else {
- bFill = bStroke = TRUE;
+ bFill = bStroke = true;
}
break;
case 3:
case 7:
- return TRUE;
+ return true;
default:
- bFill = TRUE;
+ bFill = true;
}
}
FX_ARGB stroke_argb = 0, fill_argb = 0;
- FX_BOOL bPattern = FALSE;
+ bool bPattern = false;
if (bStroke) {
if (textobj->m_ColorState.GetStrokeColor()->IsPattern()) {
- bPattern = TRUE;
+ bPattern = true;
} else {
stroke_argb = GetStrokeArgb(textobj);
}
}
if (bFill) {
if (textobj->m_ColorState.GetFillColor()->IsPattern()) {
- bPattern = TRUE;
+ bPattern = true;
} else {
fill_argb = GetFillArgb(textobj);
}
}
CFX_AffineMatrix text_matrix;
textobj->GetTextMatrix(&text_matrix);
- if(IsAvailableMatrix(text_matrix) == FALSE) {
- return TRUE;
+ if(IsAvailableMatrix(text_matrix) == false) {
+ return true;
}
FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
if (bPattern) {
DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_matrix, bFill, bStroke);
- return TRUE;
+ return true;
}
if (bClip || bStroke) {
const CFX_AffineMatrix* pDeviceMatrix = pObj2Device;
@@ -293,7 +293,7 @@ CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont)
if (pFont->m_pDocument == NULL) {
return NULL;
}
- pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE);
+ pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), false);
return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont);
}
static void ReleaseCachedType3(CPDF_Type3Font* pFont)
@@ -304,10 +304,10 @@ static void ReleaseCachedType3(CPDF_Type3Font* pFont)
pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont);
pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict());
}
-FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext)
+bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext)
{
if (m_pBitmap != NULL || m_pForm == NULL) {
- return TRUE;
+ return true;
}
if (m_pForm->CountObjects() == 1 && !m_bColored) {
CPDF_PageObject *pPageObj = m_pForm->GetObjectAt(m_pForm->GetFirstObjectPosition());
@@ -321,10 +321,10 @@ FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext)
}
delete m_pForm;
m_pForm = NULL;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
class CPDF_RefType3Cache
{
@@ -343,12 +343,12 @@ public:
FX_DWORD m_dwCount;
CPDF_Type3Font* m_pType3Font;
};
-FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device)
+bool CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device)
{
CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->GetType3Font();
for (int j = 0; j < m_Type3FontCache.GetSize(); j++)
if ((CPDF_Type3Font*)m_Type3FontCache.GetAt(j) == pType3Font) {
- return TRUE;
+ return true;
}
CFX_Matrix dCTM = m_pDevice->GetCTM();
FX_FLOAT sa = FXSYS_fabs(dCTM.a);
@@ -358,14 +358,14 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
CFX_AffineMatrix char_matrix = pType3Font->GetFontMatrix();
FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
char_matrix.Scale(font_size, font_size);
- FX_ARGB fill_argb = GetFillArgb(textobj, TRUE);
+ FX_ARGB fill_argb = GetFillArgb(textobj, true);
int fill_alpha = FXARGB_A(fill_argb);
int device_class = m_pDevice->GetDeviceClass();
FXTEXT_GLYPHPOS* pGlyphAndPos = NULL;
if (device_class == FXDC_DISPLAY) {
pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, textobj->m_nChars);
} else if (fill_alpha < 255) {
- return FALSE;
+ return false;
}
CPDF_RefType3Cache refTypeCache(pType3Font);
FX_DWORD *pChars = textobj->m_pCharCodes;
@@ -399,7 +399,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
FX_Free(pGlyphAndPos);
pGlyphAndPos = NULL;
}
- CPDF_GraphicStates* pStates = CloneObjStates(textobj, FALSE);
+ CPDF_GraphicStates* pStates = CloneObjStates(textobj, false);
CPDF_RenderOptions Options = m_Options;
Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA;
Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE;
@@ -410,7 +410,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
if (fill_alpha == 255) {
CPDF_RenderStatus status;
status.Initialize(m_pContext, m_pDevice, NULL, NULL, this, pStates, &Options,
- pType3Char->m_pForm->m_Transparency, m_bDropObjects, pFormResource, FALSE, pType3Char, fill_argb);
+ pType3Char->m_pForm->m_Transparency, m_bDropObjects, pFormResource, false, pType3Char, fill_argb);
status.m_Type3FontCache.Append(m_Type3FontCache);
status.m_Type3FontCache.Add(pType3Font);
m_pDevice->SaveState();
@@ -422,12 +422,12 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
FX_RECT rect = rect_f.GetOutterRect();
CFX_FxgeDevice bitmap_device;
if (!bitmap_device.Create((int)(rect.Width() * sa), (int)(rect.Height() * sd), FXDIB_Argb)) {
- return TRUE;
+ return true;
}
bitmap_device.GetBitmap()->Clear(0);
CPDF_RenderStatus status;
status.Initialize(m_pContext, &bitmap_device, NULL, NULL, this, pStates, &Options,
- pType3Char->m_pForm->m_Transparency, m_bDropObjects, pFormResource, FALSE, pType3Char, fill_argb);
+ pType3Char->m_pForm->m_Transparency, m_bDropObjects, pFormResource, false, pType3Char, fill_argb);
status.m_Type3FontCache.Append(m_Type3FontCache);
status.m_Type3FontCache.Add(pType3Font);
matrix.TranslateI(-rect.left, -rect.top);
@@ -457,11 +457,11 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
CFX_AffineMatrix image_matrix = pType3Char->m_ImageMatrix;
image_matrix.Concat(matrix);
CPDF_ImageRenderer renderer;
- if (renderer.Start(this, pType3Char->m_pBitmap, fill_argb, 255, &image_matrix, 0, FALSE)) {
+ if (renderer.Start(this, pType3Char->m_pBitmap, fill_argb, 255, &image_matrix, 0, false)) {
renderer.Continue(NULL);
}
if (!renderer.m_Result) {
- return FALSE;
+ return false;
}
}
}
@@ -471,7 +471,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
CFX_DIBitmap bitmap;
if (!bitmap.Create((int)(rect.Width() * sa), (int)(rect.Height() * sd), FXDIB_8bppMask)) {
FX_Free(pGlyphAndPos);
- return TRUE;
+ return true;
}
bitmap.Clear(0);
for (int iChar = 0; iChar < textobj->m_nChars; iChar ++) {
@@ -487,7 +487,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons
m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb);
FX_Free(pGlyphAndPos);
}
- return TRUE;
+ return true;
}
class CPDF_CharPosList
{
@@ -515,13 +515,13 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos
m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars);
m_nChars = 0;
CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
- FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting();
+ bool bVertWriting = pCIDFont && pCIDFont->IsVertWriting();
for (int iChar = 0; iChar < nChars; iChar ++) {
FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar];
if (CharCode == (FX_DWORD) - 1) {
continue;
}
- FX_BOOL bVert = FALSE;
+ bool bVert = false;
FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++];
if (pCIDFont) {
charpos.m_bFontStyle = pCIDFont->IsFontStyleFromCharCode(CharCode);
@@ -537,7 +537,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos
}
charpos.m_OriginX = iChar ? pCharPos[iChar - 1] : 0;
charpos.m_OriginY = 0;
- charpos.m_bGlyphAdjust = FALSE;
+ charpos.m_bGlyphAdjust = false;
if (pCIDFont == NULL) {
continue;
}
@@ -558,11 +558,11 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos
charpos.m_AdjustMatrix[3] = _CIDTransformToFloat(pTransform[3]);
charpos.m_OriginX += _CIDTransformToFloat(pTransform[4]) * FontSize;
charpos.m_OriginY += _CIDTransformToFloat(pTransform[5]) * FontSize;
- charpos.m_bGlyphAdjust = TRUE;
+ charpos.m_bGlyphAdjust = true;
}
}
}
-FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos,
+bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos,
CPDF_Font* pFont, FX_FLOAT font_size,
const CFX_AffineMatrix* pText2User, const CFX_AffineMatrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
@@ -632,7 +632,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, FX_FLOAT origi
FX_Free(pCharPos);
}
}
-FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos,
+bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos,
CPDF_Font* pFont, FX_FLOAT font_size,
const CFX_AffineMatrix* pText2Device,
FX_ARGB fill_argb, const CPDF_RenderOptions* pOptions)
@@ -671,13 +671,13 @@ FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, int nChars,
}
void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device,
CPDF_Font* pFont, FX_FLOAT font_size,
- const CFX_AffineMatrix* pTextMatrix, FX_BOOL bFill, FX_BOOL bStroke)
+ const CFX_AffineMatrix* pTextMatrix, bool bFill, bool bStroke)
{
if (!bStroke) {
CPDF_PathObject path;
CPDF_TextObject* pCopy = new CPDF_TextObject;
pCopy->Copy(textobj);
- path.m_bStroke = FALSE;
+ path.m_bStroke = false;
path.m_FillType = FXFILL_WINDING;
path.m_ClipPath.AppendTexts(&pCopy, 1);
path.m_ColorState = textobj->m_ColorState;
diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h
index e5fb831a63..c9c8944a0b 100644
--- a/core/src/fpdfapi/fpdf_render/render_int.h
+++ b/core/src/fpdfapi/fpdf_render/render_int.h
@@ -49,9 +49,9 @@ class CPDF_TransferFunc
public:
CPDF_Document* m_pPDFDoc;
uint8_t m_Samples[256 * 3];
- FX_BOOL m_bIdentity;
+ bool m_bIdentity;
- CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc);
+ CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc);
FX_COLORREF TranslateColor(FX_COLORREF src);
};
@@ -66,7 +66,7 @@ public:
{
return m_pFontCache;
}
- void Clear(FX_BOOL bRelease = FALSE);
+ void Clear(bool bRelease = false);
void ReleaseCachedType3(CPDF_Type3Font* pFont);
void ReleaseTransferFunc(CPDF_Object* pObj);
private:
@@ -91,24 +91,24 @@ class IPDF_ObjectRenderer
public:
static IPDF_ObjectRenderer* Create(int type);
virtual ~IPDF_ObjectRenderer() {}
- virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL) = 0;
- virtual FX_BOOL Continue(IFX_Pause* pPause) = 0;
- FX_BOOL m_Result;
+ virtual bool Start(CPDF_RenderStatus* pRenderStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, bool bStdCS, int blendType = FXDIB_BLEND_NORMAL) = 0;
+ virtual bool Continue(IFX_Pause* pPause) = 0;
+ bool m_Result;
};
class CPDF_RenderStatus
{
public:
CPDF_RenderStatus();
~CPDF_RenderStatus();
- FX_BOOL Initialize(class CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pDeviceMatrix,
+ bool Initialize(class CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pDeviceMatrix,
const CPDF_PageObject* pStopObj, const CPDF_RenderStatus* pParentStatus,
const CPDF_GraphicStates* pInitialStates, const CPDF_RenderOptions* pOptions,
- int transparency, FX_BOOL bDropObjects, CPDF_Dictionary* pFormResource = NULL,
- FX_BOOL bStdCS = FALSE, CPDF_Type3Char* pType3Char = NULL, FX_ARGB fill_color = 0,
- FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE);
+ int transparency, bool bDropObjects, CPDF_Dictionary* pFormResource = NULL,
+ bool bStdCS = false, CPDF_Type3Char* pType3Char = NULL, FX_ARGB fill_color = 0,
+ FX_DWORD GroupFamily = 0, bool bLoadMask = false);
void RenderObjectList(const CPDF_PageObjects* pObjs, const CFX_AffineMatrix* pObj2Device);
void RenderSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause);
+ bool ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause);
CPDF_RenderOptions m_Options;
CPDF_Dictionary* m_pFormResource;
CPDF_Dictionary* m_pPageResource;
@@ -122,45 +122,45 @@ protected:
friend class CPDF_RenderContext;
void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_AffineMatrix* pObj2Device);
void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL ProcessTransparency(const CPDF_PageObject* PageObj, const CFX_AffineMatrix* pObj2Device);
+ bool ProcessTransparency(const CPDF_PageObject* PageObj, const CFX_AffineMatrix* pObj2Device);
void ProcessObjectNoClip(const CPDF_PageObject* PageObj, const CFX_AffineMatrix* pObj2Device);
void DrawObjWithBackground(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL DrawObjWithBlend(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device);
- void ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, int& filltype, FX_BOOL& bStroke);
- void DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, CPDF_Color* pColor, FX_BOOL bStroke);
- void DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke);
- void DrawShadingPattern(CPDF_ShadingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke);
- FX_BOOL SelectClipPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke);
- FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pImage2Device);
- FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pImage2Device);
- FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, FX_ARGB fill_argb, int bitmap_alpha,
+ bool DrawObjWithBlend(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device);
+ bool ProcessPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device);
+ void ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, int& filltype, bool& bStroke);
+ void DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, CPDF_Color* pColor, bool bStroke);
+ void DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, bool bStroke);
+ void DrawShadingPattern(CPDF_ShadingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, bool bStroke);
+ bool SelectClipPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, bool bStroke);
+ bool ProcessImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pObj2Device);
+ bool OutputBitmapAlpha(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pImage2Device);
+ bool OutputImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pImage2Device);
+ bool OutputDIBSource(const CFX_DIBSource* pOutputBitmap, FX_ARGB fill_argb, int bitmap_alpha,
const CFX_AffineMatrix* pImage2Device, CPDF_ImageCache* pImageCache, FX_DWORD flags);
void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int top, FX_ARGB mask_argb,
int bitmap_alpha, int blend_mode, int bIsolated);
- FX_BOOL ProcessShading(CPDF_ShadingObject* pShadingObj, const CFX_AffineMatrix* pObj2Device);
+ bool ProcessShading(CPDF_ShadingObject* pShadingObj, const CFX_AffineMatrix* pObj2Device);
void DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMatrix* pMatrix, FX_RECT& clip_rect,
- int alpha, FX_BOOL bAlphaMode);
- FX_BOOL ProcessType3Text(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL ProcessText(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath);
+ int alpha, bool bAlphaMode);
+ bool ProcessType3Text(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device);
+ bool ProcessText(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath);
void DrawTextPathWithPattern(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device,
CPDF_Font* pFont, FX_FLOAT font_size,
- const CFX_AffineMatrix* pTextMatrix, FX_BOOL bFill, FX_BOOL bStroke);
- FX_BOOL ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device);
+ const CFX_AffineMatrix* pTextMatrix, bool bFill, bool bStroke);
+ bool ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device);
CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, int& top,
- FX_BOOL bBackAlphaRequired);
+ bool bBackAlphaRequired);
CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, FX_RECT* pClipRect, const CFX_AffineMatrix* pMatrix);
void Init(CPDF_RenderContext* pParent);
static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont);
- static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, FX_BOOL bStroke);
+ static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, bool bStroke);
CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const;
- FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bType3 = FALSE) const;
+ FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, bool bType3 = false) const;
FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const;
CPDF_RenderContext* m_pContext;
- FX_BOOL m_bStopped;
+ bool m_bStopped;
void DitherObjectArea(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device);
- FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bLogical, FX_RECT &rect) const;
+ bool GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, bool bLogical, FX_RECT &rect) const;
void GetScaledMatrix(CFX_Matrix &matrix) const;
protected:
@@ -175,13 +175,13 @@ protected:
CPDF_GraphicStates m_InitialStates;
int m_HalftoneLimit;
IPDF_ObjectRenderer* m_pObjectRenderer;
- FX_BOOL m_bPrint;
+ bool m_bPrint;
int m_Transparency;
int m_DitherBits;
- FX_BOOL m_bDropObjects;
- FX_BOOL m_bStdCS;
+ bool m_bDropObjects;
+ bool m_bStdCS;
FX_DWORD m_GroupFamily;
- FX_BOOL m_bLoadMask;
+ bool m_bLoadMask;
CPDF_Type3Char * m_pType3Char;
FX_ARGB m_T3FillColor;
int m_curBlend;
@@ -194,20 +194,20 @@ public:
m_pBitmap = NULL;
m_pMask = NULL;
m_MatteColor = 0;
- m_bCached = FALSE;
+ m_bCached = false;
m_nDownsampleWidth = 0;
m_nDownsampleHeight = 0;
}
- FX_BOOL Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL);
+ bool Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, bool bStdCS = false, FX_DWORD GroupFamily = 0, bool bLoadMask = false, CPDF_RenderStatus* pRenderStatus = NULL);
- FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0);
- FX_BOOL Continue(void* LoadHandle, IFX_Pause* pPause);
+ bool StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, bool bStdCS = false, FX_DWORD GroupFamily = 0, bool bLoadMask = false, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0);
+ bool Continue(void* LoadHandle, IFX_Pause* pPause);
~CPDF_ImageLoader();
CFX_DIBSource* m_pBitmap;
CFX_DIBSource* m_pMask;
FX_DWORD m_MatteColor;
- FX_BOOL m_bCached;
+ bool m_bCached;
protected:
int32_t m_nDownsampleWidth;
int32_t m_nDownsampleHeight;
@@ -218,8 +218,8 @@ public:
CPDF_ProgressiveImageLoaderHandle();
~CPDF_ProgressiveImageLoaderHandle();
- FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, bool bStdCS = false, FX_DWORD GroupFamily = 0, bool bLoadMask = false, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0);
+ bool Continue(IFX_Pause* pPause);
protected:
CPDF_ImageLoader* m_pImageLoader;
CPDF_PageRenderCache* m_pCache;
@@ -233,10 +233,10 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer
public:
CPDF_ImageRenderer();
~CPDF_ImageRenderer();
- FX_BOOL Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL);
- FX_BOOL Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* pDIBSource, FX_ARGB bitmap_argb,
- int bitmap_alpha, const CFX_AffineMatrix* pImage2Device, FX_DWORD flags, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, bool bStdCS, int blendType = FXDIB_BLEND_NORMAL);
+ bool Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* pDIBSource, FX_ARGB bitmap_argb,
+ int bitmap_alpha, const CFX_AffineMatrix* pImage2Device, FX_DWORD flags, bool bStdCS, int blendType = FXDIB_BLEND_NORMAL);
+ bool Continue(IFX_Pause* pPause);
protected:
CPDF_RenderStatus* m_pRenderStatus;
CPDF_ImageObject* m_pImageObject;
@@ -247,7 +247,7 @@ protected:
const CFX_DIBSource* m_pDIBSource;
CFX_DIBitmap* m_pClone;
int m_BitmapAlpha;
- FX_BOOL m_bPatternColor;
+ bool m_bPatternColor;
CPDF_Pattern* m_pPattern;
FX_ARGB m_FillArgb;
FX_DWORD m_Flags;
@@ -255,21 +255,21 @@ protected:
CFX_ImageTransformer* m_pTransformer;
void* m_DeviceHandle;
void* m_LoadHandle;
- FX_BOOL m_bStdCS;
+ bool m_bStdCS;
int m_BlendType;
- FX_BOOL StartBitmapAlpha();
- FX_BOOL StartDIBSource();
- FX_BOOL StartRenderDIBSource();
- FX_BOOL StartLoadDIBSource();
- FX_BOOL DrawMaskedImage();
- FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device);
+ bool StartBitmapAlpha();
+ bool StartDIBSource();
+ bool StartRenderDIBSource();
+ bool StartLoadDIBSource();
+ bool DrawMaskedImage();
+ bool DrawPatternImage(const CFX_Matrix* pObj2Device);
};
class CPDF_ScaledRenderBuffer
{
public:
CPDF_ScaledRenderBuffer();
~CPDF_ScaledRenderBuffer();
- FX_BOOL Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
+ bool Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
const CPDF_PageObject* pObj, const CPDF_RenderOptions *pOptions = NULL, int max_dpi = 0);
CFX_RenderDevice* GetDevice()
{
@@ -294,13 +294,13 @@ class CPDF_QuickStretcher
public:
CPDF_QuickStretcher();
~CPDF_QuickStretcher();
- FX_BOOL Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox);
- FX_BOOL Continue(IFX_Pause* pPause);
+ bool Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox);
+ bool Continue(IFX_Pause* pPause);
CFX_DIBitmap* m_pBitmap;
int m_ResultLeft, m_ResultTop, m_ClipLeft, m_ClipTop;
int m_DestWidth, m_DestHeight, m_ResultWidth, m_ResultHeight;
int m_Bpp, m_SrcWidth, m_SrcHeight;
- FX_BOOL m_bFlipX, m_bFlipY;
+ bool m_bFlipX, m_bFlipY;
CPDF_ColorSpace* m_pCS;
ICodec_ScanlineDecoder* m_pDecoder;
CPDF_StreamAcc m_StreamAcc;
@@ -311,7 +311,7 @@ class CPDF_DeviceBuffer
public:
CPDF_DeviceBuffer();
~CPDF_DeviceBuffer();
- FX_BOOL Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
+ bool Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
const CPDF_PageObject* pObj, int max_dpi = 0);
void OutputToDevice();
CFX_DIBitmap* GetBitmap() const
@@ -337,8 +337,8 @@ public:
~CPDF_ImageCache();
void ClearImageData();
void Reset(const CFX_DIBitmap* pBitmap);
- FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE,
+ bool GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources,
+ bool bStdCS = false, FX_DWORD GroupFamily = 0, bool bLoadMask = false,
CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0);
FX_DWORD EstimateSize() const
{
@@ -359,8 +359,8 @@ public:
int m_dwTimeCount;
public:
int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0);
+ bool bStdCS = false, FX_DWORD GroupFamily = 0,
+ bool bLoadMask = false, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0);
int Continue(IFX_Pause* pPause);
int ContinueGetCachedBitmap();
CFX_DIBSource* DetachBitmap();
@@ -388,23 +388,23 @@ class CPDF_DIBSource : public CFX_DIBSource
public:
CPDF_DIBSource();
virtual ~CPDF_DIBSource();
- FX_BOOL Load(CPDF_Document* pDoc, const CPDF_Stream* pStream,
+ bool Load(CPDF_Document* pDoc, const CPDF_Stream* pStream,
CPDF_DIBSource** ppMask, FX_DWORD* pMatteColor,
CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE);
- virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const;
+ bool bStdCS = false, FX_DWORD GroupFamily = 0, bool bLoadMask = false);
+ virtual bool SkipToScanline(int line, IFX_Pause* pPause) const;
virtual uint8_t* GetBuffer() const;
virtual const uint8_t* GetScanline(int line) const;
virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp,
- int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const;
+ int dest_width, bool bFlipX, int clip_left, int clip_width) const;
virtual void SetDownSampleSize(int dest_width, int dest_height) const;
CFX_DIBitmap* GetBitmap() const;
void ReleaseBitmap(CFX_DIBitmap*) const;
void ClearImageData();
public:
- int StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, FX_BOOL bHasMask,
+ int StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, bool bHasMask,
CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources,
- FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE);
+ bool bStdCS = false, FX_DWORD GroupFamily = 0, bool bLoadMask = false);
int ContinueLoadDIBSource(IFX_Pause* pPause);
int StratLoadMask();
int StartLoadMaskDIB();
@@ -415,13 +415,13 @@ public:
FX_DWORD m_MatteColor;
void* m_pJbig2Context;
CPDF_StreamAcc* m_pGlobalStream;
- FX_BOOL m_bStdCS;
+ bool m_bStdCS;
int m_Status;
CPDF_Object* m_pMaskStream;
- FX_BOOL m_bHasMask;
+ bool m_bHasMask;
protected:
- FX_BOOL LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources);
- DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX_BOOL& bColorKey);
+ bool LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources);
+ DIB_COMP_DATA* GetDecodeAndMaskArray(bool& bDefaultDecode, bool& bColorKey);
CPDF_DIBSource* LoadMask(FX_DWORD& MatteColor);
CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask);
void LoadJpxBitmap();
@@ -439,11 +439,11 @@ protected:
FX_DWORD m_bpc_orig;
FX_DWORD m_nComponents;
FX_DWORD m_GroupFamily;
- FX_BOOL m_bLoadMask;
- FX_BOOL m_bDefaultDecode;
- FX_BOOL m_bImageMask;
- FX_BOOL m_bDoBpcCheck;
- FX_BOOL m_bColorKey;
+ bool m_bLoadMask;
+ bool m_bDefaultDecode;
+ bool m_bImageMask;
+ bool m_bDoBpcCheck;
+ bool m_bColorKey;
DIB_COMP_DATA* m_pCompData;
uint8_t* m_pLineBuf;
uint8_t* m_pMaskedLine;