summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-23 13:36:00 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-23 13:36:00 -0700
commitf1e7c461dfabbff6b65a072f24f6711b34159361 (patch)
tree3b0bb772a59669f06b86824a444fd06642592d4b /core/src/fpdfapi/fpdf_parser
parent320b2313d19869333ed453af546e61a9fc2b81c9 (diff)
downloadpdfium-f1e7c461dfabbff6b65a072f24f6711b34159361.tar.xz
Revert "FX_BOOL considered harmful, part 2."
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-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
9 files changed, 793 insertions, 793 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h
index c27ade8a70..2ec54fb1f5 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(bool bEarlyChange);
+ CPDF_LzwFilter(FX_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) {}
- bool m_bEarlyChange;
+ FX_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) {}
- bool m_bTiff;
+ FX_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;
- bool m_bGotHeader;
+ FX_BOOL m_bGotHeader;
};
class CPDF_FaxFilter : public CFX_DataFilter
{
public:
CPDF_FaxFilter();
virtual ~CPDF_FaxFilter();
- bool Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns);
+ FX_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, bool bFinish,
+ void ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
CFX_BinaryBuf& dest_buf);
- bool ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos);
+ FX_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 e60888a292..47c08fb4a3 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;
- bool bFirstDigit = true;
+ FX_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;
- bool EndOfLine = false;
- bool ByteAlign = false;
- bool BlackIs1 = false;
+ FX_BOOL EndOfLine = FALSE;
+ FX_BOOL ByteAlign = FALSE;
+ FX_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 bool CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Columns)
+static FX_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(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
+FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_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;
- bool bEarlyChange = true;
+ FX_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(bool bLZW, const uint8_t* src_buf, FX_DWORD sr
bEarlyChange, predictor, Colors, BitsPerComponent, Columns, estimated_size,
dest_buf, dest_size);
}
-bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
+FX_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, bool bImageAcc)
+ CPDF_Dictionary*& pImageParms, FX_DWORD last_estimated_size, FX_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 @@ bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictio
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 @@ bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictio
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 @@ bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictio
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 @@ bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictio
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))) {
- bool bBE = src_data[0] == 0xfe;
+ FX_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, bool bHex)
+CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_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 0ea692ed4d..c0f45c5379 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;
- bool bSkipped = false;
+ FX_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);
}
-bool CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pThisPageDict)
+FX_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 @@ bool CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pTh
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(bool bCheckRevision) const
+FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const
{
if (m_pParser == NULL) {
return (FX_DWORD) - 1;
}
return m_pParser->GetPermissions(bCheckRevision);
}
-bool CPDF_Document::IsOwner() const
+FX_BOOL CPDF_Document::IsOwner() const
{
if (m_pParser == NULL) {
- return true;
+ return TRUE;
}
return m_pParser->IsOwner();
}
-bool CPDF_Document::IsFormStream(FX_DWORD objnum, bool& bForm) const
+FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_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 ff6f0e12bd..9f356a4748 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, bool bIgnoreMeta, CPDF_Array* pIdArray)
+ uint8_t* key, int keylen, FX_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;
- bool m_bChecked;
+ FX_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()
{
}
-bool CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict)
+FX_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);
}
-bool CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len)
+FX_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 bool _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStringC& name, int& cipher, int& keylen)
+static FX_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 bool _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStringC&
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 bool _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStringC&
keylen = Version > 1 ? pEncryptDict->GetInteger(FX_BSTRC("Length"), 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-bool CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict)
+FX_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 @@ 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;
}
-bool CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX_DWORD type, int& cipher, int& key_len)
+FX_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 @@ bool CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX_DW
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;
}
-bool CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen)
+FX_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);
}
}
-bool CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size,
- bool bOwner, uint8_t* key)
+FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size,
+ FX_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 @@ bool CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password,
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 @@ bool CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password,
}
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 @@ bool CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password,
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, bool bOwner, uint8_t* key)
+int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_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, bool bOwner, uint8_t* key, int32_t key_len)
+int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD size, FX_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);
}
-bool CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX_DWORD pass_size,
- bool bIgnoreEncryptMeta, uint8_t* key, int32_t 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)
{
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 @@ bool CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX
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);
}
-bool CPDF_StandardSecurityHandler::CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size,
+FX_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);
}
-bool CPDF_StandardSecurityHandler::IsMetadataEncrypted()
+FX_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, bool bDefault, FX_DWORD type)
+ const uint8_t* owner_pass, FX_DWORD owner_size, FX_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, bool bOwner, const uint8_t* key)
+void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, FX_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,
- bool bEncryptMetadata, const uint8_t* key)
+ FX_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(bool bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
+void CPDF_StandardCryptoHandler::CryptBlock(FX_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(bool bEncrypt, FX_DWORD objnum, FX_D
}
typedef struct _AESCryptContext {
uint8_t m_Context[2048];
- bool m_bIV;
+ FX_BOOL m_bIV;
uint8_t m_Block[16];
FX_DWORD m_BlockOffset;
} AESCryptContext;
-void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, bool bEncrypt)
+void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_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, b
}
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, b
CRYPT_ArcFourSetup(pContext, realkey, realkeylen);
return pContext;
}
-bool CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, bool bEncrypt)
+FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_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 @@ bool CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_b
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 @@ bool CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_b
break;
}
}
- return true;
+ return TRUE;
}
-bool CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, bool bEncrypt)
+FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_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 @@ bool CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_
}
}
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;
}
-bool CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler)
+FX_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 @@ bool CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Securi
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
- return true;
+ return TRUE;
}
-bool CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen)
+FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen)
{
if (cipher == FXCIPHER_AES) {
switch(keylen) {
@@ -892,15 +892,15 @@ bool CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen
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 @@ bool CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
- return true;
+ return TRUE;
}
-bool CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size,
+FX_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);
}
-bool CPDF_StandardCryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf)
+FX_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;
}
-bool CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
+FX_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 ffce46bdd2..1958fab280 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, bool bOwnFile)
+CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile)
{
if (!pFile) {
return NULL;
@@ -41,16 +41,16 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, 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, bool bOwnFile)
+void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile)
{
m_pFile = pFile;
m_bOwnFile = bOwnFile;
CPDF_SyntaxParser parser;
parser.InitParser(m_pFile, 0);
while (1) {
- bool bNumber;
+ FX_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, bool bOwnFile)
}
}
}
-bool CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const
+FX_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 @@ 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 f81aa73cb3..fed4546fab 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(bool bRaw) const
+CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(FX_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(bool bEarlyChange)
+CPDF_LzwFilter::CPDF_LzwFilter(FX_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);
}
}
-bool CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns)
+FX_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 @@ bool CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, in
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);
}
-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,
+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,
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&
}
}
}
-bool CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos)
+FX_BOOL CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos)
{
if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) {
- return false;
+ return FALSE;
}
- bool ret;
+ FX_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;
}
- bool bNext1D = src_buf[bitpos / 8] & (1 << (7 - bitpos % 8));
+ FX_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 @@ bool CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos)
}
}
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 96e6807102..c7d1dece25 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);
}
-bool CPDF_Object::IsIdentical(CPDF_Object* pOther) const
+FX_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 @@ 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 @@ 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(bool bDirect) const
+CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const
{
CFX_MapPtrToPtr visited;
return CloneInternal(bDirect, &visited);
}
-CPDF_Object* CPDF_Object::CloneInternal(bool bDirect, CFX_MapPtrToPtr* visited) const
+CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const
{
switch (m_Type) {
case PDFOBJ_BOOLEAN:
@@ -284,7 +284,7 @@ CPDF_Object* CPDF_Object::CloneInternal(bool bDirect, CFX_MapPtrToPtr* visited)
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(bool bDirect, CFX_MapPtrToPtr* visited)
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(bool bInteger, void* pData)
+CPDF_Number::CPDF_Number(FX_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);
}
-bool CPDF_Number::Identical(CPDF_Number* pOther) const
+FX_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));
}
-bool CPDF_Array::Identical(CPDF_Array* pOther) const
+FX_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;
}
-bool CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, bool bDefault) const
+FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, FX_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;
}
-bool CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const
+FX_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);
}
-bool CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const
+FX_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 @@ 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, bool bValue)
+void CPDF_Dictionary::SetAtBoolean(const CFX_ByteStringC& key, FX_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, bool bCompressed, bool bKeepBuf)
+void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompressed, FX_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, bool bCompressed,
m_pDict->RemoveAt(FX_BSTRC("DecodeParms"));
}
}
-bool CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) const
+FX_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 @@ bool CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) c
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);
}
}
-bool CPDF_Stream::Identical(CPDF_Stream* pOther) const
+FX_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 @@ 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 @@ 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 @@ 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(bool bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const
+CPDF_Stream* CPDF_Stream::Clone(FX_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(bool bDirect, FPDF_LPFCloneStreamCallback lpfCal
}
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(bool bDirect, FPDF_LPFCloneStreamCallback lpfCal
pObj->InitStream((IFX_FileRead*)pFS, pCloneDict);
return pObj;
}
-extern bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
+extern FX_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, bool bImageAcc);
+ CPDF_Dictionary*& pImageParms, FX_DWORD estimated_size, FX_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, bool bRawAccess, FX_DWORD estimated_size,
- bool bImageAcc)
+void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, FX_DWORD estimated_size,
+ FX_BOOL bImageAcc)
{
if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
return;
@@ -1111,7 +1111,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, bool bRawAccess, FX
m_pData = pDecryptedData;
m_dwSize = dwDecryptedSize;
} else {
- bool bRet = PDF_DataDecode(pDecryptedData, dwDecryptedSize, m_pStream->GetDict(),
+ FX_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 07f6ca783c..854be75ad4 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"
-bool IsSignatureDict(const CPDF_Dictionary* pDict)
+FX_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(bool bReParse)
+void CPDF_Parser::CloseParser(FX_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, bool bReParse)
+FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse)
{
IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
if (!pFileAccess) {
@@ -132,7 +132,7 @@ FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, bool bReParse)
}
return StartParse(pFileAccess, bReParse);
}
-FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, bool bReParse)
+FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse)
{
IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
if (!pFileAccess) {
@@ -142,10 +142,10 @@ FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, bool bReParse)
}
CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler();
CPDF_SecurityHandler* FPDF_CreatePubKeyHandler(void*);
-FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, bool bReParse, bool bOwnFileRead)
+FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX_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, bool bReParse, bool
if (!bReParse) {
m_pDocument = new CPDF_Document(this);
}
- bool bXRefRebuilt = false;
- if (m_Syntax.SearchWord(FX_BSTRC("startxref"), true, false, 4096)) {
+ FX_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();
- bool bNumber;
+ FX_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, bool bReParse, bool
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 bool CheckDirectType(CPDF_Dictionary* pDict, const CFX_ByteStringC& key, int32_t iType)
+static FX_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;
}
-bool CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos)
+FX_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 @@ 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;
}
-bool CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD dwObjCount)
+FX_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 @@ bool CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD dwOb
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;
}
-bool CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount)
+FX_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 @@ bool CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount)
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 @@ bool CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount)
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 @@ bool CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount)
}
FX_Free(pBuf);
m_Syntax.RestorePos(SavedPos + count * recordsize);
- return true;
+ return TRUE;
}
-bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bSkip, bool bFirst)
+FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip, FX_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 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bS
}
while (1) {
FX_FILESIZE SavedPos = m_Syntax.SavePos();
- bool bIsNumber;
+ FX_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 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bS
}
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();
- bool bFirstItem = false;
+ FX_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;
- bool bFirstBlock = true;
+ FX_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 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bS
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 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bS
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 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bS
m_V5Type.SetAtGrow(objnum, 1);
}
if (bFirstBlock) {
- bFirstBlock = false;
+ bFirstBlock = FALSE;
}
}
}
@@ -596,25 +596,25 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, bool bS
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;
}
-bool CPDF_Parser::LoadAllCrossRefV5(FX_FILESIZE xrefpos)
+FX_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;
}
-bool CPDF_Parser::RebuildCrossRef()
+FX_BOOL CPDF_Parser::RebuildCrossRef()
{
m_CrossRef.RemoveAll();
m_V5Type.RemoveAll();
@@ -633,7 +633,7 @@ 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) {
- bool bOverFlow = false;
+ FX_BOOL bOverFlow = FALSE;
FX_DWORD size = (FX_DWORD)(m_Syntax.m_FileLen - pos);
if (size > 4096) {
size = 4096;
@@ -812,7 +812,7 @@ 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 @@ 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 @@ bool CPDF_Parser::RebuildCrossRef()
FX_FILESIZE dwSavePos = m_Syntax.SavePos();
CFX_ByteString strWord = m_Syntax.GetKeyword();
if (!strWord.Compare(FX_BSTRC("startxref"))) {
- bool bNumber = false;
+ FX_BOOL bNumber = FALSE;
CFX_ByteString bsOffset = m_Syntax.GetNextWord(bNumber);
if (bNumber) {
m_LastXRefOffset = FXSYS_atoi(bsOffset);
@@ -982,7 +982,7 @@ 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;
}
-bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainXRef)
+FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_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 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainX
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 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainX
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 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainX
}
if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3) {
pStream->Release();
- return false;
+ return FALSE;
}
FX_DWORD totalWidth = dwAccWidth.ValueOrDie();
CPDF_StreamAcc acc;
@@ -1120,7 +1120,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainX
} else {
if (offset < 0 || offset >= m_V5Type.GetSize()) {
pStream->Release();
- return false;
+ return FALSE;
}
m_V5Type[offset] = 255;
}
@@ -1129,7 +1129,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, bool bMainX
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();
}
-bool CPDF_Parser::IsFormStream(FX_DWORD objnum, bool& bForm)
+FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_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);
- bool bIsNumber;
+ FX_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];
- bool bNextOffValid = false;
+ FX_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);
- bool bIsNumber;
+ FX_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);
- bool bIsNumber;
+ FX_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(bool bCheckRevision)
+FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision)
{
if (m_pSecurityHandler == NULL) {
return (FX_DWORD) - 1;
@@ -1473,11 +1473,11 @@ FX_DWORD CPDF_Parser::GetPermissions(bool bCheckRevision)
}
return dwPermission;
}
-bool CPDF_Parser::IsOwner()
+FX_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, bool bForced)
+void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, FX_BOOL bForced)
{
ASSERT(m_pSecurityHandler == NULL);
if (!m_bForceUseSecurityHandler) {
@@ -1492,29 +1492,29 @@ void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, boo
m_Syntax.m_pCryptoHandler = pSecurityHandler->CreateCryptoHandler();
m_Syntax.m_pCryptoHandler->Init(NULL, pSecurityHandler);
}
-bool CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset)
+FX_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();
- bool bIsNumber;
+ FX_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 @@ 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 @@ 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, bool bReParse, bool bOwnFileRead)
+FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX_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, bool bReParse, b
m_pDocument = new CPDF_Document(this);
}
FX_FILESIZE dwFirstXRefOffset = m_Syntax.SavePos();
- bool bXRefRebuilt = false;
- bool bLoadV4 = false;
- if (!(bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, false, false)) && !LoadCrossRefV5(dwFirstXRefOffset, dwFirstXRefOffset, true)) {
+ FX_BOOL bXRefRebuilt = FALSE;
+ FX_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, bool bReParse, b
}
return PDFPARSE_ERROR_SUCCESS;
}
-bool CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos)
+FX_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);
}
}
-bool CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch)
+FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch)
{
FX_FILESIZE save_pos = m_Pos;
m_Pos = pos;
- bool ret = GetNextChar(ch);
+ FX_BOOL ret = GetNextChar(ch);
m_Pos = save_pos;
return ret;
}
-bool CPDF_SyntaxParser::GetNextChar(uint8_t& ch)
+FX_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 @@ 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;
}
-bool CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch)
+FX_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 @@ 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;
}
-bool CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size)
+FX_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;
- bool bFirst = true;
+ FX_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(bool& bIsNumber)
+CFX_ByteString CPDF_SyntaxParser::GetNextWord(FX_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, bool bDecrypt)
+CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, FX_BOOL bDecrypt)
{
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
return NULL;
}
FX_FILESIZE SavedPos = m_Pos;
- bool bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
- bool bIsNumber;
+ FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
+ FX_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) {
- bool bIsNumber;
+ FX_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;
- bool bIsNumber;
+ FX_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;
- bool bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
- bool bIsNumber;
+ FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
+ FX_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) {
- bool bIsNumber;
+ FX_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;
- bool bIsNumber;
+ FX_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);
}
-bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen)
+FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen)
{
uint8_t type = PDF_CharType[tag[0]];
- bool bCheckLeft = type != 'D' && type != 'W';
+ FX_BOOL bCheckLeft = type != 'D' && type != 'W';
type = PDF_CharType[tag[taglen - 1]];
- bool bCheckRight = type != 'D' && type != 'W';
+ FX_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;
}
-bool CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, bool bWholeWord, bool bForward, FX_FILESIZE limit)
+FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, FX_BOOL bWholeWord, FX_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 @@ bool CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, bool bWholeWord,
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 @@ bool CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, bool bWholeWord,
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 @@ bool CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, bool bWholeWord,
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, bool bWholeWord, FX_FILESIZE limit)
+int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, FX_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 bool IsDocAvail(IFX_DownloadHints* pHints) override;
+ virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) override;
virtual void SetDocument(CPDF_Document* pDoc) override;
- virtual bool IsPageAvail(int iPage, IFX_DownloadHints* pHints) override;
+ virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override;
virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override;
virtual int32_t IsLinearizedPDF() override;
- virtual bool IsLinearized() override
+ virtual FX_BOOL IsLinearized() override
{
return m_bLinearized;
}
@@ -2717,52 +2717,52 @@ protected:
static int s_CurrentDataAvailRecursionDepth;
FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset);
- 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);
+ 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);
int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset);
- bool IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
+ FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- bool GetNextToken(CFX_ByteString &token);
- bool GetNextChar(uint8_t &ch);
+ FX_BOOL GetNextToken(CFX_ByteString &token);
+ FX_BOOL GetNextChar(uint8_t &ch);
CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum);
- 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);
+ 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);
- 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);
+ 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);
void ResetFirstCheck(int iPage);
CPDF_Parser m_parser;
@@ -2779,7 +2779,7 @@ protected:
CPDF_Object *m_pTrailer;
- bool m_bDocAvail;
+ FX_BOOL m_bDocAvail;
FX_FILESIZE m_dwHeaderOffset;
@@ -2823,31 +2823,31 @@ protected:
FX_DWORD m_PagesObjNum;
- bool m_bLinearized;
+ FX_BOOL m_bLinearized;
FX_DWORD m_dwFirstPageNo;
- bool m_bLinearedDataOK;
+ FX_BOOL m_bLinearedDataOK;
- bool m_bMainXRefLoadTried;
+ FX_BOOL m_bMainXRefLoadTried;
- bool m_bMainXRefLoadedOK;
+ FX_BOOL m_bMainXRefLoadedOK;
- bool m_bPagesTreeLoad;
+ FX_BOOL m_bPagesTreeLoad;
- bool m_bPagesLoad;
+ FX_BOOL m_bPagesLoad;
CPDF_Parser * m_pCurrentParser;
FX_FILESIZE m_dwCurrentXRefSteam;
- bool m_bAnnotsLoad;
+ FX_BOOL m_bAnnotsLoad;
- bool m_bHaveAcroForm;
+ FX_BOOL m_bHaveAcroForm;
FX_DWORD m_dwAcroFormObjNum;
- bool m_bAcroFormLoad;
+ FX_BOOL m_bAcroFormLoad;
CPDF_Object * m_pAcroForm;
@@ -2857,11 +2857,11 @@ protected:
CPDF_Object * m_pPageResource;
- bool m_bNeedDownLoadResource;
+ FX_BOOL m_bNeedDownLoadResource;
- bool m_bPageLoadedOK;
+ FX_BOOL m_bPageLoadedOK;
- bool m_bLinearizedFormParamLoad;
+ FX_BOOL m_bLinearizedFormParamLoad;
CFX_PtrArray m_PagesArray;
@@ -2869,9 +2869,9 @@ protected:
FX_FILESIZE m_dwPrevXRefOffset;
- bool m_bTotalLoadPageTree;
+ FX_BOOL m_bTotalLoadPageTree;
- bool m_bCurPageDictLoadOK;
+ FX_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;
}
-bool CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, bool bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret_array)
+FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_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 @@ bool CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, bool bParsePage, IF
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);
}
-bool CPDF_DataAvail::IsDocAvail(IFX_DownloadHints* pHints)
+FX_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;
}
-bool CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints)
+FX_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);
- bool bRet = IsObjectsAvail(obj_array, false, pHints, m_objs_array);
+ FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
}
return bRet;
}
CFX_PtrArray new_objs_array;
- bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
+ FX_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 @@ bool CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints)
}
return bRet;
}
-bool CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_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;
}
-bool CPDF_DataAvail::CheckDocStatus(IFX_DownloadHints *pHints)
+FX_BOOL CPDF_DataAvail::CheckDocStatus(IFX_DownloadHints *pHints)
{
switch (m_docStatus) {
case PDF_DATAAVAIL_HEADER:
@@ -3195,17 +3195,17 @@ 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;
}
}
-bool CPDF_DataAvail::CheckPageStatus(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckPageStatus(IFX_DownloadHints* pHints)
{
switch (m_docStatus) {
case PDF_DATAAVAIL_PAGETREE:
@@ -3215,36 +3215,36 @@ 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;
}
}
-bool CPDF_DataAvail::LoadAllFile(IFX_DownloadHints* pHints)
+FX_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;
}
-bool CPDF_DataAvail::LoadAllXref(IFX_DownloadHints* pHints)
+FX_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, bool *pExistInFile)
+CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_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;
}
-bool CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_BOOL bExist = FALSE;
CPDF_Object *pInfo = GetObject(m_dwInfoObjNum, pHints, &bExist);
if (!bExist) {
if (m_bHaveAcroForm) {
@@ -3314,17 +3314,17 @@ 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 @@ bool CPDF_DataAvail::CheckInfo(IFX_DownloadHints* pHints)
} else {
m_docStatus = PDF_DATAAVAIL_PAGETREE;
}
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_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 @@ bool CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints)
m_docStatus = PDF_DATAAVAIL_PAGETREE;
}
}
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::PreparePageItem()
+FX_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;
}
-bool CPDF_DataAvail::IsFirstCheck(int iPage)
+FX_BOOL CPDF_DataAvail::IsFirstCheck(int iPage)
{
if (NULL == m_pageMapCheckState) {
m_pageMapCheckState = new CFX_CMapDWordToDWord();
@@ -3399,13 +3399,13 @@ 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);
}
-bool CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
+FX_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);
- bool bExist = false;
+ FX_BOOL bExist = FALSE;
CPDF_Object *pObj = GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
if (bExist) {
@@ -3459,7 +3459,7 @@ 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 @@ 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 @@ bool CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
if (!m_PageObjList.GetSize()) {
m_docStatus = PDF_DATAAVAIL_DONE;
}
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages)
+FX_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 @@ 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;
}
-bool CPDF_DataAvail::CheckPages(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckPages(IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_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;
}
-bool CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
{
FX_DWORD req_size = 1024;
if ((FX_FILESIZE)req_size > m_dwFileLen) {
@@ -3555,34 +3555,34 @@ 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;
}
-bool CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
+FX_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;
}
- bool bNeedDownLoad = false;
+ FX_BOOL bNeedDownLoad = FALSE;
if (pEndOffSet->GetType() == PDFOBJ_NUMBER) {
FX_DWORD dwEnd = pEndOffSet->GetInteger();
dwEnd += 512;
@@ -3593,7 +3593,7 @@ 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 @@ 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);
- bool bIsNumber;
+ FX_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;
}
-bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen)
+FX_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);
- bool bNumber = false;
+ FX_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 @@ 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;
}
-bool CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints)
+FX_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)) {
- bool bNumber;
+ if (m_syntaxParser.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, dwSize)) {
+ FX_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);
- bool bNumber = false;
+ FX_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
-bool CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
+FX_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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
}
CFX_ByteString ret(m_WordBuffer, m_WordSize);
token = ret;
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::GetNextChar(uint8_t &ch)
+FX_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 @@ 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;
}
-bool CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
+FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
{
int32_t iSize = 0;
CFX_ByteString token;
@@ -3908,16 +3908,16 @@ 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;
}
}
}
-bool CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
+FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
{
FX_FILESIZE xref_offset = 0;
int32_t nRet = CheckCrossRefStream(pHints, xref_offset);
@@ -3928,21 +3928,21 @@ 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;
}
-bool CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
+FX_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 @@ 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;
}
-bool CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
+FX_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 @@ bool CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
} else {
m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF;
}
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
+FX_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 @@ 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 @@ 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 @@ 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;
}
-bool CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints)
+FX_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;
}
}
}
-bool CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_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 @@ bool CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageN
pNode->m_dwPageNo = ((CPDF_Reference*)pKid)->GetRefObjNum();
}
pPages->Release();
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_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 @@ bool CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPage
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 @@ bool CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPage
} else {
pPage->Release();
m_docStatus = PDF_DATAAVAIL_ERROR;
- return false;
+ return FALSE;
}
pPage->Release();
- return true;
+ return TRUE;
}
-bool CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints)
+FX_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 @@ bool CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int3
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 @@ bool CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int3
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;
}
-bool CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints)
+FX_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);
}
-bool CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints)
{
- bool bExist = false;
+ FX_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;
}
-bool CPDF_DataAvail::LoadDocPages(IFX_DownloadHints* pHints)
+FX_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;
}
-bool CPDF_DataAvail::LoadPages(IFX_DownloadHints* pHints)
+FX_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;
}
-bool CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints)
+FX_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;
}
-bool CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints)
+FX_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);
- bool bRet = IsObjectsAvail(obj_array, false, pHints, m_objs_array);
+ FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
}
return bRet;
}
CFX_PtrArray new_objs_array;
- bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
+ FX_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;
}
-bool CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints)
+FX_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;
}
-bool CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict)
+FX_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);
}
-bool CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
+FX_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 @@ 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 @@ 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);
- bool bRet = IsObjectsAvail(obj_array, true, pHints, m_objs_array);
+ FX_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;
- bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
+ FX_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 @@ 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 @@ 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) {
- bool bRet = CheckResources(pHints);
+ FX_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;
}
-bool CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints)
+FX_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);
- bool bRet = IsObjectsAvail(obj_array, true, pHints, m_objs_array);
+ FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array);
if (bRet) {
m_objs_array.RemoveAll();
}
return bRet;
}
CFX_PtrArray new_objs_array;
- bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
+ FX_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;
- bool bRet = IsObjectsAvail(m_objs_array, false, pHints, new_objs_array);
+ FX_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);
}
-bool CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum)
+FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum)
{
int32_t iNext = 0;
return BinarySearch(dwObjNum, iNext);
}
-bool CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext)
+FX_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 @@ 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 @@ 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 76e245ad92..4903312645 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);
}
-bool CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token)
+FX_BOOL CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token)
{
int token_len = token.GetLength();
while (m_dwCurPos < m_dwSize - token_len) {
@@ -205,30 +205,30 @@ 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;
}
-bool CPDF_SimpleParser::SkipWord(const CFX_ByteStringC& token)
+FX_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;
}
-bool CPDF_SimpleParser::FindTagPair(const CFX_ByteStringC& start_token, const CFX_ByteStringC& end_token,
+FX_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 @@ bool CPDF_SimpleParser::FindTagPair(const CFX_ByteStringC& start_token, const CF
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;
}
-bool CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams)
+FX_BOOL CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams)
{
nParams ++;
FX_DWORD* pBuf = FX_Alloc(FX_DWORD, nParams);
@@ -262,7 +262,7 @@ bool CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams)
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 @@ bool CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams)
}
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();
- bool bHex = ((CPDF_String*)pObj)->IsHex();
+ FX_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;