| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (it->second == pObj) | 185 if (it->second == pObj) |
| 186 return; | 186 return; |
| 187 it->second->Release(); | 187 it->second->Release(); |
| 188 | 188 |
| 189 if (pObj) | 189 if (pObj) |
| 190 it->second = pObj; | 190 it->second = pObj; |
| 191 else | 191 else |
| 192 m_Map.erase(it); | 192 m_Map.erase(it); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void CPDF_Dictionary::ConvertToIndirectObjectFor( |
| 196 const CFX_ByteString& key, |
| 197 CPDF_IndirectObjectHolder* pHolder) { |
| 198 auto it = m_Map.find(key); |
| 199 if (it == m_Map.end() || it->second->IsReference()) |
| 200 return; |
| 201 |
| 202 uint32_t objnum = pHolder->AddIndirectObject(it->second); |
| 203 it->second = new CPDF_Reference(pHolder, objnum); |
| 204 } |
| 205 |
| 195 void CPDF_Dictionary::RemoveFor(const CFX_ByteString& key) { | 206 void CPDF_Dictionary::RemoveFor(const CFX_ByteString& key) { |
| 196 auto it = m_Map.find(key); | 207 auto it = m_Map.find(key); |
| 197 if (it == m_Map.end()) | 208 if (it == m_Map.end()) |
| 198 return; | 209 return; |
| 199 | 210 |
| 200 it->second->Release(); | 211 it->second->Release(); |
| 201 m_Map.erase(it); | 212 m_Map.erase(it); |
| 202 } | 213 } |
| 203 | 214 |
| 204 void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey, | 215 void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 pArray->AddNumber(matrix.c); | 277 pArray->AddNumber(matrix.c); |
| 267 pArray->AddNumber(matrix.d); | 278 pArray->AddNumber(matrix.d); |
| 268 pArray->AddNumber(matrix.e); | 279 pArray->AddNumber(matrix.e); |
| 269 pArray->AddNumber(matrix.f); | 280 pArray->AddNumber(matrix.f); |
| 270 SetFor(key, pArray); | 281 SetFor(key, pArray); |
| 271 } | 282 } |
| 272 | 283 |
| 273 CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) { | 284 CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) { |
| 274 return m_pPool ? m_pPool->Intern(str) : str; | 285 return m_pPool ? m_pPool->Intern(str) : str; |
| 275 } | 286 } |
| OLD | NEW |