diff options
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 18 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.h | 6 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document_unittest.cpp | 36 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_interform.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdf_ppo.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/fpdf_view.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_page.cpp | 2 | ||||
-rw-r--r-- | fxjs/cjs_document.cpp | 4 |
10 files changed, 40 insertions, 40 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index e871e0a578..3ffe6f6f0b 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -475,7 +475,7 @@ bool CPDF_DataAvail::CheckHintTables() { std::unique_ptr<CPDF_Object> CPDF_DataAvail::ParseIndirectObjectAt( FX_FILESIZE pos, uint32_t objnum, - CPDF_IndirectObjectHolder* pObjList) { + CPDF_IndirectObjectHolder* pObjList) const { const FX_FILESIZE SavedPos = GetSyntaxParser()->GetPos(); GetSyntaxParser()->SetPos(pos); std::unique_ptr<CPDF_Object> result = GetSyntaxParser()->GetIndirectObject( @@ -828,7 +828,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail( if (m_pLinearized) { if (dwPage == m_pLinearized->GetFirstPageNo()) { - CPDF_Dictionary* pPageDict = m_pDocument->GetPage(safePage.ValueOrDie()); + auto* pPageDict = m_pDocument->GetPageDictionary(safePage.ValueOrDie()); if (!pPageDict) return DataError; @@ -850,7 +850,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail( nResult = m_pHintTables->CheckPage(dwPage); if (nResult != DataAvailable) return nResult; - if (GetPage(dwPage)) { + if (GetPageDictionary(dwPage)) { m_pagesLoadState.insert(dwPage); return DataAvailable; } @@ -879,7 +879,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail( if (CheckAcroForm() == DocFormStatus::FormNotAvailable) return DataNotAvailable; - CPDF_Dictionary* pPageDict = m_pDocument->GetPage(safePage.ValueOrDie()); + auto* pPageDict = m_pDocument->GetPageDictionary(safePage.ValueOrDie()); if (!pPageDict) return DataError; @@ -943,10 +943,10 @@ int CPDF_DataAvail::GetPageCount() const { return m_pDocument ? m_pDocument->GetPageCount() : 0; } -CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { +CPDF_Dictionary* CPDF_DataAvail::GetPageDictionary(int index) const { if (!m_pDocument || index < 0 || index >= GetPageCount()) return nullptr; - CPDF_Dictionary* page = m_pDocument->GetPage(index); + CPDF_Dictionary* page = m_pDocument->GetPageDictionary(index); if (page) return page; if (!m_pLinearized || !m_pHintTables) @@ -970,7 +970,7 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { } if (!ValidatePage(index)) return nullptr; - return m_pDocument->GetPage(index); + return m_pDocument->GetPageDictionary(index); } CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( @@ -1016,9 +1016,9 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::CheckAcroForm() { return DocFormStatus::FormError; } -bool CPDF_DataAvail::ValidatePage(uint32_t dwPage) { +bool CPDF_DataAvail::ValidatePage(uint32_t dwPage) const { FX_SAFE_INT32 safePage = pdfium::base::checked_cast<int32_t>(dwPage); - CPDF_Dictionary* pPageDict = m_pDocument->GetPage(safePage.ValueOrDie()); + auto* pPageDict = m_pDocument->GetPageDictionary(safePage.ValueOrDie()); if (!pPageDict) return false; CPDF_PageObjectAvail obj_avail(GetValidator().Get(), m_pDocument, pPageDict); diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h index dfb1f0cabf..2a0705d33d 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.h +++ b/core/fpdfapi/parser/cpdf_data_avail.h @@ -102,7 +102,7 @@ class CPDF_DataAvail final { DocLinearizationStatus IsLinearizedPDF(); RetainPtr<IFX_SeekableReadStream> GetFileRead() const; int GetPageCount() const; - CPDF_Dictionary* GetPage(int index); + CPDF_Dictionary* GetPageDictionary(int index) const; RetainPtr<CPDF_ReadValidator> GetValidator() const; std::pair<CPDF_Parser::Error, std::unique_ptr<CPDF_Document>> ParseDocument( @@ -139,7 +139,7 @@ class CPDF_DataAvail final { std::unique_ptr<CPDF_Object> ParseIndirectObjectAt( FX_FILESIZE pos, uint32_t objnum, - CPDF_IndirectObjectHolder* pObjList = nullptr); + CPDF_IndirectObjectHolder* pObjList = nullptr) const; std::unique_ptr<CPDF_Object> GetObject(uint32_t objnum, bool* pExistInFile); bool GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages); @@ -161,7 +161,7 @@ class CPDF_DataAvail final { bool CheckPageCount(); bool IsFirstCheck(uint32_t dwPage); void ResetFirstCheck(uint32_t dwPage); - bool ValidatePage(uint32_t dwPage); + bool ValidatePage(uint32_t dwPage) const; CPDF_SyntaxParser* GetSyntaxParser() const; FileAvail* const m_pFileAvail; diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index 32350b7551..13f5db244b 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -331,7 +331,7 @@ bool CPDF_Document::IsPageLoaded(int iPage) const { return !!m_PageList[iPage]; } -CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { +CPDF_Dictionary* CPDF_Document::GetPageDictionary(int iPage) { if (!pdfium::IndexInBounds(m_PageList, iPage)) return nullptr; diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index 5ee3c77bb5..8690efed80 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -65,7 +65,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { void DeletePage(int iPage); int GetPageCount() const; bool IsPageLoaded(int iPage) const; - CPDF_Dictionary* GetPage(int iPage); + CPDF_Dictionary* GetPageDictionary(int iPage); int GetPageIndex(uint32_t objnum); uint32_t GetUserPermissions() const; diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp index d1b8dce74a..f06a7f42d3 100644 --- a/core/fpdfapi/parser/cpdf_document_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp @@ -164,22 +164,22 @@ TEST_F(cpdf_document_test, GetPages) { std::unique_ptr<CPDF_TestDocumentForPages> document = pdfium::MakeUnique<CPDF_TestDocumentForPages>(); for (int i = 0; i < kNumTestPages; i++) { - CPDF_Dictionary* page = document->GetPage(i); + CPDF_Dictionary* page = document->GetPageDictionary(i); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(i, page->GetIntegerFor("PageNumbering")); } - CPDF_Dictionary* page = document->GetPage(kNumTestPages); + CPDF_Dictionary* page = document->GetPageDictionary(kNumTestPages); EXPECT_FALSE(page); } TEST_F(cpdf_document_test, GetPageWithoutObjNumTwice) { auto document = pdfium::MakeUnique<CPDF_TestDocumentWithPageWithoutPageNum>(); - const CPDF_Dictionary* page = document->GetPage(2); + CPDF_Dictionary* page = document->GetPageDictionary(2); ASSERT_TRUE(page); ASSERT_EQ(document->inlined_page(), page); - const CPDF_Dictionary* second_call_page = document->GetPage(2); + CPDF_Dictionary* second_call_page = document->GetPageDictionary(2); EXPECT_TRUE(second_call_page); EXPECT_EQ(page, second_call_page); } @@ -188,12 +188,12 @@ TEST_F(cpdf_document_test, GetPagesReverseOrder) { std::unique_ptr<CPDF_TestDocumentForPages> document = pdfium::MakeUnique<CPDF_TestDocumentForPages>(); for (int i = 6; i >= 0; i--) { - CPDF_Dictionary* page = document->GetPage(i); + CPDF_Dictionary* page = document->GetPageDictionary(i); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(i, page->GetIntegerFor("PageNumbering")); } - CPDF_Dictionary* page = document->GetPage(kNumTestPages); + CPDF_Dictionary* page = document->GetPageDictionary(kNumTestPages); EXPECT_FALSE(page); } @@ -201,20 +201,20 @@ TEST_F(cpdf_document_test, GetPagesInDisorder) { std::unique_ptr<CPDF_TestDocumentForPages> document = pdfium::MakeUnique<CPDF_TestDocumentForPages>(); - CPDF_Dictionary* page = document->GetPage(1); + CPDF_Dictionary* page = document->GetPageDictionary(1); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(1, page->GetIntegerFor("PageNumbering")); - page = document->GetPage(3); + page = document->GetPageDictionary(3); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(3, page->GetIntegerFor("PageNumbering")); - page = document->GetPage(kNumTestPages); + page = document->GetPageDictionary(kNumTestPages); EXPECT_FALSE(page); - page = document->GetPage(6); + page = document->GetPageDictionary(6); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(6, page->GetIntegerFor("PageNumbering")); @@ -237,11 +237,11 @@ TEST_F(cpdf_document_test, UseCachedPageObjNumIfHaveNotPagesDict) { const int test_page_num = 33; EXPECT_FALSE(document.IsPageLoaded(test_page_num)); - EXPECT_EQ(nullptr, document.GetPage(test_page_num)); + EXPECT_EQ(nullptr, document.GetPageDictionary(test_page_num)); document.SetPageObjNum(test_page_num, obj_num); EXPECT_TRUE(document.IsPageLoaded(test_page_num)); - EXPECT_EQ(page_stub, document.GetPage(test_page_num)); + EXPECT_EQ(page_stub, document.GetPageDictionary(test_page_num)); } TEST_F(cpdf_document_test, CountGreaterThanPageTree) { @@ -249,19 +249,19 @@ TEST_F(cpdf_document_test, CountGreaterThanPageTree) { pdfium::MakeUnique<CPDF_TestDocumentForPages>(); document->SetTreeSize(kNumTestPages + 3); for (int i = 0; i < kNumTestPages; i++) - EXPECT_TRUE(document->GetPage(i)); + EXPECT_TRUE(document->GetPageDictionary(i)); for (int i = kNumTestPages; i < kNumTestPages + 4; i++) - EXPECT_FALSE(document->GetPage(i)); - EXPECT_TRUE(document->GetPage(kNumTestPages - 1)); + EXPECT_FALSE(document->GetPageDictionary(i)); + EXPECT_TRUE(document->GetPageDictionary(kNumTestPages - 1)); } TEST_F(cpdf_document_test, PagesWithoutKids) { // Set up a document with Pages dict without kids, and Count = 3 auto pDoc = pdfium::MakeUnique<CPDF_TestDocPagesWithoutKids>(); - EXPECT_TRUE(pDoc->GetPage(0)); + EXPECT_TRUE(pDoc->GetPageDictionary(0)); // Test GetPage does not fetch pages out of range for (int i = 1; i < 5; i++) - EXPECT_FALSE(pDoc->GetPage(i)); + EXPECT_FALSE(pDoc->GetPageDictionary(i)); - EXPECT_TRUE(pDoc->GetPage(0)); + EXPECT_TRUE(pDoc->GetPageDictionary(0)); } diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 5ebf683b36..4f11babbbe 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -176,7 +176,7 @@ int CPDFSDK_InterForm::GetPageIndexByAnnotDict( ASSERT(pAnnotDict); for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { - if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { + if (CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(i)) { if (CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots")) { for (int j = 0, jsz = pAnnots->GetCount(); j < jsz; j++) { CPDF_Object* pDict = pAnnots->GetDirectObjectAt(j); diff --git a/fpdfsdk/fpdf_ppo.cpp b/fpdfsdk/fpdf_ppo.cpp index 0847113f86..c3b6402a97 100644 --- a/fpdfsdk/fpdf_ppo.cpp +++ b/fpdfsdk/fpdf_ppo.cpp @@ -466,7 +466,7 @@ bool CPDF_PageExporter::ExportPage(const std::vector<uint32_t>& pageNums, auto pObjNumberMap = pdfium::MakeUnique<ObjectNumberMap>(); for (size_t i = 0; i < pageNums.size(); ++i) { CPDF_Dictionary* pDestPageDict = dest()->CreateNewPage(curpage); - const CPDF_Dictionary* pSrcPageDict = src()->GetPage(pageNums[i] - 1); + auto* pSrcPageDict = src()->GetPageDictionary(pageNums[i] - 1); if (!pSrcPageDict || !pDestPageDict) return false; @@ -614,7 +614,7 @@ bool CPDF_NPageToOneExporter::ExportNPagesToOne( // Mapping of XObject name and XObject object number of one page. XObjectNameNumberMap xObjNameNumberMap; for (size_t innerPage = outerPage; innerPage < innerPageMax; ++innerPage) { - CPDF_Dictionary* pSrcPageDict = src()->GetPage(pageNums[innerPage] - 1); + auto* pSrcPageDict = src()->GetPageDictionary(pageNums[innerPage] - 1); if (!pSrcPageDict) return false; diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index 919690f9eb..f5eea66125 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -351,7 +351,7 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document, // Eventually, fallthrough into non-xfa case once page type made consistent. return nullptr; #else // PDF_ENABLE_XFA - CPDF_Dictionary* pDict = pDoc->GetPage(page_index); + CPDF_Dictionary* pDict = pDoc->GetPageDictionary(page_index); if (!pDict) return nullptr; @@ -966,7 +966,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, } #endif // PDF_ENABLE_XFA - CPDF_Dictionary* pDict = pDoc->GetPage(page_index); + CPDF_Dictionary* pDict = pDoc->GetPageDictionary(page_index); if (!pDict) return false; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index f1d7aa9ad3..9fe63f435f 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -22,7 +22,7 @@ CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index) CPDF_Document* pPDFDoc = m_pContext->GetPDFDoc(); CPDF_Dictionary* pDict = nullptr; if (pPDFDoc && m_pContext->GetFormType() != FormType::kXFAFull) - pDict = pPDFDoc->GetPage(m_iPageIndex); + pDict = pPDFDoc->GetPageDictionary(m_iPageIndex); m_pPDFPage = pdfium::MakeUnique<CPDF_Page>(pPDFDoc, pDict, true); m_pPDFPage->SetPageExtension(this); } diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index 07701902ea..de3c93c0cb 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -1251,7 +1251,7 @@ CJS_Return CJS_Document::getPageNthWord( if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) return CJS_Return(JSGetStringFromID(JSMessage::kValueError)); - CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); + CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(nPageNo); if (!pPageDict) return CJS_Return(false); @@ -1300,7 +1300,7 @@ CJS_Return CJS_Document::getPageNumWords( if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) return CJS_Return(JSGetStringFromID(JSMessage::kValueError)); - CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); + CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(nPageNo); if (!pPageDict) return CJS_Return(false); |