summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-25 22:58:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-25 22:58:39 +0000
commitdf93cd35530e7b8dd67abde8d199c36c3fae76be (patch)
treecc760bdcc560f0ad448db5a2d01de01d6ba8d1c7 /core/fpdfapi/parser
parent2aa4b2f3928ccd8393f60db8f7b740c75f4e8a8d (diff)
downloadpdfium-df93cd35530e7b8dd67abde8d199c36c3fae76be.tar.xz
Replace some #ifdef PDF_ENABLE_XFA with runtime checks.
Abstract GetUserPermissions() differences via new virtual method. Abstract GetPageCount() differences via existing virtual method. Remove unused ReadHeader() form for non-xfa. Remove unused FindSubstFontByUnicode() for xfa. Remove unused FXFONT_EXACTMATCH Change-Id: I0a3de01a9841db86fcbc96991d3fa2682393b9ad Reviewed-on: https://pdfium-review.googlesource.com/32831 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp13
-rw-r--r--core/fpdfapi/parser/cpdf_document.h1
2 files changed, 5 insertions, 9 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 5479a06174..7968d1b019 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -464,15 +464,10 @@ int CPDF_Document::RetrievePageCount() {
}
uint32_t CPDF_Document::GetUserPermissions() const {
- // https://bugs.chromium.org/p/pdfium/issues/detail?id=499
- if (!m_pParser) {
-#ifndef PDF_ENABLE_XFA
- return 0;
-#else // PDF_ENABLE_XFA
- return 0xFFFFFFFF;
-#endif
- }
- return m_pParser->GetPermissions();
+ if (m_pParser)
+ return m_pParser->GetPermissions();
+
+ return m_pExtension ? m_pExtension->GetUserPermissions() : 0;
}
CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict) {
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index 013eded765..c2774b163a 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -49,6 +49,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
virtual CPDF_Document* GetPDFDoc() const = 0;
virtual int GetPageCount() const = 0;
virtual void DeletePage(int page_index) = 0;
+ virtual uint32_t GetUserPermissions() const = 0;
};
explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser);