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

Unified Diff: core/src/fpdfdoc/doc_tagged.cpp

Issue 1610163003: Merge to XFA: Replace more CFX_MapPtrToPtr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 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
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_tagged.cpp
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index d51743b0dc80f8bab2556c8b8ed617bdb846cf22..3510eb6c8eadda16a3996f1d4c3d6cdbeec50018 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -93,7 +93,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
for (i = 0; i < dwKids; i++) {
m_Kids[i] = NULL;
}
- CFX_MapPtrToPtr element_map;
+ std::map<CPDF_Dictionary*, CPDF_StructElementImpl*> element_map;
CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict("ParentTree");
if (!pParentTree) {
return;
@@ -114,23 +114,25 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
}
}
}
-CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
- CFX_MapPtrToPtr& map,
- int nLevel) {
- if (nLevel > nMaxRecursion) {
+CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(
+ CPDF_Dictionary* pDict,
+ std::map<CPDF_Dictionary*, CPDF_StructElementImpl*>& map,
+ int nLevel) {
+ if (nLevel > nMaxRecursion)
return NULL;
- }
- CPDF_StructElementImpl* pElement = NULL;
- if (map.Lookup(pDict, (void*&)pElement)) {
- return pElement;
- }
- pElement = new CPDF_StructElementImpl(this, NULL, pDict);
- map.SetAt(pDict, pElement);
+
+ auto it = map.find(pDict);
+ if (it != map.end())
+ return it->second;
+
+ CPDF_StructElementImpl* pElement =
+ new CPDF_StructElementImpl(this, NULL, pDict);
+ map[pDict] = pElement;
CPDF_Dictionary* pParent = pDict->GetDict("P");
if (!pParent || pParent->GetString("Type") == "StructTreeRoot") {
if (!AddTopLevelNode(pDict, pElement)) {
pElement->Release();
- map.RemoveKey(pDict);
+ map.erase(pDict);
}
} else {
CPDF_StructElementImpl* pParentElement =
@@ -148,7 +150,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
if (!bSave) {
pElement->Release();
- map.RemoveKey(pDict);
+ map.erase(pDict);
}
}
return pElement;
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698