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_data_avail.h" | 7 #include "core/fpdfapi/parser/cpdf_data_avail.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 std::unique_ptr<CPDF_Object> pObj = | 463 std::unique_ptr<CPDF_Object> pObj = |
464 GetObject(dwPageObjNum, pHints, &bExist); | 464 GetObject(dwPageObjNum, pHints, &bExist); |
465 if (!pObj) { | 465 if (!pObj) { |
466 if (bExist) | 466 if (bExist) |
467 UnavailObjList.Add(dwPageObjNum); | 467 UnavailObjList.Add(dwPageObjNum); |
468 continue; | 468 continue; |
469 } | 469 } |
470 | 470 |
471 CPDF_Array* pArray = ToArray(pObj.get()); | 471 CPDF_Array* pArray = ToArray(pObj.get()); |
472 if (pArray) { | 472 if (pArray) { |
473 for (CPDF_Object* pArrayObj : *pArray) { | 473 for (const auto& pArrayObj : *pArray) { |
474 if (CPDF_Reference* pRef = ToReference(pArrayObj)) | 474 if (CPDF_Reference* pRef = ToReference(pArrayObj.get())) |
475 UnavailObjList.Add(pRef->GetRefObjNum()); | 475 UnavailObjList.Add(pRef->GetRefObjNum()); |
476 } | 476 } |
477 } | 477 } |
478 | 478 if (!pObj->IsDictionary()) |
479 if (!pObj->IsDictionary()) { | |
480 continue; | 479 continue; |
481 } | |
482 | 480 |
483 CFX_ByteString type = pObj->GetDict()->GetStringFor("Type"); | 481 CFX_ByteString type = pObj->GetDict()->GetStringFor("Type"); |
484 if (type == "Pages") { | 482 if (type == "Pages") { |
485 m_PagesArray.push_back(std::move(pObj)); | 483 m_PagesArray.push_back(std::move(pObj)); |
486 continue; | 484 continue; |
487 } | 485 } |
488 } | 486 } |
489 | 487 |
490 m_PageObjList.RemoveAll(); | 488 m_PageObjList.RemoveAll(); |
491 if (UnavailObjList.GetSize()) { | 489 if (UnavailObjList.GetSize()) { |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 return AreObjectsAvailable(obj_array, true, nullptr, dummy); | 1700 return AreObjectsAvailable(obj_array, true, nullptr, dummy); |
1703 } | 1701 } |
1704 | 1702 |
1705 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1703 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
1706 | 1704 |
1707 CPDF_DataAvail::PageNode::~PageNode() { | 1705 CPDF_DataAvail::PageNode::~PageNode() { |
1708 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1706 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
1709 delete m_childNode[i]; | 1707 delete m_childNode[i]; |
1710 m_childNode.RemoveAll(); | 1708 m_childNode.RemoveAll(); |
1711 } | 1709 } |
OLD | NEW |