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

Side by Side 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, 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
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fxcrt/fx_string.h" 8 #include "../../../include/fxcrt/fx_string.h"
9 9
10 // static 10 // static
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 CFX_AffineMatrix matrix; 710 CFX_AffineMatrix matrix;
711 CPDF_Array* pArray = GetArray(key); 711 CPDF_Array* pArray = GetArray(key);
712 if (pArray) 712 if (pArray)
713 matrix = pArray->GetMatrix(); 713 matrix = pArray->GetMatrix();
714 return matrix; 714 return matrix;
715 } 715 }
716 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { 716 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const {
717 void* value; 717 void* value;
718 return m_Map.Lookup(key, value); 718 return m_Map.Lookup(key, value);
719 } 719 }
720 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, 720
721 CPDF_Object* pObj, 721 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj) {
722 CPDF_IndirectObjects* pObjs) { 722 ASSERT(IsDictionary());
723 ASSERT(m_Type == PDFOBJ_DICTIONARY); 723 void* pValue = nullptr;
724 CPDF_Object* p = NULL; 724 m_Map.Lookup(key, pValue);
725 m_Map.Lookup(key, (void*&)p); 725 CPDF_Object* pExisting = static_cast<CPDF_Object*>(pValue);
726 if (p == pObj) { 726 if (pExisting == pObj)
727 return; 727 return;
728 } 728
729 if (p) 729 if (pExisting)
730 p->Release(); 730 pExisting->Release();
731 if (pObj) { 731
732 if (pObj->GetObjNum()) { 732 if (pObj)
733 ASSERT(pObjs != NULL);
734 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
735 }
736 m_Map.SetAt(key, pObj); 733 m_Map.SetAt(key, pObj);
737 } else { 734 else
738 m_Map.RemoveKey(key); 735 m_Map.RemoveKey(key);
739 }
740 } 736 }
737
741 void CPDF_Dictionary::AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj) { 738 void CPDF_Dictionary::AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj) {
742 ASSERT(m_Type == PDFOBJ_DICTIONARY); 739 ASSERT(m_Type == PDFOBJ_DICTIONARY);
743 m_Map.AddValue(key, pObj); 740 m_Map.AddValue(key, pObj);
744 } 741 }
745 void CPDF_Dictionary::RemoveAt(const CFX_ByteStringC& key) { 742 void CPDF_Dictionary::RemoveAt(const CFX_ByteStringC& key) {
746 ASSERT(m_Type == PDFOBJ_DICTIONARY); 743 ASSERT(m_Type == PDFOBJ_DICTIONARY);
747 CPDF_Object* p = NULL; 744 CPDF_Object* p = NULL;
748 m_Map.Lookup(key, (void*&)p); 745 m_Map.Lookup(key, (void*&)p);
749 if (p == NULL) { 746 if (p == NULL) {
750 return; 747 return;
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 } 1206 }
1210 pObj->m_ObjNum = objnum; 1207 pObj->m_ObjNum = objnum;
1211 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); 1208 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
1212 if (m_LastObjNum < objnum) { 1209 if (m_LastObjNum < objnum) {
1213 m_LastObjNum = objnum; 1210 m_LastObjNum = objnum;
1214 } 1211 }
1215 } 1212 }
1216 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { 1213 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const {
1217 return m_LastObjNum; 1214 return m_LastObjNum;
1218 } 1215 }
OLDNEW
« 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