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/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const { | 126 CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const { |
127 return ToStream(GetDirectObjectAt(i)); | 127 return ToStream(GetDirectObjectAt(i)); |
128 } | 128 } |
129 | 129 |
130 CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const { | 130 CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const { |
131 return ToArray(GetDirectObjectAt(i)); | 131 return ToArray(GetDirectObjectAt(i)); |
132 } | 132 } |
133 | 133 |
134 void CPDF_Array::RemoveAt(uint32_t i, int nCount) { | 134 void CPDF_Array::RemoveAt(uint32_t i, uint32_t nCount) { |
135 if (i >= (uint32_t)m_Objects.GetSize()) | 135 if (i >= (uint32_t)m_Objects.GetSize()) |
136 return; | 136 return; |
137 | 137 |
138 if (nCount <= 0 || nCount > m_Objects.GetSize() - i) | 138 if (nCount <= 0 || nCount > m_Objects.GetSize() - i) |
139 return; | 139 return; |
140 | 140 |
141 for (int j = 0; j < nCount; ++j) { | 141 for (uint32_t j = 0; j < nCount; ++j) { |
142 if (CPDF_Object* p = m_Objects.GetAt(i + j)) | 142 if (CPDF_Object* p = m_Objects.GetAt(i + j)) |
143 p->Release(); | 143 p->Release(); |
144 } | 144 } |
145 m_Objects.RemoveAt(i, nCount); | 145 m_Objects.RemoveAt(i, nCount); |
146 } | 146 } |
147 | 147 |
148 void CPDF_Array::SetAt(uint32_t i, | 148 void CPDF_Array::SetAt(uint32_t i, |
149 CPDF_Object* pObj, | 149 CPDF_Object* pObj, |
150 CPDF_IndirectObjectHolder* pObjs) { | 150 CPDF_IndirectObjectHolder* pObjs) { |
151 ASSERT(IsArray()); | 151 ASSERT(IsArray()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 ASSERT(IsArray()); | 198 ASSERT(IsArray()); |
199 CPDF_Number* pNumber = new CPDF_Number(f); | 199 CPDF_Number* pNumber = new CPDF_Number(f); |
200 Add(pNumber); | 200 Add(pNumber); |
201 } | 201 } |
202 | 202 |
203 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, | 203 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, |
204 uint32_t objnum) { | 204 uint32_t objnum) { |
205 ASSERT(IsArray()); | 205 ASSERT(IsArray()); |
206 Add(new CPDF_Reference(pDoc, objnum)); | 206 Add(new CPDF_Reference(pDoc, objnum)); |
207 } | 207 } |
OLD | NEW |