Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: fpdfsdk/fpdfview.cpp

Issue 2354933002: Rename CPDFXFA_Document::GetPageCount (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/fpdfview.cpp
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index c5b13f850d42e343342c1de9ae495de1af523122..fa8f271fc486d6be12b4a6c5cef9dacced645aa4 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -524,7 +524,14 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {
DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) {
UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document);
- return pDoc ? pDoc->GetPageCount() : 0;
+ if (!pDoc)
+ return 0;
+
+#ifdef PDF_ENABLE_XFA
+ return pDoc->GetXFAPageCount();
+#else // PDF_ENABLE_XFA
+ return pDoc->GetPageCount();
+#endif // PDF_ENABLE_XFA
}
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
@@ -533,12 +540,14 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
if (!pDoc)
return nullptr;
- if (page_index < 0 || page_index >= pDoc->GetPageCount())
- return nullptr;
-
#ifdef PDF_ENABLE_XFA
+ if (page_index < 0 || page_index >= pDoc->GetXFAPageCount())
+ return nullptr;
return pDoc->GetXFAPage(page_index);
#else // PDF_ENABLE_XFA
+ if (page_index < 0 || page_index >= pDoc->GetPageCount())
+ return nullptr;
+
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
if (!pDict)
return nullptr;
@@ -917,7 +926,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
return FALSE;
#ifdef PDF_ENABLE_XFA
- int count = pDoc->GetPageCount();
+ int count = pDoc->GetXFAPageCount();
if (page_index < 0 || page_index >= count)
return FALSE;
CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index);

Powered by Google App Engine
This is Rietveld 408576698