diff options
author | Lei Zhang <thestig@chromium.org> | 2017-08-30 14:19:26 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-30 22:17:09 +0000 |
commit | 0158106c1c77c6af4f7195d086cb0f2d129de838 (patch) | |
tree | aed97db22abfaab6424378436c925a37d832c0e7 /core/fpdfapi/parser/cpdf_document.cpp | |
parent | 4793f3474f2778dbbd225d797f011db0f45e0953 (diff) | |
download | pdfium-0158106c1c77c6af4f7195d086cb0f2d129de838.tar.xz |
Add truly const versions of CPDF_Document getters.
Instead of only having CPDF_Dictionary* GetRoot() const, provide
const CPDF_Dictionary* GetRoot() const and CPDF_Dictionary* GetRoot().
Do the same for GetInfo().
Change-Id: I6eae1208d38327fcdc7d0cd75069a01c95f4a92a
Reviewed-on: https://pdfium-review.googlesource.com/11671
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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; |