summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-24 01:39:31 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-24 01:39:31 +0000
commit18f7fbca461254cc0df1af2ca586df42b7fd6c17 (patch)
tree2c31f8e06d6cd4bdd4f9ba6409a92e27719e4245
parentdbf13f6562a902df17f6e543d3be844ca82956e2 (diff)
downloadpdfium-18f7fbca461254cc0df1af2ca586df42b7fd6c17.tar.xz
Mark some pointers as non-const in CPDF_NameTree.
The class modifies the tree, so stop pretending its const. Change-Id: I1095239a728fc0999c84db37d5cb17f596b9c791 Reviewed-on: https://pdfium-review.googlesource.com/32185 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--core/fpdfdoc/cpdf_nametree.cpp12
-rw-r--r--core/fpdfdoc/cpdf_nametree.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index 3c5b08db21..92b37f12b3 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -36,7 +36,7 @@ std::pair<WideString, WideString> GetNodeLimitsMaybeSwap(CPDF_Array* pLimits) {
// Get the limit arrays that leaf array |pFind| is under in the tree with root
// |pNode|. |pLimits| will hold all the limit arrays from the leaf up to before
// the root. Return true if successful.
-bool GetNodeAncestorsLimits(const CPDF_Dictionary* pNode,
+bool GetNodeAncestorsLimits(CPDF_Dictionary* pNode,
const CPDF_Array* pFind,
int nLevel,
std::vector<CPDF_Array*>* pLimits) {
@@ -153,7 +153,7 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
// will be the index of |csName| in |ppFind|. If |csName| is not found, |ppFind|
// will be the leaf array that |csName| should be added to, and |pFindIndex|
// will be the index that it should be added at.
-CPDF_Object* SearchNameNodeByName(const CPDF_Dictionary* pNode,
+CPDF_Object* SearchNameNodeByName(CPDF_Dictionary* pNode,
const WideString& csName,
int nLevel,
size_t* nIndex,
@@ -228,7 +228,7 @@ CPDF_Object* SearchNameNodeByName(const CPDF_Dictionary* pNode,
// successful, return the value object; |csName| will be the key, |ppFind|
// will be the leaf array that this pair is in, and |pFindIndex| will be the
// index of the pair in |pFind|.
-CPDF_Object* SearchNameNodeByIndex(const CPDF_Dictionary* pNode,
+CPDF_Object* SearchNameNodeByIndex(CPDF_Dictionary* pNode,
size_t nIndex,
int nLevel,
size_t* nCurIndex,
@@ -298,10 +298,8 @@ size_t CountNamesInternal(CPDF_Dictionary* pNode, int nLevel) {
CPDF_NameTree::CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
-CPDF_NameTree::CPDF_NameTree(const CPDF_Document* pDoc,
- const ByteString& category)
- : m_pRoot(nullptr) {
- const CPDF_Dictionary* pRoot = pDoc->GetRoot();
+CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, const ByteString& category) {
+ CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot)
return;
diff --git a/core/fpdfdoc/cpdf_nametree.h b/core/fpdfdoc/cpdf_nametree.h
index 72d0d669e9..495798c087 100644
--- a/core/fpdfdoc/cpdf_nametree.h
+++ b/core/fpdfdoc/cpdf_nametree.h
@@ -20,7 +20,7 @@ class CPDF_Object;
class CPDF_NameTree {
public:
explicit CPDF_NameTree(CPDF_Dictionary* pRoot);
- CPDF_NameTree(const CPDF_Document* pDoc, const ByteString& category);
+ CPDF_NameTree(CPDF_Document* pDoc, const ByteString& category);
~CPDF_NameTree();
bool AddValueAndName(std::unique_ptr<CPDF_Object> pObj,