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

Unified Diff: fpdfsdk/src/fpdfeditpage.cpp

Issue 1395353004: Merge to XFA: Introduce CPDFDocumentFromFPDFDocument(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Remove another pointless local var. Created 5 years, 2 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
« no previous file with comments | « fpdfsdk/src/fpdfeditimg.cpp ('k') | fpdfsdk/src/fpdfppo.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfeditpage.cpp
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 145d8ca5c3a6a2199b6c517f53c7e6d753ff2f4b..e7bbf05f4a024ecd5b89a64dbcc628949a89f795 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -48,10 +48,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
}
DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) {
- CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc();
- if (pDoc == NULL)
- return;
- if (page_index < 0 || page_index >= pDoc->GetPageCount())
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount())
return;
pDoc->DeletePage(page_index);
@@ -61,17 +59,14 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
int page_index,
double width,
double height) {
- if (!document)
- return NULL;
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc)
+ return nullptr;
- // CPDF_Parser* pParser = (CPDF_Parser*)document;
- CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc();
if (page_index < 0)
page_index = 0;
if (pDoc->GetPageCount() < page_index)
page_index = pDoc->GetPageCount();
- // if (page_index < 0 || page_index >= pDoc->GetPageCount())
- // return NULL;
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
if (!pPageDict)
« no previous file with comments | « fpdfsdk/src/fpdfeditimg.cpp ('k') | fpdfsdk/src/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698