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

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp

Issue 1414963005: Remove default argument from CPDF_Dictionary::SetAt(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 07b1a208d733e9dc386b75bf0cfc233ceed73629..46875d88a52dbd72462f8aee5c7309de5710586a 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -717,27 +717,24 @@ FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const {
void* value;
return m_Map.Lookup(key, value);
}
-void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key,
- CPDF_Object* pObj,
- CPDF_IndirectObjects* pObjs) {
- ASSERT(m_Type == PDFOBJ_DICTIONARY);
- CPDF_Object* p = NULL;
- m_Map.Lookup(key, (void*&)p);
- if (p == pObj) {
+
+void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj) {
+ ASSERT(IsDictionary());
+ void* pValue = nullptr;
+ m_Map.Lookup(key, pValue);
+ CPDF_Object* pExisting = static_cast<CPDF_Object*>(pValue);
+ if (pExisting == pObj)
return;
- }
- if (p)
- p->Release();
- if (pObj) {
- if (pObj->GetObjNum()) {
- ASSERT(pObjs != NULL);
- pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
- }
+
+ if (pExisting)
+ pExisting->Release();
+
+ if (pObj)
m_Map.SetAt(key, pObj);
- } else {
+ else
m_Map.RemoveKey(key);
- }
}
+
void CPDF_Dictionary::AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj) {
ASSERT(m_Type == PDFOBJ_DICTIONARY);
m_Map.AddValue(key, pObj);
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698