diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-09 20:13:42 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-09 20:13:42 +0000 |
commit | 54ef2cb9eb5b145c6e973e95ccb488e121556ad7 (patch) | |
tree | 1cfd20ec575e8d825693256a17ca0f55b53f6b57 /core/fpdfapi/page/cpdf_function.cpp | |
parent | a44b288c4132711d0d9dbcc6885fc98525748ad7 (diff) | |
download | pdfium-54ef2cb9eb5b145c6e973e95ccb488e121556ad7.tar.xz |
Mark numerious pointers as const.
They are mostly CPDF_Object* and derived classes, but others that should
be are marked const as well.
Change-Id: Ib3344d7d8db90940df8edc97c0dd6c59da080541
Reviewed-on: https://pdfium-review.googlesource.com/32180
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_function.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_function.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp index a43c887e71..ad3b666a1f 100644 --- a/core/fpdfapi/page/cpdf_function.cpp +++ b/core/fpdfapi/page/cpdf_function.cpp @@ -18,26 +18,27 @@ #include "third_party/base/ptr_util.h" // static -std::unique_ptr<CPDF_Function> CPDF_Function::Load(CPDF_Object* pFuncObj) { - std::set<CPDF_Object*> visited; +std::unique_ptr<CPDF_Function> CPDF_Function::Load( + const CPDF_Object* pFuncObj) { + std::set<const CPDF_Object*> visited; return Load(pFuncObj, &visited); } // static std::unique_ptr<CPDF_Function> CPDF_Function::Load( - CPDF_Object* pFuncObj, - std::set<CPDF_Object*>* pVisited) { + const CPDF_Object* pFuncObj, + std::set<const CPDF_Object*>* pVisited) { if (!pFuncObj) return nullptr; if (pdfium::ContainsKey(*pVisited, pFuncObj)) return nullptr; - pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pFuncObj); + pdfium::ScopedSetInsertion<const CPDF_Object*> insertion(pVisited, pFuncObj); int iType = -1; - if (CPDF_Stream* pStream = pFuncObj->AsStream()) + if (const CPDF_Stream* pStream = pFuncObj->AsStream()) iType = pStream->GetDict()->GetIntegerFor("FunctionType"); - else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) + else if (const CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) iType = pDict->GetIntegerFor("FunctionType"); std::unique_ptr<CPDF_Function> pFunc; @@ -78,11 +79,13 @@ CPDF_Function::~CPDF_Function() { FX_Free(m_pRanges); } -bool CPDF_Function::Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) { - CPDF_Stream* pStream = pObj->AsStream(); - CPDF_Dictionary* pDict = pStream ? pStream->GetDict() : pObj->AsDictionary(); +bool CPDF_Function::Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Stream* pStream = pObj->AsStream(); + const CPDF_Dictionary* pDict = + pStream ? pStream->GetDict() : pObj->AsDictionary(); - CPDF_Array* pDomains = pDict->GetArrayFor("Domain"); + const CPDF_Array* pDomains = pDict->GetArrayFor("Domain"); if (!pDomains) return false; |