| Index: core/fpdfapi/parser/cpdf_hint_tables.cpp
|
| diff --git a/core/fpdfapi/parser/cpdf_hint_tables.cpp b/core/fpdfapi/parser/cpdf_hint_tables.cpp
|
| index 045b94cac5dda7fe7982ad729c3a2662f1a30da7..bbc57dace915abfa17aeb8848a86aa4f027ca31e 100644
|
| --- a/core/fpdfapi/parser/cpdf_hint_tables.cpp
|
| +++ b/core/fpdfapi/parser/cpdf_hint_tables.cpp
|
| @@ -12,6 +12,7 @@
|
| #include "core/fpdfapi/parser/cpdf_data_avail.h"
|
| #include "core/fpdfapi/parser/cpdf_dictionary.h"
|
| #include "core/fpdfapi/parser/cpdf_document.h"
|
| +#include "core/fpdfapi/parser/cpdf_linearized.h"
|
| #include "core/fpdfapi/parser/cpdf_stream.h"
|
| #include "core/fpdfapi/parser/cpdf_stream_acc.h"
|
| #include "core/fxcrt/fx_safe_types.h"
|
| @@ -34,12 +35,12 @@ bool IsValidPageOffsetHintTableBitCount(uint32_t bits) {
|
| } // namespace
|
|
|
| CPDF_HintTables::CPDF_HintTables(CPDF_DataAvail* pDataAvail,
|
| - CPDF_Dictionary* pLinearized)
|
| + CPDF_Linearized* pLinearized)
|
| : m_pDataAvail(pDataAvail),
|
| - m_pLinearizedDict(pLinearized),
|
| + m_pLinearized(pLinearized),
|
| m_nFirstPageSharedObjs(0),
|
| m_szFirstPageObjOffset(0) {
|
| - ASSERT(m_pLinearizedDict);
|
| + ASSERT(m_pLinearized);
|
| }
|
|
|
| CPDF_HintTables::~CPDF_HintTables() {}
|
| @@ -487,38 +488,25 @@ bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
|
| }
|
|
|
| int CPDF_HintTables::GetEndOfFirstPageOffset() const {
|
| - CPDF_Object* pOffsetE = m_pLinearizedDict->GetDirectObjectFor("E");
|
| - return pOffsetE ? pOffsetE->GetInteger() : -1;
|
| + return static_cast<int>(m_pLinearized->GetFirstPageEndOffset());
|
| }
|
|
|
| int CPDF_HintTables::GetNumberOfPages() const {
|
| - CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectFor("N");
|
| - return pPageNum ? pPageNum->GetInteger() : 0;
|
| + return static_cast<int>(m_pLinearized->GetPageCount());
|
| }
|
|
|
| int CPDF_HintTables::GetFirstPageObjectNumber() const {
|
| - CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetDirectObjectFor("O");
|
| - return pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
|
| + return static_cast<int>(m_pLinearized->GetFirstPageObjNum());
|
| }
|
|
|
| int CPDF_HintTables::GetFirstPageNumber() const {
|
| - CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetDirectObjectFor("P");
|
| - return pFirstPageNum ? pFirstPageNum->GetInteger() : 0;
|
| + return static_cast<int>(m_pLinearized->GetFirstPageNo());
|
| }
|
|
|
| int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
|
| - return ReadPrimaryHintStream(0);
|
| + return static_cast<int>(m_pLinearized->GetHintStart());
|
| }
|
|
|
| int CPDF_HintTables::ReadPrimaryHintStreamLength() const {
|
| - return ReadPrimaryHintStream(1);
|
| -}
|
| -
|
| -int CPDF_HintTables::ReadPrimaryHintStream(int index) const {
|
| - CPDF_Array* pRange = m_pLinearizedDict->GetArrayFor("H");
|
| - if (!pRange)
|
| - return -1;
|
| -
|
| - CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index);
|
| - return pStreamLen ? pStreamLen->GetInteger() : -1;
|
| + return static_cast<int>(m_pLinearized->GetHintLength());
|
| }
|
|
|