Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2366)

Unified Diff: core/fpdfapi/parser/cpdf_document.cpp

Issue 2466023002: Unify some code (Closed)
Patch Set: Fix review issues Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/parser/cpdf_document.cpp
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index c5f64a790ca1d31f6cb4357f5a01b18d6b0585e1..2e347604e16764fabc94a03eef3023b0477a7650 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"
@@ -454,23 +455,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() {

Powered by Google App Engine
This is Rietveld 408576698