Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/fpdf_parser/cpdf_hint_tables.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 return false; | 158 return false; |
| 159 | 159 |
| 160 dwPageLenArray.push_back(safePageLen.ValueOrDie()); | 160 dwPageLenArray.push_back(safePageLen.ValueOrDie()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 int nOffsetE = GetEndOfFirstPageOffset(); | 163 int nOffsetE = GetEndOfFirstPageOffset(); |
| 164 if (nOffsetE < 0) | 164 if (nOffsetE < 0) |
| 165 return false; | 165 return false; |
| 166 | 166 |
| 167 int nFirstPageNum = GetFirstPageNumber(); | 167 int nFirstPageNum = GetFirstPageNumber(); |
| 168 if (nFirstPageNum < 0) | |
|
Tom Sepez
2016/08/31 21:58:10
Is there a reason this isn't just unsigned all the
Lei Zhang
2016/08/31 23:45:51
PDF number objects have signed values.
| |
| 169 return false; | |
| 170 | |
| 168 for (int i = 0; i < nPages; ++i) { | 171 for (int i = 0; i < nPages; ++i) { |
| 169 if (i == nFirstPageNum) { | 172 if (i == nFirstPageNum) { |
| 170 m_szPageOffsetArray.push_back(m_szFirstPageObjOffset); | 173 m_szPageOffsetArray.push_back(m_szFirstPageObjOffset); |
| 171 } else if (i == nFirstPageNum + 1) { | 174 } else if (i == nFirstPageNum + 1) { |
| 172 if (i == 1) { | 175 if (i == 1) { |
| 173 m_szPageOffsetArray.push_back(nOffsetE); | 176 m_szPageOffsetArray.push_back(nOffsetE); |
| 174 } else { | 177 } else { |
| 175 m_szPageOffsetArray.push_back(m_szPageOffsetArray[i - 2] + | 178 m_szPageOffsetArray.push_back(m_szPageOffsetArray[i - 2] + |
| 176 dwPageLenArray[i - 2]); | 179 dwPageLenArray[i - 2]); |
| 177 } | 180 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 } | 500 } |
| 498 | 501 |
| 499 int CPDF_HintTables::ReadPrimaryHintStream(int index) const { | 502 int CPDF_HintTables::ReadPrimaryHintStream(int index) const { |
| 500 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); | 503 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); |
| 501 if (!pRange) | 504 if (!pRange) |
| 502 return -1; | 505 return -1; |
| 503 | 506 |
| 504 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index); | 507 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index); |
| 505 return pStreamLen ? pStreamLen->GetInteger() : -1; | 508 return pStreamLen ? pStreamLen->GetInteger() : -1; |
| 506 } | 509 } |
| OLD | NEW |