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_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 Loading... |
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 Loading... |
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 } |
OLD | NEW |