summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-04 21:06:05 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-04 21:06:05 -0700
commit19cd7cc42700b844e6d9fc170a65bf7122d468b8 (patch)
tree127477b084005457579c599b2ec9eef0668a1479 /core/fpdfapi/parser/cpdf_document.cpp
parent71333dc57ac7e4cf7963c83333730b3882ab371f (diff)
downloadpdfium-19cd7cc42700b844e6d9fc170a65bf7122d468b8.tar.xz
Revert of Unify some code (patchset #14 id:260001 of https://codereview.chromium.org/2466023002/ )chromium/2912chromium/2911
Reason for revert: Breaking the chrome roll. See https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/331856 Original issue's description: > Unify some code > > Move parsing of linearized header into separate CPDF_Linearized class. > > Committed: https://pdfium.googlesource.com/pdfium/+/71333dc57ac7e4cf7963c83333730b3882ab371f TBR=thestig@chromium.org,brucedawson@chromium.org,art-snake@yandex-team.ru # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2474283005
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index d9ffc0b28a..8e181de97c 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -17,7 +17,6 @@
#include "core/fpdfapi/page/pageint.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_linearized.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
@@ -379,13 +378,23 @@ void CPDF_Document::LoadDoc() {
m_PageList.SetSize(RetrievePageCount());
}
-void CPDF_Document::LoadLinearizedDoc(
- const CPDF_Linearized* pLinearizationParams) {
+void CPDF_Document::LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams) {
m_bLinearized = true;
LoadDocInternal();
- m_PageList.SetSize(pLinearizationParams->GetPageCount());
- m_iFirstPageNo = pLinearizationParams->GetFirstPageNo();
- m_dwFirstPageObjNum = pLinearizationParams->GetFirstPageObjNum();
+
+ uint32_t dwPageCount = 0;
+ CPDF_Object* pCount = pLinearizationParams->GetObjectFor("N");
+ if (ToNumber(pCount))
+ dwPageCount = pCount->GetInteger();
+ m_PageList.SetSize(dwPageCount);
+
+ CPDF_Object* pNo = pLinearizationParams->GetObjectFor("P");
+ if (ToNumber(pNo))
+ m_iFirstPageNo = pNo->GetInteger();
+
+ CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O");
+ if (ToNumber(pObjNum))
+ m_dwFirstPageObjNum = pObjNum->GetInteger();
}
void CPDF_Document::LoadPages() {