Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
index 9c35615a72673c8b1752d49bfce6fcf5f998094a..4afc3a668b19a940d0951390cab076ba59ed4558 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
@@ -27,7 +27,7 @@ FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) |
} |
return FALSE; |
} |
-static FX_INT32 _CompareDWord(const void* p1, const void* p2) |
+static int32_t _CompareDWord(const void* p1, const void* p2) |
{ |
return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); |
} |
@@ -98,8 +98,8 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) |
m_CrossRef.RemoveAll(); |
m_V5Type.RemoveAll(); |
m_ObjVersion.RemoveAll(); |
- FX_INT32 iLen = m_Trailers.GetSize(); |
- for (FX_INT32 i = 0; i < iLen; ++i) { |
+ int32_t iLen = m_Trailers.GetSize(); |
+ for (int32_t i = 0; i < iLen; ++i) { |
if (CPDF_Dictionary* trailer = m_Trailers.GetAt(i)) |
trailer->Release(); |
} |
@@ -109,11 +109,11 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) |
m_pLinearized = NULL; |
} |
} |
-static FX_INT32 GetHeaderOffset(IFX_FileRead* pFile) |
+static int32_t GetHeaderOffset(IFX_FileRead* pFile) |
{ |
FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025); |
- FX_BYTE buf[4]; |
- FX_INT32 offset = 0; |
+ uint8_t buf[4]; |
+ int32_t offset = 0; |
while (1) { |
if (!pFile->ReadBlock(buf, offset, 4)) { |
return -1; |
@@ -152,7 +152,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX |
m_bXRefStream = FALSE; |
m_LastXRefOffset = 0; |
m_bOwnFileRead = bOwnFileRead; |
- FX_INT32 offset = GetHeaderOffset(pFileAccess); |
+ int32_t offset = GetHeaderOffset(pFileAccess); |
if (offset == -1) { |
if (bOwnFileRead && pFileAccess) { |
pFileAccess->Release(); |
@@ -160,7 +160,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX |
return PDFPARSE_ERROR_FORMAT; |
} |
m_Syntax.InitParser(pFileAccess, offset); |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!m_Syntax.GetCharAt(5, ch)) { |
return PDFPARSE_ERROR_FORMAT; |
} |
@@ -331,11 +331,11 @@ FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) |
return m_CrossRef[objnum]; |
} |
if (m_V5Type[objnum] == 2) { |
- return m_CrossRef[(FX_INT32)m_CrossRef[objnum]]; |
+ return m_CrossRef[(int32_t)m_CrossRef[objnum]]; |
} |
return 0; |
} |
-static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) |
+static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) |
{ |
CPDF_Object* pObj = pDict->GetElement(key); |
if (pObj == NULL) { |
@@ -346,7 +346,7 @@ static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) |
} |
return 0; |
} |
-static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, FX_INT32 iType) |
+static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, int32_t iType) |
{ |
CPDF_Object* pObj = pDict->GetElement(key); |
if (!pObj) { |
@@ -363,7 +363,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) |
if (m_pTrailer == NULL) { |
return FALSE; |
} |
- FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); |
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); |
if (xrefsize <= 0 || xrefsize > (1 << 20)) { |
return FALSE; |
} |
@@ -400,7 +400,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) |
XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); |
m_Trailers.Add(pDict); |
} |
- for (FX_INT32 i = 0; i < CrossRefList.GetSize(); i ++) |
+ for (int32_t i = 0; i < CrossRefList.GetSize(); i ++) |
if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { |
return FALSE; |
} |
@@ -415,7 +415,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d |
if (m_pTrailer == NULL) { |
return FALSE; |
} |
- FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); |
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); |
if (xrefsize == 0) { |
return FALSE; |
} |
@@ -434,7 +434,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d |
XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); |
m_Trailers.Add(pDict); |
} |
- for (FX_INT32 i = 1; i < CrossRefList.GetSize(); i ++) |
+ for (int32_t i = 1; i < CrossRefList.GetSize(); i ++) |
if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { |
return FALSE; |
} |
@@ -451,12 +451,12 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou |
FX_DWORD start_objnum = 0; |
FX_DWORD count = dwObjCount; |
FX_FILESIZE SavedPos = m_Syntax.SavePos(); |
- FX_INT32 recordsize = 20; |
+ int32_t recordsize = 20; |
char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); |
pBuf[1024 * recordsize] = '\0'; |
- FX_INT32 nBlocks = count / 1024 + 1; |
- for (FX_INT32 block = 0; block < nBlocks; block ++) { |
- FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; |
+ int32_t nBlocks = count / 1024 + 1; |
+ for (int32_t block = 0; block < nBlocks; block ++) { |
+ int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; |
FX_DWORD dwReadSize = block_size * recordsize; |
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) { |
FX_Free(pBuf); |
@@ -466,16 +466,16 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou |
FX_Free(pBuf); |
return FALSE; |
} |
- for (FX_INT32 i = 0; i < block_size; i ++) { |
+ for (int32_t i = 0; i < block_size; i ++) { |
FX_DWORD objnum = start_objnum + block * 1024 + i; |
char* pEntry = pBuf + i * recordsize; |
if (pEntry[17] == 'f') { |
m_CrossRef.SetAtGrow(objnum, 0); |
m_V5Type.SetAtGrow(objnum, 0); |
} else { |
- FX_INT32 offset = FXSYS_atoi(pEntry); |
+ int32_t offset = FXSYS_atoi(pEntry); |
if (offset == 0) { |
- for (FX_INT32 c = 0; c < 10; c ++) { |
+ for (int32_t c = 0; c < 10; c ++) { |
if (pEntry[c] < '0' || pEntry[c] > '9') { |
FX_Free(pBuf); |
return FALSE; |
@@ -483,7 +483,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou |
} |
} |
m_CrossRef.SetAtGrow(objnum, offset); |
- FX_INT32 version = FXSYS_atoi(pEntry + 11); |
+ int32_t version = FXSYS_atoi(pEntry + 11); |
if (version >= 1) { |
m_bVersionUpdated = TRUE; |
} |
@@ -537,7 +537,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B |
m_Syntax.ToNextWord(); |
SavedPos = m_Syntax.SavePos(); |
FX_BOOL bFirstItem = FALSE; |
- FX_INT32 recordsize = 20; |
+ int32_t recordsize = 20; |
if (bFirst) { |
bFirstItem = TRUE; |
} |
@@ -545,12 +545,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B |
if (!bSkip) { |
char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); |
pBuf[1024 * recordsize] = '\0'; |
- FX_INT32 nBlocks = count / 1024 + 1; |
+ int32_t nBlocks = count / 1024 + 1; |
FX_BOOL bFirstBlock = TRUE; |
- for (FX_INT32 block = 0; block < nBlocks; block ++) { |
- FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; |
+ for (int32_t block = 0; block < nBlocks; block ++) { |
+ int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; |
m_Syntax.ReadBlock((FX_LPBYTE)pBuf, block_size * recordsize); |
- for (FX_INT32 i = 0; i < block_size; i ++) { |
+ for (int32_t i = 0; i < block_size; i ++) { |
FX_DWORD objnum = start_objnum + block * 1024 + i; |
char* pEntry = pBuf + i * recordsize; |
if (pEntry[17] == 'f') { |
@@ -560,7 +560,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B |
} |
if (bFirstBlock) { |
FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); |
- FX_INT32 version = FXSYS_atoi(pEntry + 11); |
+ int32_t version = FXSYS_atoi(pEntry + 11); |
if (offset == 0 && version == 65535 && start_objnum != 0) { |
start_objnum--; |
objnum = 0; |
@@ -571,7 +571,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B |
} else { |
FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); |
if (offset == 0) { |
- for (FX_INT32 c = 0; c < 10; c ++) { |
+ for (int32_t c = 0; c < 10; c ++) { |
if (pEntry[c] < '0' || pEntry[c] > '9') { |
FX_Free(pBuf); |
return FALSE; |
@@ -579,7 +579,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B |
} |
} |
m_CrossRef.SetAtGrow(objnum, offset); |
- FX_INT32 version = FXSYS_atoi(pEntry + 11); |
+ int32_t version = FXSYS_atoi(pEntry + 11); |
if (version >= 1) { |
m_bVersionUpdated = TRUE; |
} |
@@ -630,11 +630,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() |
m_pTrailer->Release(); |
m_pTrailer = NULL; |
} |
- FX_INT32 status = 0; |
- FX_INT32 inside_index = 0; |
+ int32_t status = 0; |
+ int32_t inside_index = 0; |
FX_DWORD objnum = 0, gennum = 0; |
- FX_INT32 depth = 0; |
- FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096); |
+ int32_t depth = 0; |
+ FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096); |
FX_FILESIZE pos = m_Syntax.m_HeaderOffset; |
FX_FILESIZE start_pos = 0, start_pos1 = 0; |
FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1; |
@@ -648,7 +648,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() |
break; |
} |
for (FX_DWORD i = 0; i < size; i ++) { |
- FX_BYTE byte = buffer[i]; |
+ uint8_t byte = buffer[i]; |
switch (status) { |
case 0: |
if (PDF_CharType[byte] == 'W') { |
@@ -822,11 +822,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() |
} else { |
i += (FX_DWORD)nLen; |
} |
- if (m_CrossRef.GetSize() > (FX_INT32)objnum && m_CrossRef[objnum]) { |
+ if (m_CrossRef.GetSize() > (int32_t)objnum && m_CrossRef[objnum]) { |
if (pObject) { |
FX_DWORD oldgen = m_ObjVersion.GetAt(objnum); |
m_CrossRef[objnum] = obj_pos; |
- m_ObjVersion.SetAt(objnum, (FX_SHORT)gennum); |
+ m_ObjVersion.SetAt(objnum, (int16_t)gennum); |
if (oldgen != gennum) { |
m_bVersionUpdated = TRUE; |
} |
@@ -834,7 +834,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() |
} else { |
m_CrossRef.SetAtGrow(objnum, obj_pos); |
m_V5Type.SetAtGrow(objnum, 1); |
- m_ObjVersion.SetAtGrow(objnum, (FX_SHORT)gennum); |
+ m_ObjVersion.SetAtGrow(objnum, (int16_t)gennum); |
} |
if (pObject) { |
pObject->Release(); |
@@ -990,10 +990,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() |
FX_Free(buffer); |
return TRUE; |
} |
-static FX_DWORD _GetVarInt(FX_LPCBYTE p, FX_INT32 n) |
+static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n) |
{ |
FX_DWORD result = 0; |
- for (FX_INT32 i = 0; i < n; i ++) { |
+ for (int32_t i = 0; i < n; i ++) { |
result = result * 256 + p[i]; |
} |
return result; |
@@ -1019,7 +1019,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL |
return FALSE; |
} |
prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); |
- FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); |
+ int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); |
if (size < 0) { |
pStream->Release(); |
return FALSE; |
@@ -1033,7 +1033,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL |
} else { |
m_Trailers.Add((CPDF_Dictionary*)pStream->GetDict()->Clone()); |
} |
- std::vector<std::pair<FX_INT32, FX_INT32> > arrIndex; |
+ std::vector<std::pair<int32_t, int32_t> > arrIndex; |
CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); |
if (pArray) { |
FX_DWORD nPairSize = pArray->GetCount() / 2; |
@@ -1075,12 +1075,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL |
FX_DWORD dwTotalSize = acc.GetSize(); |
FX_DWORD segindex = 0; |
for (FX_DWORD i = 0; i < arrIndex.size(); i ++) { |
- FX_INT32 startnum = arrIndex[i].first; |
+ int32_t startnum = arrIndex[i].first; |
if (startnum < 0) { |
continue; |
} |
- m_dwXrefStartObjNum = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (startnum); |
- FX_DWORD count = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (arrIndex[i].second); |
+ m_dwXrefStartObjNum = pdfium::base::checked_cast<FX_DWORD, int32_t> (startnum); |
+ FX_DWORD count = pdfium::base::checked_cast<FX_DWORD, int32_t> (arrIndex[i].second); |
FX_SAFE_DWORD dwCaculatedSize = segindex; |
dwCaculatedSize += count; |
dwCaculatedSize *= totalWidth; |
@@ -1090,12 +1090,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL |
FX_LPCBYTE segstart = pData + segindex * totalWidth; |
FX_SAFE_DWORD dwMaxObjNum = startnum; |
dwMaxObjNum += count; |
- FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (m_V5Type.GetSize()); |
+ FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, int32_t> (m_V5Type.GetSize()); |
if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) { |
continue; |
} |
for (FX_DWORD j = 0; j < count; j ++) { |
- FX_INT32 type = 1; |
+ int32_t type = 1; |
FX_LPCBYTE entrystart = segstart + j * totalWidth; |
if (WidthArray[0]) { |
type = _GetVarInt(entrystart, WidthArray[0]); |
@@ -1212,8 +1212,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX |
if (pObjStream == NULL) { |
return NULL; |
} |
- FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); |
- FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); |
+ 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((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); |
syntax.InitParser(file.Get(), 0); |
@@ -1235,7 +1235,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX |
CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) |
{ |
CPDF_StreamAcc* pStreamAcc = NULL; |
- if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) { |
+ if (m_ObjectStreamMap.Lookup((void*)(uintptr_t)objnum, (void*&)pStreamAcc)) { |
return pStreamAcc; |
} |
const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum) : NULL; |
@@ -1244,7 +1244,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) |
} |
pStreamAcc = new CPDF_StreamAcc; |
pStreamAcc->LoadAllData(pStream); |
- m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc); |
+ m_ObjectStreamMap.SetAt((void*)(uintptr_t)objnum, pStreamAcc); |
return pStreamAcc; |
} |
FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) |
@@ -1283,8 +1283,8 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR |
if (pObjStream == NULL) { |
return; |
} |
- FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); |
- FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); |
+ int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); |
+ int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); |
CPDF_SyntaxParser syntax; |
FX_LPCBYTE pData = pObjStream->GetData(); |
FX_DWORD totalsize = pObjStream->GetSize(); |
@@ -1301,7 +1301,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR |
FX_DWORD nextoff = syntax.GetDirectNum(); |
size = nextoff - thisoff; |
} |
- pBuffer = FX_Alloc(FX_BYTE, size); |
+ pBuffer = FX_Alloc(uint8_t, size); |
FXSYS_memcpy32(pBuffer, pData + thisoff + offset, size); |
return; |
} |
@@ -1368,7 +1368,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR |
nextoff = m_Syntax.SavePos(); |
} |
size = (FX_DWORD)(nextoff - pos); |
- pBuffer = FX_Alloc(FX_BYTE, size); |
+ pBuffer = FX_Alloc(uint8_t, size); |
m_Syntax.RestorePos(pos); |
m_Syntax.ReadBlock(pBuffer, size); |
m_Syntax.RestorePos(SavedPos); |
@@ -1553,7 +1553,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse |
m_bXRefStream = FALSE; |
m_LastXRefOffset = 0; |
m_bOwnFileRead = bOwnFileRead; |
- FX_INT32 offset = GetHeaderOffset(pFileAccess); |
+ int32_t offset = GetHeaderOffset(pFileAccess); |
if (offset == -1) { |
return PDFPARSE_ERROR_FORMAT; |
} |
@@ -1579,7 +1579,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse |
if (m_pTrailer == NULL) { |
return FALSE; |
} |
- FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); |
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); |
if (xrefsize > 0) { |
m_CrossRef.SetSize(xrefsize); |
m_V5Type.SetSize(xrefsize); |
@@ -1651,10 +1651,10 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() |
m_pTrailer = NULL; |
} |
m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset); |
- FX_BYTE ch = 0; |
+ uint8_t ch = 0; |
FX_DWORD dwCount = 0; |
m_Syntax.GetNextChar(ch); |
- FX_INT32 type = PDF_CharType[ch]; |
+ int32_t type = PDF_CharType[ch]; |
while (type == 'W') { |
++dwCount; |
if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_HeaderOffset)) { |
@@ -1702,7 +1702,7 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser() |
FX_Free(m_pFileBuf); |
} |
} |
-FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) |
+FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) |
{ |
FX_FILESIZE save_pos = m_Pos; |
m_Pos = pos; |
@@ -1710,7 +1710,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) |
m_Pos = save_pos; |
return ret; |
} |
-FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) |
+FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) |
{ |
FX_FILESIZE pos = m_Pos + m_HeaderOffset; |
if (pos >= m_FileLen) { |
@@ -1739,7 +1739,7 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) |
m_Pos ++; |
return TRUE; |
} |
-FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch) |
+FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) |
{ |
pos += m_HeaderOffset; |
if (pos >= m_FileLen) { |
@@ -1782,11 +1782,11 @@ void CPDF_SyntaxParser::GetNextWord() |
{ |
m_WordSize = 0; |
m_bIsNumber = TRUE; |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!GetNextChar(ch)) { |
return; |
} |
- FX_BYTE type = PDF_CharType[ch]; |
+ uint8_t type = PDF_CharType[ch]; |
while (1) { |
while (type == 'W') { |
if (!GetNextChar(ch)) { |
@@ -1864,13 +1864,13 @@ void CPDF_SyntaxParser::GetNextWord() |
} |
CFX_ByteString CPDF_SyntaxParser::ReadString() |
{ |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!GetNextChar(ch)) { |
return CFX_ByteString(); |
} |
CFX_ByteTextBuf buf; |
- FX_INT32 parlevel = 0; |
- FX_INT32 status = 0, iEscCode = 0; |
+ int32_t parlevel = 0; |
+ int32_t status = 0, iEscCode = 0; |
while (1) { |
switch (status) { |
case 0: |
@@ -1951,13 +1951,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() |
} |
CFX_ByteString CPDF_SyntaxParser::ReadHexString() |
{ |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!GetNextChar(ch)) { |
return CFX_ByteString(); |
} |
CFX_BinaryBuf buf; |
FX_BOOL bFirst = TRUE; |
- FX_BYTE code = 0; |
+ uint8_t code = 0; |
while (1) { |
if (ch == '>') { |
break; |
@@ -1967,7 +1967,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() |
code = (ch - '0') * 16; |
} else { |
code += ch - '0'; |
- buf.AppendByte((FX_BYTE)code); |
+ buf.AppendByte((uint8_t)code); |
} |
bFirst = !bFirst; |
} else if (ch >= 'A' && ch <= 'F') { |
@@ -1975,7 +1975,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() |
code = (ch - 'A' + 10) * 16; |
} else { |
code += ch - 'A' + 10; |
- buf.AppendByte((FX_BYTE)code); |
+ buf.AppendByte((uint8_t)code); |
} |
bFirst = !bFirst; |
} else if (ch >= 'a' && ch <= 'f') { |
@@ -1983,7 +1983,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() |
code = (ch - 'a' + 10) * 16; |
} else { |
code += ch - 'a' + 10; |
- buf.AppendByte((FX_BYTE)code); |
+ buf.AppendByte((uint8_t)code); |
} |
bFirst = !bFirst; |
} |
@@ -1992,13 +1992,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() |
} |
} |
if (!bFirst) { |
- buf.AppendByte((FX_BYTE)code); |
+ buf.AppendByte((uint8_t)code); |
} |
return buf.GetByteString(); |
} |
void CPDF_SyntaxParser::ToNextLine() |
{ |
- FX_BYTE ch; |
+ uint8_t ch; |
while (1) { |
if (!GetNextChar(ch)) { |
return; |
@@ -2019,11 +2019,11 @@ void CPDF_SyntaxParser::ToNextLine() |
} |
void CPDF_SyntaxParser::ToNextWord() |
{ |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!GetNextChar(ch)) { |
return; |
} |
- FX_BYTE type = PDF_CharType[ch]; |
+ uint8_t type = PDF_CharType[ch]; |
while (1) { |
while (type == 'W') { |
m_dwWordPos = m_Pos; |
@@ -2168,7 +2168,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO |
pContext->m_DictStart = SavedPos; |
} |
CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); |
- FX_INT32 nKeys = 0; |
+ int32_t nKeys = 0; |
FX_FILESIZE dwSignValuePos = 0; |
while (1) { |
FX_BOOL bIsNumber; |
@@ -2377,7 +2377,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList |
if (pDict) { |
pDict->Release(); |
} |
- FX_BYTE ch; |
+ uint8_t ch; |
while (1) { |
if (!GetNextChar(ch)) { |
break; |
@@ -2461,7 +2461,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT |
} else { |
m_Pos = curPos; |
} |
- FX_BYTE byte1, byte2; |
+ uint8_t byte1, byte2; |
GetCharAt(StreamStartPos + offset - 1, byte1); |
GetCharAt(StreamStartPos + offset - 2, byte2); |
if (byte1 == 0x0a && byte2 == 0x0d) { |
@@ -2481,7 +2481,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT |
m_Pos = StreamStartPos; |
} |
CPDF_Stream* pStream; |
- FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); |
+ FX_LPBYTE pData = FX_Alloc(uint8_t, len); |
ReadBlock(pData, len); |
if (pCryptoHandler) { |
CFX_BinaryBuf dest_buf; |
@@ -2511,7 +2511,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff |
FX_Free(m_pFileBuf); |
m_pFileBuf = NULL; |
} |
- m_pFileBuf = FX_Alloc(FX_BYTE, m_BufSize); |
+ m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); |
m_HeaderOffset = HeaderOffset; |
m_FileLen = pFileAccess->GetSize(); |
m_Pos = 0; |
@@ -2519,7 +2519,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff |
m_BufOffset = 0; |
pFileAccess->ReadBlock(m_pFileBuf, 0, (size_t)((FX_FILESIZE)m_BufSize > m_FileLen ? m_FileLen : m_BufSize)); |
} |
-FX_INT32 CPDF_SyntaxParser::GetDirectNum() |
+int32_t CPDF_SyntaxParser::GetDirectNum() |
{ |
GetNextWord(); |
if (!m_bIsNumber) { |
@@ -2530,19 +2530,19 @@ FX_INT32 CPDF_SyntaxParser::GetDirectNum() |
} |
FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen) |
{ |
- FX_BYTE type = PDF_CharType[tag[0]]; |
+ uint8_t type = PDF_CharType[tag[0]]; |
FX_BOOL bCheckLeft = type != 'D' && type != 'W'; |
type = PDF_CharType[tag[taglen - 1]]; |
FX_BOOL bCheckRight = type != 'D' && type != 'W'; |
- FX_BYTE ch; |
- if (bCheckRight && startpos + (FX_INT32)taglen <= limit && GetCharAt(startpos + (FX_INT32)taglen, ch)) { |
- FX_BYTE type = PDF_CharType[ch]; |
+ 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; |
} |
} |
if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) { |
- FX_BYTE type = PDF_CharType[ch]; |
+ uint8_t type = PDF_CharType[ch]; |
if (type == 'N' || type == 'R') { |
return FALSE; |
} |
@@ -2551,17 +2551,17 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, |
} |
FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit) |
{ |
- FX_INT32 taglen = tag.GetLength(); |
+ int32_t taglen = tag.GetLength(); |
if (taglen == 0) { |
return FALSE; |
} |
FX_FILESIZE pos = m_Pos; |
- FX_INT32 offset = 0; |
+ int32_t offset = 0; |
if (!bForward) { |
offset = taglen - 1; |
} |
FX_LPCBYTE tag_data = tag.GetPtr(); |
- FX_BYTE byte; |
+ uint8_t byte; |
while (1) { |
if (bForward) { |
if (limit) { |
@@ -2620,9 +2620,9 @@ struct _SearchTagRecord { |
FX_DWORD m_Len; |
FX_DWORD m_Offset; |
}; |
-FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) |
+int32_t CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) |
{ |
- FX_INT32 ntags = 1, i; |
+ int32_t ntags = 1, i; |
for (i = 0; i < tags.GetLength(); i ++) |
if (tags[i] == 0) { |
ntags ++; |
@@ -2643,9 +2643,9 @@ FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX |
} |
} |
FX_FILESIZE pos = m_Pos; |
- FX_BYTE byte; |
+ uint8_t byte; |
GetCharAt(pos++, byte); |
- FX_INT32 found = -1; |
+ int32_t found = -1; |
while (1) { |
for (i = 0; i < ntags; i ++) { |
if (pPatterns[i].m_pTag[pPatterns[i].m_Offset] == byte) { |
@@ -2684,12 +2684,12 @@ end: |
} |
FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) |
{ |
- FX_INT32 taglen = tag.GetLength(); |
- FX_INT32 match = 0; |
+ int32_t taglen = tag.GetLength(); |
+ int32_t match = 0; |
limit += m_Pos; |
FX_FILESIZE startpos = m_Pos; |
while (1) { |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!GetNextChar(ch)) { |
return -1; |
} |
@@ -2707,10 +2707,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) |
} |
return -1; |
} |
-void CPDF_SyntaxParser::GetBinary(FX_BYTE* buffer, FX_DWORD size) |
+void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size) |
{ |
FX_DWORD offset = 0; |
- FX_BYTE ch; |
+ uint8_t ch; |
while (1) { |
if (!GetNextChar(ch)) { |
return; |
@@ -2734,9 +2734,9 @@ public: |
virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override; |
- virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) override; |
+ virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override; |
- virtual FX_INT32 IsLinearizedPDF() override; |
+ virtual int32_t IsLinearizedPDF() override; |
virtual FX_BOOL IsLinearized() override |
{ |
@@ -2770,11 +2770,11 @@ protected: |
FX_BOOL CheckPageStatus(IFX_DownloadHints* pHints); |
FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints); |
- FX_INT32 CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); |
+ int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); |
FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen); |
void SetStartOffset(FX_FILESIZE dwOffset); |
FX_BOOL GetNextToken(CFX_ByteString &token); |
- FX_BOOL GetNextChar(FX_BYTE &ch); |
+ FX_BOOL GetNextChar(uint8_t &ch); |
CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum); |
CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile); |
FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages); |
@@ -2788,10 +2788,10 @@ protected: |
FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints); |
FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pDict); |
- FX_BOOL CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints); |
+ FX_BOOL CheckPage(int32_t iPage, IFX_DownloadHints* pHints); |
FX_BOOL LoadDocPages(IFX_DownloadHints* pHints); |
- FX_BOOL LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints); |
- FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, 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); |
@@ -2842,11 +2842,11 @@ protected: |
CFX_ByteString m_WordBuf; |
- FX_BYTE m_WordBuffer[257]; |
+ uint8_t m_WordBuffer[257]; |
FX_DWORD m_WordSize; |
- FX_BYTE m_bufferData[512]; |
+ uint8_t m_bufferData[512]; |
CFX_FileSizeArray m_CrossOffset; |
@@ -2994,8 +2994,8 @@ CPDF_DataAvail::~CPDF_DataAvail() |
if (m_pagesLoadState) { |
delete m_pagesLoadState; |
} |
- FX_INT32 i = 0; |
- FX_INT32 iSize = m_arrayAcroforms.GetSize(); |
+ int32_t i = 0; |
+ int32_t iSize = m_arrayAcroforms.GetSize(); |
for (i = 0; i < iSize; ++i) { |
((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); |
} |
@@ -3039,13 +3039,13 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa |
} |
FX_DWORD count = 0; |
CFX_PtrArray new_obj_array; |
- FX_INT32 i = 0; |
+ int32_t i = 0; |
for (i = 0; i < obj_array.GetSize(); i++) { |
CPDF_Object *pObj = (CPDF_Object *)obj_array[i]; |
if (!pObj) { |
continue; |
} |
- FX_INT32 type = pObj->GetType(); |
+ int32_t type = pObj->GetType(); |
switch (type) { |
case PDFOBJ_ARRAY: { |
CPDF_Array *pArray = pObj->GetArray(); |
@@ -3111,10 +3111,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa |
} |
} |
if (count > 0) { |
- FX_INT32 iSize = new_obj_array.GetSize(); |
+ int32_t iSize = new_obj_array.GetSize(); |
for (i = 0; i < iSize; ++i) { |
CPDF_Object *pObj = (CPDF_Object *)new_obj_array[i]; |
- FX_INT32 type = pObj->GetType(); |
+ int32_t type = pObj->GetType(); |
if (type == PDFOBJ_REFERENCE) { |
CPDF_Reference *pRef = (CPDF_Reference *)pObj; |
FX_DWORD dwNum = pRef->GetRefObjNum(); |
@@ -3162,8 +3162,8 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) |
CFX_PtrArray new_objs_array; |
FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); |
if (bRet) { |
- FX_INT32 iSize = m_arrayAcroforms.GetSize(); |
- for (FX_INT32 i = 0; i < iSize; ++i) { |
+ int32_t iSize = m_arrayAcroforms.GetSize(); |
+ for (int32_t i = 0; i < iSize; ++i) { |
((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); |
} |
m_arrayAcroforms.RemoveAll(); |
@@ -3475,9 +3475,9 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) |
if (pObj->GetType() == PDFOBJ_ARRAY) { |
CPDF_Array *pArray = pObj->GetArray(); |
if (pArray) { |
- FX_INT32 iSize = pArray->GetCount(); |
+ int32_t iSize = pArray->GetCount(); |
CPDF_Object *pItem = NULL; |
- for (FX_INT32 j = 0; j < iSize; ++j) { |
+ for (int32_t j = 0; j < iSize; ++j) { |
pItem = pArray->GetElement(j); |
if (pItem && pItem->GetType() == PDFOBJ_REFERENCE) { |
UnavailObjList.Add(((CPDF_Reference *)pItem)->GetRefObjNum()); |
@@ -3589,7 +3589,7 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints) |
req_size = (FX_DWORD)m_dwFileLen; |
} |
if (m_pFileAvail->IsDataAvail(0, req_size)) { |
- FX_BYTE buffer[1024]; |
+ uint8_t buffer[1024]; |
m_pFileRead->ReadBlock(buffer, 0, req_size); |
if (IsLinearizedFile(buffer, req_size)) { |
m_docStatus = PDF_DATAAVAIL_FIRSTPAGE; |
@@ -3629,8 +3629,8 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints) |
if ((FX_FILESIZE)dwEnd > m_dwFileLen) { |
dwEnd = (FX_DWORD)m_dwFileLen; |
} |
- FX_INT32 iStartPos = (FX_INT32)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); |
- FX_INT32 iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; |
+ int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); |
+ int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; |
if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) { |
pHints->AddSegment(iStartPos, iSize); |
bNeedDownLoad = TRUE; |
@@ -3690,7 +3690,7 @@ CPDF_Object * CPDF_DataAvail::ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD ob |
m_syntaxParser.RestorePos(SavedPos); |
return pObj; |
} |
-FX_INT32 CPDF_DataAvail::IsLinearizedPDF() |
+int32_t CPDF_DataAvail::IsLinearizedPDF() |
{ |
FX_DWORD req_size = 1024; |
if (!m_pFileAvail->IsDataAvail(0, req_size)) { |
@@ -3703,7 +3703,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() |
if (dwSize < (FX_FILESIZE)req_size) { |
return PDF_UNKNOW_LINEARIZED; |
} |
- FX_BYTE buffer[1024]; |
+ uint8_t buffer[1024]; |
m_pFileRead->ReadBlock(buffer, 0, req_size); |
if (IsLinearizedFile(buffer, req_size)) { |
return PDF_IS_LINEARIZED; |
@@ -3713,7 +3713,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() |
FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen) |
{ |
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); |
- FX_INT32 offset = GetHeaderOffset(file.Get()); |
+ int32_t offset = GetHeaderOffset(file.Get()); |
if (offset == -1) { |
m_docStatus = PDF_DATAAVAIL_ERROR; |
return FALSE; |
@@ -3757,7 +3757,7 @@ 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)) { |
- FX_BYTE buffer[1024]; |
+ uint8_t buffer[1024]; |
m_pFileRead->ReadBlock(buffer, req_pos, dwSize); |
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE)); |
m_syntaxParser.InitParser(file.Get(), 0); |
@@ -3787,12 +3787,12 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) |
pHints->AddSegment(req_pos, dwSize); |
return FALSE; |
} |
-FX_INT32 CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) |
+int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) |
{ |
xref_offset = 0; |
FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { |
- FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam); |
+ int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); |
CFX_BinaryBuf buf(iSize); |
FX_LPBYTE pBuf = buf.GetBuffer(); |
m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); |
@@ -3836,11 +3836,11 @@ inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) |
FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) |
{ |
m_WordSize = 0; |
- FX_BYTE ch; |
+ uint8_t ch; |
if (!GetNextChar(ch)) { |
return FALSE; |
} |
- FX_BYTE type = PDF_CharType[ch]; |
+ uint8_t type = PDF_CharType[ch]; |
while (1) { |
while (type == 'W') { |
if (!GetNextChar(ch)) { |
@@ -3919,7 +3919,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) |
token = ret; |
return TRUE; |
} |
-FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) |
+FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch) |
{ |
FX_FILESIZE pos = m_Pos; |
if (pos >= m_dwFileLen) { |
@@ -3946,11 +3946,11 @@ FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) |
} |
FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) |
{ |
- FX_INT32 iSize = 0; |
+ int32_t iSize = 0; |
CFX_ByteString token; |
while (1) { |
if (!GetNextToken(token)) { |
- iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
+ iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
pHints->AddSegment(m_Pos, iSize); |
return FALSE; |
} |
@@ -3964,7 +3964,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) |
FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) |
{ |
FX_FILESIZE xref_offset = 0; |
- FX_INT32 nRet = CheckCrossRefStream(pHints, xref_offset); |
+ int32_t nRet = CheckCrossRefStream(pHints, xref_offset); |
if (nRet == 1) { |
if (!xref_offset) { |
m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF; |
@@ -3980,10 +3980,10 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) |
} |
FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) |
{ |
- FX_INT32 iSize = 0; |
+ int32_t iSize = 0; |
CFX_ByteString token; |
if (!GetNextToken(token)) { |
- iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
+ iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
pHints->AddSegment(m_Pos, iSize); |
return FALSE; |
} |
@@ -3991,7 +3991,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) |
m_CrossOffset.InsertAt(0, m_dwXRefOffset); |
while (1) { |
if (!GetNextToken(token)) { |
- iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
+ 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; |
@@ -4012,7 +4012,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) |
{ |
if (m_Pos < m_dwFileLen) { |
FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos(); |
- FX_INT32 iSize = (FX_INT32)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); |
+ 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; |
@@ -4028,9 +4028,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) |
} |
FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) |
{ |
- FX_INT32 iTrailerSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
+ int32_t iTrailerSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); |
if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) { |
- FX_INT32 iSize = (FX_INT32)(m_Pos + iTrailerSize - m_dwTrailerOffset); |
+ int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset); |
CFX_BinaryBuf buf(iSize); |
FX_LPBYTE pBuf = buf.GetBuffer(); |
if (!pBuf) { |
@@ -4086,7 +4086,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) |
pHints->AddSegment(m_Pos, iTrailerSize); |
return FALSE; |
} |
-FX_BOOL CPDF_DataAvail::CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints) |
+FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints) |
{ |
while (TRUE) { |
switch (m_docStatus) { |
@@ -4215,14 +4215,14 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP |
pPage->Release(); |
return TRUE; |
} |
-FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints) |
+FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints) |
{ |
- FX_INT32 iSize = pageNodes.m_childNode.GetSize(); |
+ int32_t iSize = pageNodes.m_childNode.GetSize(); |
if (iSize <= 0 || iPage >= iSize) { |
m_docStatus = PDF_DATAAVAIL_ERROR; |
return FALSE; |
} |
- for (FX_INT32 i = 0; i < iSize; ++i) { |
+ for (int32_t i = 0; i < iSize; ++i) { |
CPDF_PageNode *pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i); |
if (!pNode) { |
continue; |
@@ -4259,7 +4259,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, |
} |
return TRUE; |
} |
-FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 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; |
@@ -4273,7 +4273,7 @@ FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) |
m_docStatus = PDF_DATAAVAIL_ERROR; |
return TRUE; |
} |
- FX_INT32 iCount = -1; |
+ int32_t iCount = -1; |
return CheckPageNode(m_pageNodes, iPage, iCount, pHints); |
} |
FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints) |
@@ -4361,7 +4361,7 @@ FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints) |
return m_bLinearedDataOK; |
} |
-FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHints) |
+FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints) |
{ |
if (!m_objs_array.GetSize()) { |
m_objs_array.RemoveAll(); |
@@ -4391,7 +4391,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint |
return bRet; |
} |
} |
-FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(FX_INT32 iPage, IFX_DownloadHints* pHints) |
+FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints) |
{ |
if (!m_bAnnotsLoad) { |
if (!CheckPageAnnots(iPage, pHints)) { |
@@ -4427,7 +4427,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict) |
} |
return HaveResourceAncestor(pParentDict); |
} |
-FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) |
+FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) |
{ |
if (!m_pDocument) { |
return FALSE; |
@@ -4576,7 +4576,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSiz |
*pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset); |
} |
} |
-FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) |
+int32_t CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) |
{ |
if (!m_pDocument) { |
return PDFFORM_AVAIL; |
@@ -4609,7 +4609,7 @@ FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) |
} |
void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) |
{ |
- FX_INT32 iNext = 0; |
+ int32_t iNext = 0; |
if (BinarySearch(dwObjNum, iNext)) { |
return; |
} |
@@ -4617,15 +4617,15 @@ void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) |
} |
FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum) |
{ |
- FX_INT32 iNext = 0; |
+ int32_t iNext = 0; |
return BinarySearch(dwObjNum, iNext); |
} |
-FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) |
+FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext) |
{ |
- FX_INT32 iLen = m_number_array.GetSize(); |
- FX_INT32 iLow = 0; |
- FX_INT32 iHigh = iLen - 1; |
- FX_INT32 iMid = 0; |
+ int32_t iLen = m_number_array.GetSize(); |
+ int32_t iLow = 0; |
+ int32_t iHigh = iLen - 1; |
+ int32_t iMid = 0; |
while (iLow <= iHigh) { |
iMid = (iLow + iHigh) / 2; |
if (m_number_array.GetAt(iMid) == value) { |
@@ -4642,8 +4642,8 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) |
} |
CPDF_PageNode::~CPDF_PageNode() |
{ |
- FX_INT32 iSize = m_childNode.GetSize(); |
- for (FX_INT32 i = 0; i < iSize; ++i) { |
+ int32_t iSize = m_childNode.GetSize(); |
+ for (int32_t i = 0; i < iSize; ++i) { |
CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
if (pNode) { |
delete pNode; |