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 752a09d83d9672e7c35541b452451910700eea6c..10bd3118fbf9daed6ef8b3b736b613546389645f 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp |
@@ -1156,25 +1156,26 @@ void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum) { |
pValue->Destroy(); |
m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum); |
} |
-void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, |
- CPDF_Object* pObj) { |
- if (objnum == 0 || pObj == NULL) { |
- return; |
- } |
- void* value = NULL; |
+FX_BOOL CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, |
+ CPDF_Object* pObj) { |
+ if (!objnum || !pObj) |
+ return FALSE; |
+ void* value = nullptr; |
if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { |
if (value) { |
CPDF_Object* pValue = static_cast<CPDF_Object*>(value); |
- if (pObj->GetGenNum() <= pValue->GetGenNum()) |
- return; |
+ if (pObj->GetGenNum() <= pValue->GetGenNum()) { |
jun_fang
2015/12/10 16:02:40
The current object is older than the one in m_Indi
Tom Sepez
2015/12/10 17:32:13
nit: You mean younger? It might be clearer if pVa
Lei Zhang
2015/12/10 18:57:05
I think Jun is saying old vs new, whereas you are
jun_fang
2015/12/10 23:55:58
A non-negative integer generation number. In a new
|
+ pObj->Destroy(); |
+ return FALSE; |
+ } |
pValue->Destroy(); |
jun_fang
2015/12/10 16:02:39
We need to destroy the older one before inserting
|
} |
} |
pObj->m_ObjNum = objnum; |
m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
- if (m_LastObjNum < objnum) { |
+ if (m_LastObjNum < objnum) |
m_LastObjNum = objnum; |
- } |
+ return TRUE; |
} |
FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { |
return m_LastObjNum; |