summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_structtree.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-25 21:48:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-25 21:48:49 +0000
commit5cee3f28ead05cb336377483e24664c004af8b0a (patch)
tree8fb5db3232e1359831682c809be3ec10de1ce1e0 /core/fpdfdoc/cpdf_structtree.cpp
parent1f17bd73afa6b1b79ec4a2f81c995b43d15a9814 (diff)
downloadpdfium-5cee3f28ead05cb336377483e24664c004af8b0a.tar.xz
Mark more CPDF_Objects as const in action and bookmark code.
Change-Id: Ib5f4cdb9c7f9c33561028a85029649ba68f4a6e5 Reviewed-on: https://pdfium-review.googlesource.com/32912 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_structtree.cpp')
-rw-r--r--core/fpdfdoc/cpdf_structtree.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpdf_structtree.cpp b/core/fpdfdoc/cpdf_structtree.cpp
index 97db691425..1e4d08aa3c 100644
--- a/core/fpdfdoc/cpdf_structtree.cpp
+++ b/core/fpdfdoc/cpdf_structtree.cpp
@@ -61,7 +61,7 @@ void CPDF_StructTree::LoadPageTree(const CPDF_Dictionary* pPageDict) {
m_Kids.clear();
m_Kids.resize(dwKids);
- CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictFor("ParentTree");
+ const CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictFor("ParentTree");
if (!pParentTree)
return;
@@ -70,20 +70,20 @@ void CPDF_StructTree::LoadPageTree(const CPDF_Dictionary* pPageDict) {
if (parents_id < 0)
return;
- CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id));
+ const CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id));
if (!pParentArray)
return;
- std::map<CPDF_Dictionary*, RetainPtr<CPDF_StructElement>> element_map;
+ StructElementMap element_map;
for (size_t i = 0; i < pParentArray->GetCount(); i++) {
- if (CPDF_Dictionary* pParent = pParentArray->GetDictAt(i))
+ if (const CPDF_Dictionary* pParent = pParentArray->GetDictAt(i))
AddPageNode(pParent, &element_map, 0);
}
}
RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
- CPDF_Dictionary* pDict,
- std::map<CPDF_Dictionary*, RetainPtr<CPDF_StructElement>>* map,
+ const CPDF_Dictionary* pDict,
+ StructElementMap* map,
int nLevel) {
static constexpr int kStructTreeMaxRecursion = 32;
if (nLevel > kStructTreeMaxRecursion)
@@ -95,7 +95,7 @@ RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
auto pElement = pdfium::MakeRetain<CPDF_StructElement>(this, nullptr, pDict);
(*map)[pDict] = pElement;
- CPDF_Dictionary* pParent = pDict->GetDictFor("P");
+ const CPDF_Dictionary* pParent = pDict->GetDictFor("P");
if (!pParent || pParent->GetStringFor("Type") == "StructTreeRoot") {
if (!AddTopLevelNode(pDict, pElement))
map->erase(pDict);
@@ -117,7 +117,7 @@ RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
}
bool CPDF_StructTree::AddTopLevelNode(
- CPDF_Dictionary* pDict,
+ const CPDF_Dictionary* pDict,
const RetainPtr<CPDF_StructElement>& pElement) {
CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectFor("K");
if (!pObj)