| Index: fpdfsdk/src/fpdfeditpage.cpp
|
| diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
|
| index 8796d0e2b1a36465103800e25d1ff597abb60e53..574fa399c5f715b88ba9aa2c057ae2cb7f7adfd6 100644
|
| --- a/fpdfsdk/src/fpdfeditpage.cpp
|
| +++ b/fpdfsdk/src/fpdfeditpage.cpp
|
| @@ -44,10 +44,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
|
| }
|
|
|
| DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) {
|
| - CPDF_Document* pDoc = (CPDF_Document*)document;
|
| - if (pDoc == NULL)
|
| - return;
|
| - if (page_index < 0 || page_index >= pDoc->GetPageCount())
|
| + CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
|
| + if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount())
|
| return;
|
|
|
| pDoc->DeletePage(page_index);
|
| @@ -57,17 +55,14 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
|
| int page_index,
|
| double width,
|
| double height) {
|
| - if (!document)
|
| - return NULL;
|
| + CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
|
| + if (!pDoc)
|
| + return nullptr;
|
|
|
| - // CPDF_Parser* pParser = (CPDF_Parser*)document;
|
| - CPDF_Document* pDoc = (CPDF_Document*)document;
|
| 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)
|
|
|