diff options
author | art-snake <art-snake@yandex-team.ru> | 2016-11-07 08:42:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-07 08:42:04 -0800 |
commit | 240dec52b2e6502e7deb27a3535af3b1a3e23428 (patch) | |
tree | ead5a550c7988ac3291452e524296634423f3012 /core/fpdfapi/parser/cpdf_document.cpp | |
parent | a94fc11866adb1b9ca4a4e1afb4fb574ed472e07 (diff) | |
download | pdfium-240dec52b2e6502e7deb27a3535af3b1a3e23428.tar.xz |
Reland of Unify some code
Unify some code
Move parsing of linearized header into separate CPDF_Linearized class.
Original review:
https://codereview.chromium.org/2466023002/
Revert review:
https://codereview.chromium.org/2474283005/
Revert reason was:
Breaking the chrome roll.
See https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/331856
___
Added Fix for fuzzers.
Review-Url: https://codereview.chromium.org/2477213003
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index 8e181de97c..d9ffc0b28a 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -17,6 +17,7 @@ #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" @@ -378,23 +379,13 @@ void CPDF_Document::LoadDoc() { m_PageList.SetSize(RetrievePageCount()); } -void CPDF_Document::LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams) { +void CPDF_Document::LoadLinearizedDoc( + const CPDF_Linearized* pLinearizationParams) { m_bLinearized = true; LoadDocInternal(); - - 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(); + m_PageList.SetSize(pLinearizationParams->GetPageCount()); + m_iFirstPageNo = pLinearizationParams->GetFirstPageNo(); + m_dwFirstPageObjNum = pLinearizationParams->GetFirstPageObjNum(); } void CPDF_Document::LoadPages() { |