diff options
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.h | 8 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 2 |
4 files changed, 14 insertions, 12 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index c9cb1d75fc..76190fa9a9 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -431,7 +431,7 @@ bool CPDF_DataAvail::CheckRoot() { } bool CPDF_DataAvail::PreparePageItem() { - CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); + const CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); CPDF_Reference* pRef = ToReference(pRoot ? pRoot->GetObjectFor("Pages") : nullptr); if (!pRef) { @@ -1486,7 +1486,7 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( } if (!m_bLinearizedFormParamLoad) { - CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); + const CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); if (!pRoot) return FormAvailable; @@ -1520,7 +1520,7 @@ bool CPDF_DataAvail::ValidatePage(uint32_t dwPage) { } bool CPDF_DataAvail::ValidateForm() { - CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); + const CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); if (!pRoot) return true; CPDF_Object* pAcroForm = pRoot->GetObjectFor("AcroForm"); diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index 6aedc09d14..47155176ae 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -342,7 +342,6 @@ CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) : CPDF_IndirectObjectHolder(), m_pParser(std::move(pParser)), m_pRootDict(nullptr), - m_pInfoDict(nullptr), m_iNextPageToTraverse(0), m_bReachedMaxPageLevel(false), m_bLinearized(false), @@ -474,7 +473,7 @@ void CPDF_Document::ResetTraversal() { } CPDF_Dictionary* CPDF_Document::GetPagesDict() const { - CPDF_Dictionary* pRoot = GetRoot(); + const CPDF_Dictionary* pRoot = GetRoot(); return pRoot ? pRoot->GetDictFor("Pages") : nullptr; } @@ -518,7 +517,7 @@ int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, uint32_t* skip_count, uint32_t objnum, int* index, - int level) { + int level) const { if (!pNode->KeyExist("Kids")) { if (objnum == pNode->GetObjNum()) return *index; @@ -654,7 +653,8 @@ CFX_RetainPtr<CPDF_Image> CPDF_Document::LoadImageFromPageData( } void CPDF_Document::CreateNewDoc() { - ASSERT(!m_pRootDict && !m_pInfoDict); + ASSERT(!m_pRootDict); + ASSERT(!m_pInfoDict); m_pRootDict = NewIndirect<CPDF_Dictionary>(); m_pRootDict->SetNewFor<CPDF_Name>("Type", "Catalog"); @@ -725,7 +725,7 @@ bool CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, } bool CPDF_Document::InsertNewPage(int iPage, CPDF_Dictionary* pPageDict) { - CPDF_Dictionary* pRoot = GetRoot(); + const CPDF_Dictionary* pRoot = GetRoot(); CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr; if (!pPages) return false; diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index e6107e1040..87d40fd61b 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -49,8 +49,10 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { ~CPDF_Document() override; CPDF_Parser* GetParser() const { return m_pParser.get(); } - CPDF_Dictionary* GetRoot() const { return m_pRootDict; } - CPDF_Dictionary* GetInfo() const { return m_pInfoDict.Get(); } + const CPDF_Dictionary* GetRoot() const { return m_pRootDict; } + CPDF_Dictionary* GetRoot() { return m_pRootDict; } + const CPDF_Dictionary* GetInfo() const { return m_pInfoDict.Get(); } + CPDF_Dictionary* GetInfo() { return m_pInfoDict.Get(); } void DeletePage(int iPage); int GetPageCount() const; @@ -112,7 +114,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { uint32_t* skip_count, uint32_t objnum, int* index, - int level = 0); + int level = 0) const; std::unique_ptr<CPDF_Object> ParseIndirectObject(uint32_t objnum) override; void LoadDocInternal(); size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 167c1f438b..3bd0574000 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -1018,7 +1018,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) { CPDF_Object* pUnownedObject = pObject.get(); if (m_pDocument) { - CPDF_Dictionary* pRootDict = m_pDocument->GetRoot(); + const CPDF_Dictionary* pRootDict = m_pDocument->GetRoot(); if (pRootDict && pRootDict->GetObjNum() == objnum) return false; if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration( |