summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_helpers.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-01 17:25:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-01 17:25:25 +0000
commitfe06d5109cd575c1e53b9b1cc3cc4ec3c5d7364f (patch)
treefb6744bab0823722b566978e6a8195bf1509b8b2 /fpdfsdk/cpdfsdk_helpers.cpp
parent302c8ce0ee78ecb10398c9b1fa2796d116bbb4a5 (diff)
downloadpdfium-fe06d5109cd575c1e53b9b1cc3cc4ec3c5d7364f.tar.xz
Make FPDF_Document always be CPDF_Document.
Greatly minimize the impact between going back and forth from XFA being on/off, so that XFA case is just an extension beyond the non-XFA data structures we've shipped for years, instead of being a complete replacement of them. Change-Id: I6c98206e0ec99ea443547a4931eba912b1764d54 Reviewed-on: https://pdfium-review.googlesource.com/31690 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_helpers.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_helpers.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index 040b0f2e5a..01d88f9f59 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -25,10 +25,6 @@ namespace {
constexpr char kQuadPoints[] = "QuadPoints";
-FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc) {
- return static_cast<FPDF_DOCUMENT>(doc);
-}
-
bool RaiseUnSupportError(int nError) {
CFSDK_UnsupportInfo_Adapter* pAdapter =
CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter();
@@ -148,33 +144,20 @@ bool FPDF_FileHandlerContext::Flush() {
} // namespace
-UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc) {
- return static_cast<UnderlyingDocumentType*>(doc);
-}
-
UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page) {
return static_cast<UnderlyingPageType*>(page);
}
CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc) {
-#ifdef PDF_ENABLE_XFA
- return doc ? UnderlyingFromFPDFDocument(doc)->GetPDFDoc() : nullptr;
-#else // PDF_ENABLE_XFA
- return UnderlyingFromFPDFDocument(doc);
-#endif // PDF_ENABLE_XFA
+ return reinterpret_cast<CPDF_Document*>(doc);
}
FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) {
#ifdef PDF_ENABLE_XFA
- if (!doc)
- return nullptr;
- if (!doc->GetExtension())
+ if (doc && !doc->GetExtension())
doc->SetExtension(new CPDFXFA_Context(pdfium::WrapUnique(doc)));
- return FPDFDocumentFromUnderlying(
- static_cast<CPDFXFA_Context*>(doc->GetExtension()));
-#else // PDF_ENABLE_XFA
- return FPDFDocumentFromUnderlying(doc);
#endif // PDF_ENABLE_XFA
+ return reinterpret_cast<FPDF_DOCUMENT>(doc);
}
CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page) {