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

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

Issue 2509123002: Make CPDF_Object subclass constructors intern strings (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_array.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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 m_Map.erase(old_it); 232 m_Map.erase(old_it);
233 } 233 }
234 234
235 void CPDF_Dictionary::SetIntegerFor(const CFX_ByteString& key, int i) { 235 void CPDF_Dictionary::SetIntegerFor(const CFX_ByteString& key, int i) {
236 SetFor(key, new CPDF_Number(i)); 236 SetFor(key, new CPDF_Number(i));
237 } 237 }
238 238
239 void CPDF_Dictionary::SetNameFor(const CFX_ByteString& key, 239 void CPDF_Dictionary::SetNameFor(const CFX_ByteString& key,
240 const CFX_ByteString& name) { 240 const CFX_ByteString& name) {
241 SetFor(key, new CPDF_Name(MaybeIntern(name))); 241 SetFor(key, new CPDF_Name(GetByteStringPool(), name));
242 } 242 }
243 243
244 void CPDF_Dictionary::SetStringFor(const CFX_ByteString& key, 244 void CPDF_Dictionary::SetStringFor(const CFX_ByteString& key,
245 const CFX_ByteString& str) { 245 const CFX_ByteString& str) {
246 SetFor(key, new CPDF_String(MaybeIntern(str), false)); 246 SetFor(key, new CPDF_String(GetByteStringPool(), str, false));
247 } 247 }
248 248
249 void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key, 249 void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key,
250 CPDF_IndirectObjectHolder* pDoc, 250 CPDF_IndirectObjectHolder* pDoc,
251 uint32_t objnum) { 251 uint32_t objnum) {
252 SetFor(key, new CPDF_Reference(pDoc, objnum)); 252 SetFor(key, new CPDF_Reference(pDoc, objnum));
253 } 253 }
254 254
255 void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key, 255 void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key,
256 CPDF_IndirectObjectHolder* pDoc, 256 CPDF_IndirectObjectHolder* pDoc,
(...skipping 28 matching lines...) Expand all
285 pArray->AddNew<CPDF_Number>(matrix.c); 285 pArray->AddNew<CPDF_Number>(matrix.c);
286 pArray->AddNew<CPDF_Number>(matrix.d); 286 pArray->AddNew<CPDF_Number>(matrix.d);
287 pArray->AddNew<CPDF_Number>(matrix.e); 287 pArray->AddNew<CPDF_Number>(matrix.e);
288 pArray->AddNew<CPDF_Number>(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_array.cpp ('k') | core/fpdfapi/parser/cpdf_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698