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

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

Issue 2498223005: Make CPDF_Array take unique_ptrs (Closed)
Patch Set: nits Created 4 years, 1 month 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_data_avail.cpp ('k') | core/fpdfapi/parser/cpdf_document.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_dictionary.h" 7 #include "core/fpdfapi/parser/cpdf_dictionary.h"
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 SetFor(key, new CPDF_Number(f)); 263 SetFor(key, new CPDF_Number(f));
264 } 264 }
265 265
266 void CPDF_Dictionary::SetBooleanFor(const CFX_ByteString& key, bool bValue) { 266 void CPDF_Dictionary::SetBooleanFor(const CFX_ByteString& key, bool bValue) {
267 SetFor(key, new CPDF_Boolean(bValue)); 267 SetFor(key, new CPDF_Boolean(bValue));
268 } 268 }
269 269
270 void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key, 270 void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
271 const CFX_FloatRect& rect) { 271 const CFX_FloatRect& rect) {
272 CPDF_Array* pArray = new CPDF_Array; 272 CPDF_Array* pArray = new CPDF_Array;
273 pArray->AddNumber(rect.left); 273 pArray->AddNew<CPDF_Number>(rect.left);
274 pArray->AddNumber(rect.bottom); 274 pArray->AddNew<CPDF_Number>(rect.bottom);
275 pArray->AddNumber(rect.right); 275 pArray->AddNew<CPDF_Number>(rect.right);
276 pArray->AddNumber(rect.top); 276 pArray->AddNew<CPDF_Number>(rect.top);
277 SetFor(key, pArray); 277 SetFor(key, pArray);
278 } 278 }
279 279
280 void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key, 280 void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
281 const CFX_Matrix& matrix) { 281 const CFX_Matrix& matrix) {
282 CPDF_Array* pArray = new CPDF_Array; 282 CPDF_Array* pArray = new CPDF_Array;
283 pArray->AddNumber(matrix.a); 283 pArray->AddNew<CPDF_Number>(matrix.a);
284 pArray->AddNumber(matrix.b); 284 pArray->AddNew<CPDF_Number>(matrix.b);
285 pArray->AddNumber(matrix.c); 285 pArray->AddNew<CPDF_Number>(matrix.c);
286 pArray->AddNumber(matrix.d); 286 pArray->AddNew<CPDF_Number>(matrix.d);
287 pArray->AddNumber(matrix.e); 287 pArray->AddNew<CPDF_Number>(matrix.e);
288 pArray->AddNumber(matrix.f); 288 pArray->AddNew<CPDF_Number>(matrix.f);
289 SetFor(key, pArray); 289 SetFor(key, pArray);
290 } 290 }
291 291
292 CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) { 292 CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) {
293 return m_pPool ? m_pPool->Intern(str) : str; 293 return m_pPool ? m_pPool->Intern(str) : str;
294 } 294 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_data_avail.cpp ('k') | core/fpdfapi/parser/cpdf_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698