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

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

Issue 1520643002: Replace several more CFX_MapPtrToPtr with std::set or std::map (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « core/include/fxge/fx_font.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dca81bfa4a0fa530788f09e3706501572dd3864d 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -227,11 +227,11 @@ CPDF_Object* CPDF_Object::GetDirect() const {
return pRef->m_pObjList->GetIndirectObject(pRef->GetRefObjNum());
}
CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const {
- CFX_MapPtrToPtr visited;
+ std::set<FX_DWORD> visited;
return CloneInternal(bDirect, &visited);
}
CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect,
- CFX_MapPtrToPtr* visited) const {
+ std::set<FX_DWORD>* visited) const {
switch (m_Type) {
case PDFOBJ_BOOLEAN:
return new CPDF_Boolean(AsBoolean()->m_bValue);
@@ -285,8 +285,8 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect,
case PDFOBJ_REFERENCE: {
const CPDF_Reference* pRef = AsReference();
FX_DWORD obj_num = pRef->GetRefObjNum();
- if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) {
- visited->SetAt((void*)(uintptr_t)obj_num, (void*)1);
+ if (bDirect && visited->find(obj_num) == visited->end()) {
Lei Zhang 2015/12/10 22:28:03 Someday I'm going to sneak ContainsKey() into PDFi
+ visited->insert(obj_num);
if (!pRef->GetDirect())
return nullptr;
« no previous file with comments | « core/include/fxge/fx_font.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698