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/cpdf_data_avail.h" | 9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 m_dwNSharedObjsArray.Add(hStream->GetBits(dwSharedObjBits)); | 178 m_dwNSharedObjsArray.Add(hStream->GetBits(dwSharedObjBits)); |
179 hStream->ByteAlign(); | 179 hStream->ByteAlign(); |
180 | 180 |
181 // Array of identifiers, size = nshared_objects. | 181 // Array of identifiers, size = nshared_objects. |
182 for (int i = 0; i < nPages; i++) { | 182 for (int i = 0; i < nPages; i++) { |
183 required_bits = dwSharedIdBits; | 183 required_bits = dwSharedIdBits; |
184 required_bits *= m_dwNSharedObjsArray[i]; | 184 required_bits *= m_dwNSharedObjsArray[i]; |
185 if (!CanReadFromBitStream(hStream, required_bits)) | 185 if (!CanReadFromBitStream(hStream, required_bits)) |
186 return FALSE; | 186 return FALSE; |
187 | 187 |
188 for (int j = 0; j < m_dwNSharedObjsArray[i]; j++) | 188 for (uint32_t j = 0; j < m_dwNSharedObjsArray[i]; j++) |
189 m_dwIdentifierArray.Add(hStream->GetBits(dwSharedIdBits)); | 189 m_dwIdentifierArray.Add(hStream->GetBits(dwSharedIdBits)); |
190 } | 190 } |
191 hStream->ByteAlign(); | 191 hStream->ByteAlign(); |
192 | 192 |
193 for (int i = 0; i < nPages; i++) { | 193 for (int i = 0; i < nPages; i++) { |
194 FX_SAFE_DWORD safeSize = m_dwNSharedObjsArray[i]; | 194 FX_SAFE_DWORD safeSize = m_dwNSharedObjsArray[i]; |
195 safeSize *= dwSharedNumeratorBits; | 195 safeSize *= dwSharedNumeratorBits; |
196 if (!CanReadFromBitStream(hStream, safeSize)) | 196 if (!CanReadFromBitStream(hStream, safeSize)) |
197 return FALSE; | 197 return FALSE; |
198 | 198 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 for (int i = 0; i < index; ++i) | 378 for (int i = 0; i < index; ++i) |
379 offset += m_dwNSharedObjsArray[i]; | 379 offset += m_dwNSharedObjsArray[i]; |
380 | 380 |
381 CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O"); | 381 CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O"); |
382 int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1; | 382 int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1; |
383 if (nFirstPageObjNum < 0) | 383 if (nFirstPageObjNum < 0) |
384 return IPDF_DataAvail::DataError; | 384 return IPDF_DataAvail::DataError; |
385 | 385 |
386 uint32_t dwIndex = 0; | 386 uint32_t dwIndex = 0; |
387 uint32_t dwObjNum = 0; | 387 uint32_t dwObjNum = 0; |
388 for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) { | 388 for (uint32_t j = 0; j < m_dwNSharedObjsArray[index]; ++j) { |
389 dwIndex = m_dwIdentifierArray[offset + j]; | 389 dwIndex = m_dwIdentifierArray[offset + j]; |
390 if (dwIndex >= m_dwSharedObjNumArray.GetSize()) | 390 if (dwIndex >= m_dwSharedObjNumArray.GetSize()) |
391 return IPDF_DataAvail::DataNotAvailable; | 391 return IPDF_DataAvail::DataNotAvailable; |
392 | 392 |
393 dwObjNum = m_dwSharedObjNumArray[dwIndex]; | 393 dwObjNum = m_dwSharedObjNumArray[dwIndex]; |
394 if (dwObjNum >= nFirstPageObjNum && | 394 if (dwObjNum >= nFirstPageObjNum && |
395 dwObjNum < nFirstPageObjNum + m_nFirstPageSharedObjs) { | 395 dwObjNum < nFirstPageObjNum + m_nFirstPageSharedObjs) { |
396 continue; | 396 continue; |
397 } | 397 } |
398 | 398 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); | 461 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); |
462 if (!pRange) | 462 if (!pRange) |
463 return -1; | 463 return -1; |
464 | 464 |
465 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 465 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
466 if (!pStreamLen) | 466 if (!pStreamLen) |
467 return -1; | 467 return -1; |
468 | 468 |
469 return pStreamLen->GetInteger(); | 469 return pStreamLen->GetInteger(); |
470 } | 470 } |
OLD | NEW |