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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp

Issue 2019443002: Make CPDF_IndirectObjectHolder::InsertIndirectObject return a bool. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix bad refactoring Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_parser/cfdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_parser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_indirect_object_holder.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void CPDF_IndirectObjectHolder::ReleaseIndirectObject(uint32_t objnum) { 58 void CPDF_IndirectObjectHolder::ReleaseIndirectObject(uint32_t objnum) {
59 auto it = m_IndirectObjs.find(objnum); 59 auto it = m_IndirectObjs.find(objnum);
60 if (it == m_IndirectObjs.end() || 60 if (it == m_IndirectObjs.end() ||
61 it->second->GetObjNum() == CPDF_Object::kInvalidObjNum) { 61 it->second->GetObjNum() == CPDF_Object::kInvalidObjNum) {
62 return; 62 return;
63 } 63 }
64 it->second->Destroy(); 64 it->second->Destroy();
65 m_IndirectObjs.erase(it); 65 m_IndirectObjs.erase(it);
66 } 66 }
67 67
68 FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(uint32_t objnum, 68 bool CPDF_IndirectObjectHolder::InsertIndirectObject(uint32_t objnum,
69 CPDF_Object* pObj) { 69 CPDF_Object* pObj) {
70 if (!objnum || !pObj) 70 if (!objnum || !pObj)
71 return FALSE; 71 return false;
72
72 auto it = m_IndirectObjs.find(objnum); 73 auto it = m_IndirectObjs.find(objnum);
73 if (it != m_IndirectObjs.end()) { 74 if (it != m_IndirectObjs.end()) {
74 if (pObj->GetGenNum() <= it->second->GetGenNum()) { 75 if (pObj->GetGenNum() <= it->second->GetGenNum()) {
75 pObj->Destroy(); 76 pObj->Destroy();
76 return FALSE; 77 return false;
77 } 78 }
78 it->second->Destroy(); 79 it->second->Destroy();
79 } 80 }
80 pObj->m_ObjNum = objnum; 81 pObj->m_ObjNum = objnum;
81 m_IndirectObjs[objnum] = pObj; 82 m_IndirectObjs[objnum] = pObj;
82 m_LastObjNum = std::max(m_LastObjNum, objnum); 83 m_LastObjNum = std::max(m_LastObjNum, objnum);
83 return TRUE; 84 return true;
84 } 85 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cfdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698