summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fpdfapi/fpdf_parser.h3
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp4
-rw-r--r--fpdfsdk/include/fsdk_define.h3
-rw-r--r--fpdfsdk/src/fpdf_dataavail.cpp2
-rw-r--r--fpdfsdk/src/fpdf_ext.cpp2
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp18
-rw-r--r--fpdfsdk/src/fpdfeditimg.cpp2
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp4
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp2
-rw-r--r--fpdfsdk/src/fpdfppo.cpp8
-rw-r--r--fpdfsdk/src/fpdfsave.cpp2
-rw-r--r--fpdfsdk/src/fpdfview.cpp30
12 files changed, 40 insertions, 40 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index b58cf14974..04c7d90f6f 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -7,7 +7,6 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
-#include "../../../public/fpdfview.h"
#include "../fxcrt/fx_system.h"
#include "fpdf_objects.h"
@@ -57,8 +56,6 @@ extern const FX_WORD PDFDocEncoding[256];
class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects {
public:
- static CPDF_Document* FromFPDFDocument(FPDF_DOCUMENT document);
-
CPDF_Document();
explicit CPDF_Document(CPDF_Parser* pParser);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index b93cadd266..2dff766187 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -7,10 +7,6 @@
#include "../../../include/fpdfapi/fpdf_parser.h"
#include "../../../include/fpdfapi/fpdf_module.h"
-// static
-CPDF_Document* CPDF_Document::FromFPDFDocument(FPDF_DOCUMENT document) {
- return static_cast<CPDF_Document*>(document);
-}
CPDF_Document::CPDF_Document(CPDF_Parser* pParser)
: CPDF_IndirectObjects(pParser) {
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index 12e3f2732d..8910628891 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -56,6 +56,9 @@ class CPDF_CustomAccess final : public IFX_FileRead {
FPDF_FILEACCESS m_FileAccess;
};
+// Conversions from FPDF_ types.
+CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc);
+
void DropContext(void* data);
void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp
index 3944f67b03..b7b42ab32a 100644
--- a/fpdfsdk/src/fpdf_dataavail.cpp
+++ b/fpdfsdk/src/fpdf_dataavail.cpp
@@ -115,7 +115,7 @@ FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
}
DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(doc);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
if (!doc)
return 0;
return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo();
diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp
index 1cc1829914..c0391dfc14 100644
--- a/fpdfsdk/src/fpdf_ext.cpp
+++ b/fpdfsdk/src/fpdf_ext.cpp
@@ -183,7 +183,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code) {
}
DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return PAGEMODE_UNKNOWN;
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index ffdad281c6..05b151e0a7 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -52,7 +52,7 @@ CPDF_LinkList* GetLinkList(CPDF_Page* page) {
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_BookmarkTree tree(pDoc);
@@ -64,7 +64,7 @@ DLLEXPORT FPDF_BOOKMARK STDCALL
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) {
if (!pDict)
return nullptr;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_BookmarkTree tree(pDoc);
@@ -91,7 +91,7 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
FPDF_WIDESTRING title) {
if (!title || title[0] == 0)
return nullptr;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_BookmarkTree tree(pDoc);
@@ -104,7 +104,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
FPDF_BOOKMARK pDict) {
if (!pDict)
return nullptr;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict);
@@ -150,7 +150,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION pDict) {
if (!pDict)
return nullptr;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_Action action((CPDF_Dictionary*)pDict);
@@ -177,7 +177,7 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
unsigned long buflen) {
if (!pDict)
return 0;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
CPDF_Action action((CPDF_Dictionary*)pDict);
@@ -192,7 +192,7 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
FPDF_DEST pDict) {
if (!pDict)
return 0;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
CPDF_Dest dest((CPDF_Array*)pDict);
@@ -226,7 +226,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
FPDF_LINK pDict) {
if (!pDict)
return nullptr;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_Link link((CPDF_Dictionary*)pDict);
@@ -325,7 +325,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc,
unsigned long buflen) {
if (!tag)
return 0;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(doc);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
if (!pDoc)
return 0;
CPDF_Dictionary* pInfo = pDoc->GetInfo();
diff --git a/fpdfsdk/src/fpdfeditimg.cpp b/fpdfsdk/src/fpdfeditimg.cpp
index ef0576b602..0c8ea1627a 100644
--- a/fpdfsdk/src/fpdfeditimg.cpp
+++ b/fpdfsdk/src/fpdfeditimg.cpp
@@ -9,7 +9,7 @@
DLLEXPORT FPDF_PAGEOBJECT STDCALL
FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
CPDF_ImageObject* pImageObj = new CPDF_ImageObject;
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 574fa399c5..6e1b852a47 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -44,7 +44,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
}
DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount())
return;
@@ -55,7 +55,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
int page_index,
double width,
double height) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index fed9a7e97e..02f906f513 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -82,7 +82,7 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
if (!formInfo || formInfo->version != 1)
return nullptr;
- CPDF_Document* pDocument = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDocument = CPDFDocumentFromFPDFDocument(document);
if (!pDocument)
return nullptr;
CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo);
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 50ed6607d5..2508adca7b 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -369,11 +369,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange,
int index) {
- CPDF_Document* pDestDoc = CPDF_Document::FromFPDFDocument(dest_doc);
+ CPDF_Document* pDestDoc = CPDFDocumentFromFPDFDocument(dest_doc);
if (!dest_doc)
return FALSE;
- CPDF_Document* pSrcDoc = CPDF_Document::FromFPDFDocument(src_doc);
+ CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc);
if (!pSrcDoc)
return FALSE;
@@ -395,11 +395,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc) {
- CPDF_Document* pDstDoc = CPDF_Document::FromFPDFDocument(dest_doc);
+ CPDF_Document* pDstDoc = CPDFDocumentFromFPDFDocument(dest_doc);
if (!pDstDoc)
return FALSE;
- CPDF_Document* pSrcDoc = CPDF_Document::FromFPDFDocument(src_doc);
+ CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc);
if (!pSrcDoc)
return FALSE;
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index e0f239828d..7115f6d651 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -56,7 +56,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
FPDF_DWORD flags,
FPDF_BOOL bSetVersion,
int fileVerion) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index a1d84732af..17f52ec263 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -16,6 +16,10 @@
#include "../include/fsdk_rendercontext.h"
#include "../include/javascript/IJavaScript.h"
+CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc) {
+ return static_cast<CPDF_Document*>(doc);
+}
+
CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) {
if (pFileAccess)
m_FileAccess = *pFileAccess;
@@ -222,7 +226,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
return FALSE;
*fileVersion = 0;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(doc);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
if (!pDoc)
return FALSE;
@@ -237,7 +241,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
// jabdelmalek: changed return type from FX_DWORD to build on Linux (and match
// header).
DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
@@ -247,7 +251,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) {
}
DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return -1;
@@ -257,13 +261,13 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {
}
DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
return pDoc ? pDoc->GetPageCount() : 0;
}
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
int page_index) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
@@ -512,7 +516,7 @@ DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) {
}
DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return;
@@ -745,7 +749,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
int page_index,
double* width,
double* height) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return FALSE;
@@ -763,7 +767,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
DLLEXPORT FPDF_BOOL STDCALL
FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return TRUE;
CPDF_ViewerPreferences viewRef(pDoc);
@@ -771,7 +775,7 @@ FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) {
}
DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 1;
CPDF_ViewerPreferences viewRef(pDoc);
@@ -780,7 +784,7 @@ DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document) {
DLLEXPORT FPDF_PAGERANGE STDCALL
FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return NULL;
CPDF_ViewerPreferences viewRef(pDoc);
@@ -789,7 +793,7 @@ FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document) {
DLLEXPORT FPDF_DUPLEXTYPE STDCALL
FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return DuplexUndefined;
CPDF_ViewerPreferences viewRef(pDoc);
@@ -804,7 +808,7 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) {
}
DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return 0;
@@ -825,7 +829,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,
if (!name || name[0] == 0)
return nullptr;
- CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(document);
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;