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/fpdf_parser/include/cpdf_dictionary.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 bool CPDF_Dictionary::IsSignatureDict() const { | 164 bool CPDF_Dictionary::IsSignatureDict() const { |
165 CPDF_Object* pType = GetDirectObjectFor("Type"); | 165 CPDF_Object* pType = GetDirectObjectFor("Type"); |
166 if (!pType) | 166 if (!pType) |
167 pType = GetDirectObjectFor("FT"); | 167 pType = GetDirectObjectFor("FT"); |
168 return pType && pType->GetString() == "Sig"; | 168 return pType && pType->GetString() == "Sig"; |
169 } | 169 } |
170 | 170 |
171 void CPDF_Dictionary::SetFor(const CFX_ByteString& key, CPDF_Object* pObj) { | 171 void CPDF_Dictionary::SetFor(const CFX_ByteString& key, CPDF_Object* pObj) { |
| 172 ASSERT(!pObj || pObj->GetObjNum() == 0); |
172 auto it = m_Map.find(key); | 173 auto it = m_Map.find(key); |
173 if (it == m_Map.end()) { | 174 if (it == m_Map.end()) { |
174 if (pObj) | 175 if (pObj) |
175 m_Map.insert(std::make_pair(key, pObj)); | 176 m_Map.insert(std::make_pair(key, pObj)); |
176 return; | 177 return; |
177 } | 178 } |
178 | 179 |
179 if (it->second == pObj) | 180 if (it->second == pObj) |
180 return; | 181 return; |
181 it->second->Release(); | 182 it->second->Release(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 const CFX_Matrix& matrix) { | 257 const CFX_Matrix& matrix) { |
257 CPDF_Array* pArray = new CPDF_Array; | 258 CPDF_Array* pArray = new CPDF_Array; |
258 pArray->AddNumber(matrix.a); | 259 pArray->AddNumber(matrix.a); |
259 pArray->AddNumber(matrix.b); | 260 pArray->AddNumber(matrix.b); |
260 pArray->AddNumber(matrix.c); | 261 pArray->AddNumber(matrix.c); |
261 pArray->AddNumber(matrix.d); | 262 pArray->AddNumber(matrix.d); |
262 pArray->AddNumber(matrix.e); | 263 pArray->AddNumber(matrix.e); |
263 pArray->AddNumber(matrix.f); | 264 pArray->AddNumber(matrix.f); |
264 SetFor(key, pArray); | 265 SetFor(key, pArray); |
265 } | 266 } |
OLD | NEW |