Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: core/fpdfapi/parser/cpdf_array.cpp

Issue 2419173002: Update CPDF_IndirectObjectHolder APIs for unique objects (Closed)
Patch Set: Fix issues Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_array.h ('k') | core/fpdfapi/parser/cpdf_array_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 void CPDF_Array::ConvertToIndirectObjectAt(size_t i, 147 void CPDF_Array::ConvertToIndirectObjectAt(size_t i,
148 CPDF_IndirectObjectHolder* pHolder) { 148 CPDF_IndirectObjectHolder* pHolder) {
149 if (i >= m_Objects.size()) 149 if (i >= m_Objects.size())
150 return; 150 return;
151 151
152 if (!m_Objects[i] || m_Objects[i]->IsReference()) 152 if (!m_Objects[i] || m_Objects[i]->IsReference())
153 return; 153 return;
154 154
155 uint32_t dwObjNum = pHolder->AddIndirectObject(m_Objects[i].release()); 155 CPDF_Object* pUnowned = pHolder->AddIndirectObject(std::move(m_Objects[i]));
156 m_Objects[i] = UniqueObject(new CPDF_Reference(pHolder, dwObjNum)); 156 m_Objects[i] =
157 UniqueObject(new CPDF_Reference(pHolder, pUnowned->GetObjNum()));
157 } 158 }
158 159
159 void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) { 160 void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) {
160 ASSERT(IsArray()); 161 ASSERT(IsArray());
161 CHECK(!pObj || pObj->IsInline()); 162 CHECK(!pObj || pObj->IsInline());
162 if (i >= m_Objects.size()) { 163 if (i >= m_Objects.size()) {
163 ASSERT(false); 164 ASSERT(false);
164 return; 165 return;
165 } 166 }
166 m_Objects[i] = UniqueObject(pObj); 167 m_Objects[i] = UniqueObject(pObj);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 199 }
199 200
200 void CPDF_Array::AddNumber(FX_FLOAT f) { 201 void CPDF_Array::AddNumber(FX_FLOAT f) {
201 Add(new CPDF_Number(f)); 202 Add(new CPDF_Number(f));
202 } 203 }
203 204
204 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, 205 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
205 uint32_t objnum) { 206 uint32_t objnum) {
206 Add(new CPDF_Reference(pDoc, objnum)); 207 Add(new CPDF_Reference(pDoc, objnum));
207 } 208 }
209
210 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
211 const CPDF_Object* pObj) {
212 AddReference(pDoc, pObj->GetObjNum());
213 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_array.h ('k') | core/fpdfapi/parser/cpdf_array_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698