| 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/parser/cpdf_parser.h" | 7 #include "core/fpdfapi/parser/cpdf_parser.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 } | 979 } |
| 980 } | 980 } |
| 981 | 981 |
| 982 if (arrIndex.size() == 0) | 982 if (arrIndex.size() == 0) |
| 983 arrIndex.push_back(std::make_pair(0, size)); | 983 arrIndex.push_back(std::make_pair(0, size)); |
| 984 | 984 |
| 985 pArray = pDict->GetArrayFor("W"); | 985 pArray = pDict->GetArrayFor("W"); |
| 986 if (!pArray) | 986 if (!pArray) |
| 987 return false; | 987 return false; |
| 988 | 988 |
| 989 CFX_ArrayTemplate<uint32_t> WidthArray; | 989 std::vector<uint32_t> WidthArray; |
| 990 FX_SAFE_UINT32 dwAccWidth = 0; | 990 FX_SAFE_UINT32 dwAccWidth = 0; |
| 991 for (size_t i = 0; i < pArray->GetCount(); ++i) { | 991 for (size_t i = 0; i < pArray->GetCount(); ++i) { |
| 992 WidthArray.Add(pArray->GetIntegerAt(i)); | 992 WidthArray.push_back(pArray->GetIntegerAt(i)); |
| 993 dwAccWidth += WidthArray[i]; | 993 dwAccWidth += WidthArray[i]; |
| 994 } | 994 } |
| 995 | 995 |
| 996 if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3) | 996 if (!dwAccWidth.IsValid() || WidthArray.size() < 3) |
| 997 return false; | 997 return false; |
| 998 | 998 |
| 999 uint32_t totalWidth = dwAccWidth.ValueOrDie(); | 999 uint32_t totalWidth = dwAccWidth.ValueOrDie(); |
| 1000 CPDF_StreamAcc acc; | 1000 CPDF_StreamAcc acc; |
| 1001 acc.LoadAllData(pStream); | 1001 acc.LoadAllData(pStream); |
| 1002 | 1002 |
| 1003 const uint8_t* pData = acc.GetData(); | 1003 const uint8_t* pData = acc.GetData(); |
| 1004 uint32_t dwTotalSize = acc.GetSize(); | 1004 uint32_t dwTotalSize = acc.GetSize(); |
| 1005 uint32_t segindex = 0; | 1005 uint32_t segindex = 0; |
| 1006 for (uint32_t i = 0; i < arrIndex.size(); i++) { | 1006 for (uint32_t i = 0; i < arrIndex.size(); i++) { |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1570 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
| 1571 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1571 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
| 1572 m_LastXRefOffset = 0; | 1572 m_LastXRefOffset = 0; |
| 1573 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1573 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
| 1574 return FORMAT_ERROR; | 1574 return FORMAT_ERROR; |
| 1575 } | 1575 } |
| 1576 | 1576 |
| 1577 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1577 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
| 1578 return SUCCESS; | 1578 return SUCCESS; |
| 1579 } | 1579 } |
| OLD | NEW |