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

Side by Side Diff: core/fpdfapi/parser/cpdf_hint_tables.cpp

Issue 2482973002: Rename CPDF_Linearized to CPDF_LinearizedHeader (Closed)
Patch Set: Remove if 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/parser/cpdf_hint_tables.h" 7 #include "core/fpdfapi/parser/cpdf_hint_tables.h"
8 8
9 #include <limits> 9 #include <limits>
10 10
11 #include "core/fpdfapi/parser/cpdf_array.h" 11 #include "core/fpdfapi/parser/cpdf_array.h"
12 #include "core/fpdfapi/parser/cpdf_data_avail.h" 12 #include "core/fpdfapi/parser/cpdf_data_avail.h"
13 #include "core/fpdfapi/parser/cpdf_dictionary.h" 13 #include "core/fpdfapi/parser/cpdf_dictionary.h"
14 #include "core/fpdfapi/parser/cpdf_document.h" 14 #include "core/fpdfapi/parser/cpdf_document.h"
15 #include "core/fpdfapi/parser/cpdf_linearized.h" 15 #include "core/fpdfapi/parser/cpdf_linearized_header.h"
16 #include "core/fpdfapi/parser/cpdf_stream.h" 16 #include "core/fpdfapi/parser/cpdf_stream.h"
17 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 17 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
18 #include "core/fxcrt/fx_safe_types.h" 18 #include "core/fxcrt/fx_safe_types.h"
19 #include "third_party/base/numerics/safe_conversions.h" 19 #include "third_party/base/numerics/safe_conversions.h"
20 20
21 namespace { 21 namespace {
22 22
23 bool CanReadFromBitStream(const CFX_BitStream* hStream, 23 bool CanReadFromBitStream(const CFX_BitStream* hStream,
24 const FX_SAFE_UINT32& bits) { 24 const FX_SAFE_UINT32& bits) {
25 return bits.IsValid() && hStream->BitsRemaining() >= bits.ValueOrDie(); 25 return bits.IsValid() && hStream->BitsRemaining() >= bits.ValueOrDie();
26 } 26 }
27 27
28 // Sanity check values from the page table header. The note in the PDF 1.7 28 // Sanity check values from the page table header. The note in the PDF 1.7
29 // reference for Table F.3 says the valid range is only 0 through 32. Though 0 29 // reference for Table F.3 says the valid range is only 0 through 32. Though 0
30 // is not useful either. 30 // is not useful either.
31 bool IsValidPageOffsetHintTableBitCount(uint32_t bits) { 31 bool IsValidPageOffsetHintTableBitCount(uint32_t bits) {
32 return bits > 0 && bits <= 32; 32 return bits > 0 && bits <= 32;
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 CPDF_HintTables::CPDF_HintTables(CPDF_DataAvail* pDataAvail, 37 CPDF_HintTables::CPDF_HintTables(CPDF_DataAvail* pDataAvail,
38 CPDF_Linearized* pLinearized) 38 CPDF_LinearizedHeader* pLinearized)
39 : m_pDataAvail(pDataAvail), 39 : m_pDataAvail(pDataAvail),
40 m_pLinearized(pLinearized), 40 m_pLinearized(pLinearized),
41 m_nFirstPageSharedObjs(0), 41 m_nFirstPageSharedObjs(0),
42 m_szFirstPageObjOffset(0) { 42 m_szFirstPageObjOffset(0) {
43 ASSERT(m_pLinearized); 43 ASSERT(m_pLinearized);
44 } 44 }
45 45
46 CPDF_HintTables::~CPDF_HintTables() {} 46 CPDF_HintTables::~CPDF_HintTables() {}
47 47
48 uint32_t CPDF_HintTables::GetItemLength( 48 uint32_t CPDF_HintTables::GetItemLength(
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 return static_cast<int>(m_pLinearized->GetFirstPageNo()); 503 return static_cast<int>(m_pLinearized->GetFirstPageNo());
504 } 504 }
505 505
506 int CPDF_HintTables::ReadPrimaryHintStreamOffset() const { 506 int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
507 return static_cast<int>(m_pLinearized->GetHintStart()); 507 return static_cast<int>(m_pLinearized->GetHintStart());
508 } 508 }
509 509
510 int CPDF_HintTables::ReadPrimaryHintStreamLength() const { 510 int CPDF_HintTables::ReadPrimaryHintStreamLength() const {
511 return static_cast<int>(m_pLinearized->GetHintLength()); 511 return static_cast<int>(m_pLinearized->GetHintLength());
512 } 512 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698