| 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_array.h" | 7 #include "core/fpdfapi/parser/cpdf_array.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "core/fpdfapi/parser/cpdf_name.h" | 11 #include "core/fpdfapi/parser/cpdf_name.h" |
| 12 #include "core/fpdfapi/parser/cpdf_number.h" | 12 #include "core/fpdfapi/parser/cpdf_number.h" |
| 13 #include "core/fpdfapi/parser/cpdf_reference.h" | 13 #include "core/fpdfapi/parser/cpdf_reference.h" |
| 14 #include "core/fpdfapi/parser/cpdf_stream.h" | 14 #include "core/fpdfapi/parser/cpdf_stream.h" |
| 15 #include "core/fpdfapi/parser/cpdf_string.h" | 15 #include "core/fpdfapi/parser/cpdf_string.h" |
| 16 #include "third_party/base/logging.h" | 16 #include "third_party/base/logging.h" |
| 17 #include "third_party/base/stl_util.h" | 17 #include "third_party/base/stl_util.h" |
| 18 | 18 |
| 19 CPDF_Array::CPDF_Array() {} | 19 CPDF_Array::CPDF_Array() {} |
| 20 | 20 |
| 21 CPDF_Array::~CPDF_Array() { | 21 CPDF_Array::~CPDF_Array() { |
| 22 // Mark the object as deleted so that it will not be deleted again | 22 // Mark the object as deleted so that it will not be deleted again |
| 23 // in case of cyclic references. | 23 // in case of cyclic references. |
| 24 m_ObjNum = kInvalidObjNum; | 24 m_ObjNum = kInvalidObjNum; |
| 25 for (auto& it : m_Objects) { | 25 for (auto& it : m_Objects) { |
| 26 if (it) | 26 if (it && it->GetObjNum() != kInvalidObjNum) |
| 27 it->Release(); | 27 it->Release(); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 CPDF_Object::Type CPDF_Array::GetType() const { | 31 CPDF_Object::Type CPDF_Array::GetType() const { |
| 32 return ARRAY; | 32 return ARRAY; |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool CPDF_Array::IsArray() const { | 35 bool CPDF_Array::IsArray() const { |
| 36 return true; | 36 return true; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 | 205 |
| 206 void CPDF_Array::AddNumber(FX_FLOAT f) { | 206 void CPDF_Array::AddNumber(FX_FLOAT f) { |
| 207 Add(new CPDF_Number(f)); | 207 Add(new CPDF_Number(f)); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, | 210 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, |
| 211 uint32_t objnum) { | 211 uint32_t objnum) { |
| 212 Add(new CPDF_Reference(pDoc, objnum)); | 212 Add(new CPDF_Reference(pDoc, objnum)); |
| 213 } | 213 } |
| OLD | NEW |