summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h3
-rw-r--r--core/include/fpdfapi/fpdf_parser.h20
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp18
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp90
7 files changed, 48 insertions, 99 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index 83b39e2986..d0617e01ab 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -29,7 +29,6 @@ class CPDF_StreamAcc;
class CPDF_StreamFilter;
class CPDF_String;
class IFX_FileRead;
-struct PARSE_CONTEXT;
#define PDFOBJ_INVALID 0
#define PDFOBJ_BOOLEAN 1
@@ -567,7 +566,7 @@ class CPDF_IndirectObjectHolder {
explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser);
~CPDF_IndirectObjectHolder();
- CPDF_Object* GetIndirectObject(FX_DWORD objnum, PARSE_CONTEXT* pContext);
+ CPDF_Object* GetIndirectObject(FX_DWORD objnum);
FX_DWORD AddIndirectObject(CPDF_Object* pObj);
void ReleaseIndirectObject(FX_DWORD objnum);
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 8b4472eb5d..a12a867062 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -261,13 +261,11 @@ class CPDF_SyntaxParser {
CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
FX_DWORD objnum,
FX_DWORD gennum,
- PARSE_CONTEXT* pContext,
FX_BOOL bDecrypt);
CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList,
FX_DWORD objnum,
- FX_DWORD gennum,
- PARSE_CONTEXT* pContext);
+ FX_DWORD gennum);
int GetDirectNum();
@@ -332,7 +330,6 @@ class CPDF_SyntaxParser {
unsigned int ReadEOLMarkers(FX_FILESIZE pos);
CPDF_Stream* ReadStream(CPDF_Dictionary* pDict,
- PARSE_CONTEXT* pContext,
FX_DWORD objnum,
FX_DWORD gennum);
@@ -363,13 +360,6 @@ class CPDF_SyntaxParser {
FX_FILESIZE m_dwWordPos;
};
-struct PARSE_CONTEXT {
- FX_FILESIZE m_DictStart;
- FX_FILESIZE m_DictEnd;
- FX_FILESIZE m_DataStart;
- FX_FILESIZE m_DataEnd;
-};
-
#define PDFPARSE_ERROR_SUCCESS 0
#define PDFPARSE_ERROR_FILE 1
#define PDFPARSE_ERROR_FORMAT 2
@@ -416,8 +406,8 @@ class CPDF_Parser {
CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; }
CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- PARSE_CONTEXT* pContext = NULL);
+ FX_DWORD objnum);
+
FX_DWORD GetLastObjNum() const;
bool IsValidObjectNumber(FX_DWORD objnum) const;
FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm);
@@ -435,14 +425,12 @@ class CPDF_Parser {
FX_BOOL IsXRefStream() const { return m_bXRefStream; }
CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum,
- PARSE_CONTEXT* pContext);
+ FX_DWORD objnum);
CPDF_Object* ParseIndirectObjectAtByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
FX_DWORD objnum,
- PARSE_CONTEXT* pContext,
FX_FILESIZE* pResultPos);
FX_DWORD StartAsynParse(IFX_FileRead* pFile,
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 1ffcfbf0a3..f8e7cb86c3 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -1290,7 +1290,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
(m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream;
if (m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap ||
bObjStm) {
- CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum, nullptr);
+ CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
if (!pObj) {
m_ObjectOffset[objnum] = 0;
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 fa69d6e556..6bb30c085a 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -71,8 +71,7 @@ CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() {
}
void CPDF_Document::LoadDoc() {
m_LastObjNum = m_pParser->GetLastObjNum();
- CPDF_Object* pRootObj =
- GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
+ CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum());
if (!pRootObj) {
return;
}
@@ -80,8 +79,7 @@ void CPDF_Document::LoadDoc() {
if (!m_pRootDict) {
return;
}
- CPDF_Object* pInfoObj =
- GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr);
+ CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum());
if (pInfoObj) {
m_pInfoDict = pInfoObj->GetDict();
}
@@ -95,13 +93,12 @@ void CPDF_Document::LoadDoc() {
void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_bLinearized = TRUE;
m_LastObjNum = m_pParser->GetLastObjNum();
- CPDF_Object* pIndirectObj =
- GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
+ CPDF_Object* pIndirectObj = GetIndirectObject(m_pParser->GetRootObjNum());
m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
if (!m_pRootDict) {
return;
}
- pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr);
+ pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum());
m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
CPDF_Array* pIDArray = m_pParser->GetIDArray();
if (pIDArray) {
@@ -182,16 +179,15 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) {
if (CPDF_Dictionary* pDict =
- ToDictionary(GetIndirectObject(m_dwFirstPageObjNum, nullptr)))
+ ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) {
return pDict;
+ }
}
int objnum = m_PageList.GetAt(iPage);
if (objnum) {
- if (CPDF_Dictionary* pDict =
- ToDictionary(GetIndirectObject(objnum, nullptr))) {
+ if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum)))
return pDict;
- }
}
CPDF_Dictionary* pRoot = GetRoot();
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index 5471449f14..137dbb622f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -60,7 +60,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
if (word != "obj") {
break;
}
- CPDF_Object* pObj = parser.GetObject(this, objnum, 0, nullptr, true);
+ CPDF_Object* pObj = parser.GetObject(this, objnum, 0, true);
if (!pObj) {
break;
}
@@ -74,7 +74,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
break;
}
if (CPDF_Dictionary* pMainDict =
- ToDictionary(parser.GetObject(this, 0, 0, nullptr, true))) {
+ ToDictionary(parser.GetObject(this, 0, 0, true))) {
m_pRootDict = pMainDict->GetDict("Root");
pMainDict->Release();
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index b925cf34e5..45f93d0afe 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -54,7 +54,7 @@ const CPDF_Object* CPDF_Object::GetBasicObject() const {
}
if (!pRef->m_pObjList)
return nullptr;
- return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum(), nullptr);
+ return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum());
}
CFX_ByteString CPDF_Object::GetString() const {
@@ -192,7 +192,7 @@ CPDF_Object* CPDF_Object::GetDirect() const {
return const_cast<CPDF_Object*>(this);
if (!pRef->m_pObjList)
return nullptr;
- return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum(), nullptr);
+ return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum());
}
CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const {
@@ -1028,9 +1028,7 @@ CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {
pair.second->Destroy();
}
}
-CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(
- FX_DWORD objnum,
- PARSE_CONTEXT* pContext) {
+CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) {
if (objnum == 0)
return nullptr;
@@ -1041,7 +1039,7 @@ CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(
if (!m_pParser)
return nullptr;
- CPDF_Object* pObj = m_pParser->ParseIndirectObject(this, objnum, pContext);
+ CPDF_Object* pObj = m_pParser->ParseIndirectObject(this, objnum);
if (!pObj)
return nullptr;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 0b93107e62..6cf8b7841e 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -296,8 +296,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() {
if (CPDF_Dictionary* pEncryptDict = pEncryptObj->AsDictionary()) {
SetEncryptDictionary(pEncryptDict);
} else if (CPDF_Reference* pRef = pEncryptObj->AsReference()) {
- pEncryptObj =
- m_pDocument->GetIndirectObject(pRef->GetRefObjNum(), nullptr);
+ pEncryptObj = m_pDocument->GetIndirectObject(pRef->GetRefObjNum());
if (pEncryptObj)
SetEncryptDictionary(pEncryptObj->GetDict());
}
@@ -789,7 +788,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
}
FX_FILESIZE obj_end = 0;
CPDF_Object* pObject = ParseIndirectObjectAtByStrict(
- m_pDocument, obj_pos, objnum, NULL, &obj_end);
+ m_pDocument, obj_pos, objnum, &obj_end);
if (CPDF_Stream* pStream = ToStream(pObject)) {
if (CPDF_Dictionary* pDict = pStream->GetDict()) {
if ((pDict->KeyExist("Type")) &&
@@ -849,8 +848,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (PDFCharIsWhitespace(byte) || PDFCharIsDelimiter(byte)) {
last_trailer = pos + i - 7;
m_Syntax.RestorePos(pos + i - m_Syntax.m_HeaderOffset);
- CPDF_Object* pObj =
- m_Syntax.GetObject(m_pDocument, 0, 0, nullptr, true);
+ CPDF_Object* pObj = m_Syntax.GetObject(m_pDocument, 0, 0, true);
if (pObj) {
if (!pObj->IsDictionary() && !pObj->AsStream()) {
pObj->Release();
@@ -998,7 +996,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
}
FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
- CPDF_Object* pObject = ParseIndirectObjectAt(m_pDocument, *pos, 0, nullptr);
+ CPDF_Object* pObject = ParseIndirectObjectAt(m_pDocument, *pos, 0);
if (!pObject)
return FALSE;
if (m_pDocument) {
@@ -1198,8 +1196,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
CPDF_Object* CPDF_Parser::ParseIndirectObject(
CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- PARSE_CONTEXT* pContext) {
+ FX_DWORD objnum) {
if (!IsValidObjectNumber(objnum))
return nullptr;
@@ -1212,7 +1209,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
FX_FILESIZE pos = m_ObjectInfo[objnum].pos;
if (pos <= 0)
return nullptr;
- return ParseIndirectObjectAt(pObjList, pos, objnum, pContext);
+ return ParseIndirectObjectAt(pObjList, pos, objnum);
}
if (m_V5Type[objnum] != 2)
return nullptr;
@@ -1241,7 +1238,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
return nullptr;
syntax.RestorePos(offset + it->second);
- return syntax.GetObject(pObjList, 0, 0, pContext, true);
+ return syntax.GetObject(pObjList, 0, 0, true);
}
CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) {
@@ -1249,8 +1246,10 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) {
if (it != m_ObjectStreamMap.end())
return it->second.get();
- const CPDF_Stream* pStream = ToStream(
- m_pDocument ? m_pDocument->GetIndirectObject(objnum, nullptr) : nullptr);
+ if (!m_pDocument)
+ return nullptr;
+
+ const CPDF_Stream* pStream = ToStream(m_pDocument->GetIndirectObject(objnum));
if (!pStream)
return nullptr;
@@ -1398,8 +1397,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum,
- PARSE_CONTEXT* pContext) {
+ FX_DWORD objnum) {
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
bool bIsNumber;
@@ -1425,8 +1423,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
m_Syntax.RestorePos(SavedPos);
return NULL;
}
- CPDF_Object* pObj =
- m_Syntax.GetObject(pObjList, objnum, parser_gennum, pContext, true);
+ CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, parser_gennum, true);
m_Syntax.SavePos();
CFX_ByteString bsWord = m_Syntax.GetKeyword();
if (bsWord == "endobj") {
@@ -1444,7 +1441,6 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
FX_DWORD objnum,
- PARSE_CONTEXT* pContext,
FX_FILESIZE* pResultPos) {
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
@@ -1469,8 +1465,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
m_Syntax.RestorePos(SavedPos);
return NULL;
}
- CPDF_Object* pObj =
- m_Syntax.GetObjectByStrict(pObjList, objnum, gennum, pContext);
+ CPDF_Object* pObj = m_Syntax.GetObjectByStrict(pObjList, objnum, gennum);
if (pResultPos) {
*pResultPos = m_Syntax.m_Pos;
}
@@ -1483,7 +1478,7 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() {
return nullptr;
std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj(
- m_Syntax.GetObject(m_pDocument, 0, 0, nullptr, true));
+ m_Syntax.GetObject(m_pDocument, 0, 0, true));
if (!ToDictionary(pObj.get()))
return nullptr;
return pObj.release()->AsDictionary();
@@ -1536,7 +1531,7 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
m_Syntax.RestorePos(SavedPos);
return FALSE;
}
- m_pLinearized = m_Syntax.GetObject(nullptr, objnum, gennum, nullptr, true);
+ m_pLinearized = m_Syntax.GetObject(nullptr, objnum, gennum, true);
if (!m_pLinearized) {
return FALSE;
}
@@ -2036,7 +2031,6 @@ CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
FX_DWORD objnum,
FX_DWORD gennum,
- PARSE_CONTEXT* pContext,
FX_BOOL bDecrypt) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
@@ -2083,8 +2077,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
}
if (word == "[") {
CPDF_Array* pArray = new CPDF_Array;
- while (CPDF_Object* pObj =
- GetObject(pObjList, objnum, gennum, nullptr, true)) {
+ while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, true)) {
pArray->Add(pObj);
}
return pArray;
@@ -2094,9 +2087,6 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
- if (pContext)
- pContext->m_DictStart = SavedPos;
-
int32_t nKeys = 0;
FX_FILESIZE dwSignValuePos = 0;
std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
@@ -2125,7 +2115,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
if (key == "/Contents")
dwSignValuePos = m_Pos;
- CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, nullptr, true);
+ CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, true);
if (!pObj)
continue;
@@ -2138,11 +2128,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
if (IsSignatureDict(pDict.get()) && dwSignValuePos) {
CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = dwSignValuePos;
- CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, nullptr, FALSE);
- pDict->SetAt("Contents", pObj);
- }
- if (pContext) {
- pContext->m_DictEnd = m_Pos;
+ pDict->SetAt("Contents", GetObject(pObjList, objnum, gennum, false));
}
FX_FILESIZE SavedPos = m_Pos;
CFX_ByteString nextword = GetNextWord(nullptr);
@@ -2150,7 +2136,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
m_Pos = SavedPos;
return pDict.release();
}
- return ReadStream(pDict.release(), pContext, objnum, gennum);
+ return ReadStream(pDict.release(), objnum, gennum);
}
if (word == ">>") {
m_Pos = SavedPos;
@@ -2161,8 +2147,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_DWORD objnum,
- FX_DWORD gennum,
- PARSE_CONTEXT* pContext) {
+ FX_DWORD gennum) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
return nullptr;
@@ -2206,8 +2191,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
if (word == "[") {
std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray(
new CPDF_Array);
- while (CPDF_Object* pObj =
- GetObject(pObjList, objnum, gennum, nullptr, true)) {
+ while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, true)) {
pArray->Add(pObj);
}
return m_WordBuffer[0] == ']' ? pArray.release() : nullptr;
@@ -2217,9 +2201,6 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
- if (pContext)
- pContext->m_DictStart = SavedPos;
-
std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
new CPDF_Dictionary);
while (1) {
@@ -2240,7 +2221,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
key = PDF_NameDecode(key);
std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj(
- GetObject(pObjList, objnum, gennum, nullptr, true));
+ GetObject(pObjList, objnum, gennum, true));
if (!obj) {
uint8_t ch;
while (GetNextChar(ch) && ch != 0x0A && ch != 0x0D) {
@@ -2252,9 +2233,6 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
obj.release());
}
}
- if (pContext) {
- pContext->m_DictEnd = m_Pos;
- }
FX_FILESIZE SavedPos = m_Pos;
CFX_ByteString nextword = GetNextWord(nullptr);
if (nextword != "stream") {
@@ -2262,7 +2240,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
return pDict.release();
}
- return ReadStream(pDict.release(), pContext, objnum, gennum);
+ return ReadStream(pDict.release(), objnum, gennum);
}
if (word == ">>") {
m_Pos = SavedPos;
@@ -2284,7 +2262,6 @@ unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) {
return markers;
}
CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
- PARSE_CONTEXT* pContext,
FX_DWORD objnum,
FX_DWORD gennum) {
CPDF_Object* pLenObj = pDict->GetElement("Length");
@@ -2299,10 +2276,6 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
// Locate the start of stream.
ToNextLine();
FX_FILESIZE streamStartPos = m_Pos;
- if (pContext) {
- pContext->m_DataStart = streamStartPos;
- }
-
const CFX_ByteStringC kEndStreamStr("endstream");
const CFX_ByteStringC kEndObjStr("endobj");
CPDF_CryptoHandler* pCryptoHandler =
@@ -2412,9 +2385,6 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
}
CPDF_Stream* pStream = new CPDF_Stream(pData, len, pDict);
- if (pContext) {
- pContext->m_DataEnd = pContext->m_DataStart + len;
- }
streamStartPos = m_Pos;
FXSYS_memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1);
GetNextWordInternal(nullptr);
@@ -3008,7 +2978,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
} else if (!pdfium::ContainsKey(m_ObjectSet, dwNum)) {
m_ObjectSet.insert(dwNum);
CPDF_Object* pReferred =
- m_pDocument->GetIndirectObject(pRef->GetRefObjNum(), nullptr);
+ m_pDocument->GetIndirectObject(pRef->GetRefObjNum());
if (pReferred) {
new_obj_array.Add(pReferred);
}
@@ -3207,13 +3177,11 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum,
return nullptr;
}
if (pParser) {
- pRet = pParser->ParseIndirectObject(NULL, objnum, NULL);
+ pRet = pParser->ParseIndirectObject(nullptr, objnum);
}
-
if (!pRet && pExistInFile) {
*pExistInFile = FALSE;
}
-
return pRet;
}
@@ -3590,7 +3558,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
return nullptr;
}
CPDF_Object* pObj =
- m_syntaxParser.GetObject(pObjList, parser_objnum, gennum, nullptr, true);
+ m_syntaxParser.GetObject(pObjList, parser_objnum, gennum, true);
m_syntaxParser.RestorePos(SavedPos);
return pObj;
}
@@ -3708,7 +3676,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints,
return -1;
FX_DWORD objNum = FXSYS_atoi(objnum);
- CPDF_Object* pObj = m_parser.ParseIndirectObjectAt(NULL, 0, objNum, NULL);
+ CPDF_Object* pObj = m_parser.ParseIndirectObjectAt(nullptr, 0, objNum);
if (!pObj) {
m_Pos += m_parser.m_Syntax.SavePos();
return 0;
@@ -3938,7 +3906,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) {
ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
m_syntaxParser.InitParser(file.get(), 0);
std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer(
- m_syntaxParser.GetObject(nullptr, 0, 0, nullptr, true));
+ m_syntaxParser.GetObject(nullptr, 0, 0, true));
if (!pTrailer) {
m_Pos += m_syntaxParser.SavePos();
pHints->AddSegment(m_Pos, iTrailerSize);