summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2018-06-22 12:45:14 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-22 12:45:14 +0000
commita327030ca50bd9e06d4bab3ffc5610bf348be0ee (patch)
treefe392e1b235dd2e218f121325fc6bbfc18bdbe68 /core/fpdfapi/parser/cpdf_document.cpp
parentc3cc2ab66d3d8f52dea8083abb6775115e17af7d (diff)
downloadpdfium-a327030ca50bd9e06d4bab3ffc5610bf348be0ee.tar.xz
Rework of Fixing metadata not read from linearized file.
Move receiving "Info" dictionary form API implementation to CPDF_Document. Also added test. Bug: pdfium:664 Change-Id: I273980750fbdd4d20711f651245780fc9ba02789 Reviewed-on: https://pdfium-review.googlesource.com/35490 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index b163cafbbb..393a6f6785 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -219,17 +219,6 @@ void CPDF_Document::LoadDocInternal() {
m_pRootDict = pRootObj->GetDict();
if (!m_pRootDict)
return;
-
- LoadDocumentInfo();
-}
-
-void CPDF_Document::LoadDocumentInfo() {
- if (!m_pParser)
- return;
-
- CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum());
- if (pInfoObj)
- m_pInfoDict = pInfoObj->GetDict();
}
void CPDF_Document::LoadDoc() {
@@ -601,6 +590,18 @@ bool CPDF_Document::InsertNewPage(int iPage, CPDF_Dictionary* pPageDict) {
return true;
}
+CPDF_Dictionary* CPDF_Document::GetInfo() {
+ if (m_pInfoDict)
+ return m_pInfoDict.Get();
+
+ if (!m_pParser || !m_pParser->GetInfoObjNum())
+ return nullptr;
+
+ CPDF_Reference ref(this, m_pParser->GetInfoObjNum());
+ m_pInfoDict = ToDictionary(ref.GetDirect());
+ return m_pInfoDict.Get();
+}
+
void CPDF_Document::DeletePage(int iPage) {
CPDF_Dictionary* pPages = GetPagesDict();
if (!pPages)