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 | |
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')
28 files changed, 161 insertions, 145 deletions
diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp index b3dd141103..44b2e4023d 100644 --- a/core/fpdfapi/page/cpdf_color.cpp +++ b/core/fpdfapi/page/cpdf_color.cpp @@ -127,7 +127,7 @@ void CPDF_Color::Copy(const CPDF_Color& src) { return; CPDF_Document* pDoc = m_pCS->GetDocument(); - CPDF_Array* pArray = m_pCS->GetArray(); + const CPDF_Array* pArray = m_pCS->GetArray(); if (pDoc && pArray) { m_pCS = pDoc->GetPageData()->GetCopiedColorSpace(pArray); if (!m_pCS) diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index d7fb18edd7..aa664d4e0f 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -112,8 +112,8 @@ class CPDF_CalGray : public CPDF_ColorSpace { // CPDF_ColorSpace: uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, @@ -136,8 +136,8 @@ class CPDF_CalRGB : public CPDF_ColorSpace { ~CPDF_CalRGB() override {} uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; @@ -166,8 +166,8 @@ class CPDF_LabCS : public CPDF_ColorSpace { ~CPDF_LabCS() override {} uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; void GetDefaultValue(int iComponent, float* value, @@ -197,8 +197,8 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace { // CPDF_ColorSpace: uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; void EnableStdConversion(bool bEnabled) override; void TranslateImageLine(uint8_t* pDestBuf, @@ -213,12 +213,12 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace { private: // If no valid ICC profile or using sRGB, try looking for an alternate. bool FindAlternateProfile(CPDF_Document* pDoc, - CPDF_Dictionary* pDict, - std::set<CPDF_Object*>* pVisited, + const CPDF_Dictionary* pDict, + std::set<const CPDF_Object*>* pVisited, uint32_t nExpectedComponents); static CPDF_ColorSpace* GetStockAlternateProfile(uint32_t nComponents); static bool IsValidComponents(int32_t nComps); - static std::vector<float> GetRanges(CPDF_Dictionary* pDict, + static std::vector<float> GetRanges(const CPDF_Dictionary* pDict, uint32_t nComponents); MaybeOwned<CPDF_ColorSpace> m_pAlterCS; @@ -233,8 +233,8 @@ class CPDF_IndexedCS : public CPDF_ColorSpace { ~CPDF_IndexedCS() override; uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; @@ -242,7 +242,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace { private: CPDF_ColorSpace* m_pBaseCS = nullptr; - UnownedPtr<CPDF_CountedColorSpace> m_pCountedBaseCS; + UnownedPtr<const CPDF_CountedColorSpace> m_pCountedBaseCS; uint32_t m_nBaseComponents = 0; int m_MaxIndex = 0; ByteString m_Table; @@ -260,14 +260,14 @@ class CPDF_SeparationCS : public CPDF_ColorSpace { float* min, float* max) const override; uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; void EnableStdConversion(bool bEnabled) override; private: std::unique_ptr<CPDF_ColorSpace> m_pAltCS; - std::unique_ptr<CPDF_Function> m_pFunc; + std::unique_ptr<const CPDF_Function> m_pFunc; enum { None, All, Colorant } m_Type; }; @@ -282,14 +282,14 @@ class CPDF_DeviceNCS : public CPDF_ColorSpace { float* min, float* max) const override; uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; void EnableStdConversion(bool bEnabled) override; private: std::unique_ptr<CPDF_ColorSpace> m_pAltCS; - std::unique_ptr<CPDF_Function> m_pFunc; + std::unique_ptr<const CPDF_Function> m_pFunc; }; class Vector_3by1 { @@ -437,27 +437,27 @@ CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) { // static std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { - std::set<CPDF_Object*> visited; + std::set<const CPDF_Object*> visited; return Load(pDoc, pObj, &visited); } // static std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load( CPDF_Document* pDoc, - CPDF_Object* pObj, - std::set<CPDF_Object*>* pVisited) { + const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) { if (!pObj) return nullptr; if (pdfium::ContainsKey(*pVisited, pObj)) return nullptr; - pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pObj); + pdfium::ScopedSetInsertion<const CPDF_Object*> insertion(pVisited, pObj); if (pObj->IsName()) return pdfium::WrapUnique(ColorspaceFromName(pObj->GetString())); - if (CPDF_Stream* pStream = pObj->AsStream()) { + if (const CPDF_Stream* pStream = pObj->AsStream()) { CPDF_Dictionary* pDict = pStream->GetDict(); if (!pDict) return nullptr; @@ -473,11 +473,11 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load( return nullptr; } - CPDF_Array* pArray = pObj->AsArray(); + const CPDF_Array* pArray = pObj->AsArray(); if (!pArray || pArray->IsEmpty()) return nullptr; - CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0); + const CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0); if (!pFamilyObj) return nullptr; @@ -627,9 +627,9 @@ CPDF_CalGray::CPDF_CalGray(CPDF_Document* pDoc) : CPDF_ColorSpace(pDoc, PDFCS_CALGRAY) {} uint32_t CPDF_CalGray::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { - CPDF_Dictionary* pDict = pArray->GetDictAt(1); + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Dictionary* pDict = pArray->GetDictAt(1); if (!pDict) return 0; @@ -671,9 +671,9 @@ CPDF_CalRGB::CPDF_CalRGB(CPDF_Document* pDoc) : CPDF_ColorSpace(pDoc, PDFCS_CALRGB) {} uint32_t CPDF_CalRGB::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { - CPDF_Dictionary* pDict = pArray->GetDictAt(1); + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Dictionary* pDict = pArray->GetDictAt(1); if (!pDict) return 0; @@ -682,7 +682,7 @@ uint32_t CPDF_CalRGB::v_Load(CPDF_Document* pDoc, GetBlackPoint(pDict, m_BlackPoint); - CPDF_Array* pParam = pDict->GetArrayFor("Gamma"); + const CPDF_Array* pParam = pDict->GetArrayFor("Gamma"); if (pParam) { m_bGamma = true; for (size_t i = 0; i < FX_ArraySize(m_Gamma); ++i) @@ -775,9 +775,9 @@ void CPDF_LabCS::GetDefaultValue(int iComponent, } uint32_t CPDF_LabCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { - CPDF_Dictionary* pDict = pArray->GetDictAt(1); + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Dictionary* pDict = pArray->GetDictAt(1); if (!pDict) return 0; @@ -786,7 +786,7 @@ uint32_t CPDF_LabCS::v_Load(CPDF_Document* pDoc, GetBlackPoint(pDict, m_BlackPoint); - CPDF_Array* pParam = pDict->GetArrayFor("Range"); + const CPDF_Array* pParam = pDict->GetArrayFor("Range"); static constexpr float kDefaultRanges[kRangesCount] = {-100.0f, 100.0f, -100.0f, 100.0f}; static_assert(FX_ArraySize(kDefaultRanges) == FX_ArraySize(m_Ranges), @@ -863,8 +863,8 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { } uint32_t CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { CPDF_Stream* pStream = pArray->GetStreamAt(1); if (!pStream) return 0; @@ -872,7 +872,7 @@ uint32_t CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, // The PDF 1.7 spec says the number of components must be valid. While some // PDF viewers tolerate invalid values, Acrobat does not, so be consistent // with Acrobat and reject bad values. - CPDF_Dictionary* pDict = pStream->GetDict(); + const CPDF_Dictionary* pDict = pStream->GetDict(); int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0; if (!IsValidComponents(nDictComponents)) return 0; @@ -1010,11 +1010,12 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, } } -bool CPDF_ICCBasedCS::FindAlternateProfile(CPDF_Document* pDoc, - CPDF_Dictionary* pDict, - std::set<CPDF_Object*>* pVisited, - uint32_t nExpectedComponents) { - CPDF_Object* pAlterCSObj = pDict->GetDirectObjectFor("Alternate"); +bool CPDF_ICCBasedCS::FindAlternateProfile( + CPDF_Document* pDoc, + const CPDF_Dictionary* pDict, + std::set<const CPDF_Object*>* pVisited, + uint32_t nExpectedComponents) { + const CPDF_Object* pAlterCSObj = pDict->GetDirectObjectFor("Alternate"); if (!pAlterCSObj) return false; @@ -1051,13 +1052,13 @@ bool CPDF_ICCBasedCS::IsValidComponents(int32_t nComps) { } // static -std::vector<float> CPDF_ICCBasedCS::GetRanges(CPDF_Dictionary* pDict, +std::vector<float> CPDF_ICCBasedCS::GetRanges(const CPDF_Dictionary* pDict, uint32_t nComponents) { ASSERT(IsValidComponents(nComponents)); std::vector<float> ranges; ranges.reserve(nComponents * 2); - CPDF_Array* pRanges = pDict->GetArrayFor("Range"); + const CPDF_Array* pRanges = pDict->GetArrayFor("Range"); if (pRanges) { for (uint32_t i = 0; i < nComponents * 2; i++) { ranges.push_back(pRanges->GetNumberAt(i)); @@ -1076,7 +1077,8 @@ CPDF_IndexedCS::CPDF_IndexedCS(CPDF_Document* pDoc) CPDF_IndexedCS::~CPDF_IndexedCS() { FX_Free(m_pCompMinMax); - CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : nullptr; + const CPDF_ColorSpace* pCS = + m_pCountedBaseCS ? m_pCountedBaseCS->get() : nullptr; if (pCS && m_pDocument) { auto* pPageData = m_pDocument->GetPageData(); if (pPageData) @@ -1085,12 +1087,12 @@ CPDF_IndexedCS::~CPDF_IndexedCS() { } uint32_t CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { if (pArray->GetCount() < 4) return 0; - CPDF_Object* pBaseObj = pArray->GetDirectObjectAt(1); + const CPDF_Object* pBaseObj = pArray->GetDirectObjectAt(1); if (pBaseObj == m_pArray) return 0; @@ -1181,8 +1183,8 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent, } uint32_t CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { ByteString name = pArray->GetStringAt(1); if (name == "None") { m_Type = None; @@ -1190,7 +1192,7 @@ uint32_t CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, } m_Type = Colorant; - CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2); + const CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2); if (pAltCS == m_pArray) return 0; @@ -1201,7 +1203,7 @@ uint32_t CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, if (m_pAltCS->IsSpecial()) return 0; - CPDF_Object* pFuncObj = pArray->GetDirectObjectAt(3); + const CPDF_Object* pFuncObj = pArray->GetDirectObjectAt(3); if (pFuncObj && !pFuncObj->IsName()) { auto pFunc = CPDF_Function::Load(pFuncObj); if (pFunc && pFunc->CountOutputs() >= m_pAltCS->CountComponents()) @@ -1252,13 +1254,13 @@ void CPDF_DeviceNCS::GetDefaultValue(int iComponent, } uint32_t CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { - CPDF_Array* pObj = ToArray(pArray->GetDirectObjectAt(1)); + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Array* pObj = ToArray(pArray->GetDirectObjectAt(1)); if (!pObj) return 0; - CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2); + const CPDF_Object* pAltCS = pArray->GetDirectObjectAt(2); if (!pAltCS || pAltCS == m_pArray) return 0; diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h index 71722224aa..fba63917f7 100644 --- a/core/fpdfapi/page/cpdf_colorspace.h +++ b/core/fpdfapi/page/cpdf_colorspace.h @@ -49,8 +49,8 @@ class CPDF_ColorSpace { CPDF_Object* pCSObj); static std::unique_ptr<CPDF_ColorSpace> Load( CPDF_Document* pDoc, - CPDF_Object* pCSObj, - std::set<CPDF_Object*>* pVisited); + const CPDF_Object* pCSObj, + std::set<const CPDF_Object*>* pVisited); void Release(); @@ -97,7 +97,7 @@ class CPDF_ColorSpace { float* G, float* B) const; - CPDF_Array* GetArray() const { return m_pArray.Get(); } + const CPDF_Array* GetArray() const { return m_pArray.Get(); } CPDF_Document* GetDocument() const { return m_pDocument.Get(); } protected: @@ -106,15 +106,15 @@ class CPDF_ColorSpace { // Returns the number of components, or 0 on failure. virtual uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) = 0; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) = 0; // Stock colorspaces are not loaded normally. This initializes their // components count. void SetComponentsForStockCS(uint32_t nComponents); UnownedPtr<CPDF_Document> const m_pDocument; - UnownedPtr<CPDF_Array> m_pArray; + UnownedPtr<const CPDF_Array> m_pArray; const int m_Family; uint32_t m_dwStdConversion = 0; diff --git a/core/fpdfapi/page/cpdf_devicecs.cpp b/core/fpdfapi/page/cpdf_devicecs.cpp index bf9b3768e7..dd440f5398 100644 --- a/core/fpdfapi/page/cpdf_devicecs.cpp +++ b/core/fpdfapi/page/cpdf_devicecs.cpp @@ -63,8 +63,8 @@ CPDF_DeviceCS::CPDF_DeviceCS(int family) : CPDF_ColorSpace(nullptr, family) { CPDF_DeviceCS::~CPDF_DeviceCS() {} uint32_t CPDF_DeviceCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { // Unlike other classes that inherit from CPDF_ColorSpace, CPDF_DeviceCS is // never loaded by CPDF_ColorSpace. NOTREACHED(); diff --git a/core/fpdfapi/page/cpdf_devicecs.h b/core/fpdfapi/page/cpdf_devicecs.h index aecda71a41..bf668c359b 100644 --- a/core/fpdfapi/page/cpdf_devicecs.h +++ b/core/fpdfapi/page/cpdf_devicecs.h @@ -18,8 +18,8 @@ class CPDF_DeviceCS : public CPDF_ColorSpace { // CPDF_ColorSpace: uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 03db315912..9ac5c1e304 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -209,32 +209,33 @@ void CPDF_DocPageData::ReleaseFont(const CPDF_Dictionary* pFontDict) { } CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( - CPDF_Object* pCSObj, + const CPDF_Object* pCSObj, const CPDF_Dictionary* pResources) { - std::set<CPDF_Object*> visited; + std::set<const CPDF_Object*> visited; return GetColorSpaceGuarded(pCSObj, pResources, &visited); } CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceGuarded( - CPDF_Object* pCSObj, + const CPDF_Object* pCSObj, const CPDF_Dictionary* pResources, - std::set<CPDF_Object*>* pVisited) { - std::set<CPDF_Object*> visitedLocal; + std::set<const CPDF_Object*>* pVisited) { + std::set<const CPDF_Object*> visitedLocal; return GetColorSpaceInternal(pCSObj, pResources, pVisited, &visitedLocal); } CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceInternal( - CPDF_Object* pCSObj, + const CPDF_Object* pCSObj, const CPDF_Dictionary* pResources, - std::set<CPDF_Object*>* pVisited, - std::set<CPDF_Object*>* pVisitedInternal) { + std::set<const CPDF_Object*>* pVisited, + std::set<const CPDF_Object*>* pVisitedInternal) { if (!pCSObj) return nullptr; if (pdfium::ContainsKey(*pVisitedInternal, pCSObj)) return nullptr; - pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisitedInternal, pCSObj); + pdfium::ScopedSetInsertion<const CPDF_Object*> insertion(pVisitedInternal, + pCSObj); if (pCSObj->IsName()) { ByteString name = pCSObj->GetString(); @@ -272,7 +273,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceInternal( pVisitedInternal); } - CPDF_Array* pArray = pCSObj->AsArray(); + const CPDF_Array* pArray = pCSObj->AsArray(); if (!pArray || pArray->IsEmpty()) return nullptr; @@ -304,7 +305,8 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceInternal( return csData->AddRef(); } -CPDF_ColorSpace* CPDF_DocPageData::GetCopiedColorSpace(CPDF_Object* pCSObj) { +CPDF_ColorSpace* CPDF_DocPageData::GetCopiedColorSpace( + const CPDF_Object* pCSObj) { if (!pCSObj) return nullptr; @@ -484,7 +486,7 @@ void CPDF_DocPageData::MaybePurgeFontFileStreamAcc( } CPDF_CountedColorSpace* CPDF_DocPageData::FindColorSpacePtr( - CPDF_Object* pCSObj) const { + const CPDF_Object* pCSObj) const { if (!pCSObj) return nullptr; diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h index 5508f568be..2d22ee991d 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.h +++ b/core/fpdfapi/page/cpdf_docpagedata.h @@ -40,17 +40,17 @@ class CPDF_DocPageData { void ReleaseFont(const CPDF_Dictionary* pFontDict); // Loads a colorspace. - CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, + CPDF_ColorSpace* GetColorSpace(const CPDF_Object* pCSObj, const CPDF_Dictionary* pResources); // Loads a colorspace in a context that might be while loading another // colorspace. |pVisited| is passed recursively to avoid circular calls // involving CPDF_ColorSpace::Load(). - CPDF_ColorSpace* GetColorSpaceGuarded(CPDF_Object* pCSObj, + CPDF_ColorSpace* GetColorSpaceGuarded(const CPDF_Object* pCSObj, const CPDF_Dictionary* pResources, - std::set<CPDF_Object*>* pVisited); + std::set<const CPDF_Object*>* pVisited); - CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); + CPDF_ColorSpace* GetCopiedColorSpace(const CPDF_Object* pCSObj); void ReleaseColorSpace(const CPDF_Object* pColorSpace); CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, @@ -67,7 +67,7 @@ class CPDF_DocPageData { RetainPtr<CPDF_StreamAcc> GetFontFileStreamAcc(CPDF_Stream* pFontStream); void MaybePurgeFontFileStreamAcc(const CPDF_Stream* pFontStream); - CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; + CPDF_CountedColorSpace* FindColorSpacePtr(const CPDF_Object* pCSObj) const; CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; private: @@ -79,10 +79,10 @@ class CPDF_DocPageData { // CPDF_ColorSpace::Load() and |pVisitedInternal| is also passed recursively // to avoid circular calls with this method calling itself. CPDF_ColorSpace* GetColorSpaceInternal( - CPDF_Object* pCSObj, + const CPDF_Object* pCSObj, const CPDF_Dictionary* pResources, - std::set<CPDF_Object*>* pVisited, - std::set<CPDF_Object*>* pVisitedInternal); + std::set<const CPDF_Object*>* pVisited, + std::set<const CPDF_Object*>* pVisitedInternal); bool m_bForceClear; UnownedPtr<CPDF_Document> const m_pPDFDoc; diff --git a/core/fpdfapi/page/cpdf_expintfunc.cpp b/core/fpdfapi/page/cpdf_expintfunc.cpp index 0b3dc24033..ac17b282a9 100644 --- a/core/fpdfapi/page/cpdf_expintfunc.cpp +++ b/core/fpdfapi/page/cpdf_expintfunc.cpp @@ -19,14 +19,14 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { FX_Free(m_pEndValues); } -bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj, - std::set<CPDF_Object*>* pVisited) { - CPDF_Dictionary* pDict = pObj->GetDict(); +bool CPDF_ExpIntFunc::v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Dictionary* pDict = pObj->GetDict(); if (!pDict) return false; { - CPDF_Number* pExponent = ToNumber(pDict->GetObjectFor("N")); + const CPDF_Number* pExponent = ToNumber(pDict->GetObjectFor("N")); if (!pExponent) return false; diff --git a/core/fpdfapi/page/cpdf_expintfunc.h b/core/fpdfapi/page/cpdf_expintfunc.h index 3ff6a7eb22..9ea9f5ccb8 100644 --- a/core/fpdfapi/page/cpdf_expintfunc.h +++ b/core/fpdfapi/page/cpdf_expintfunc.h @@ -17,7 +17,8 @@ class CPDF_ExpIntFunc : public CPDF_Function { ~CPDF_ExpIntFunc() override; // CPDF_Function - bool v_Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) override; + bool v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) override; bool v_Call(const float* inputs, float* results) const override; uint32_t m_nOrigOutputs = 0; 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; diff --git a/core/fpdfapi/page/cpdf_function.h b/core/fpdfapi/page/cpdf_function.h index 82a3a54327..c2f2a4bb4e 100644 --- a/core/fpdfapi/page/cpdf_function.h +++ b/core/fpdfapi/page/cpdf_function.h @@ -25,7 +25,7 @@ class CPDF_Function { kType4PostScript = 4, }; - static std::unique_ptr<CPDF_Function> Load(CPDF_Object* pFuncObj); + static std::unique_ptr<CPDF_Function> Load(const CPDF_Object* pFuncObj); static Type IntegerToFunctionType(int iType); virtual ~CPDF_Function(); @@ -51,10 +51,12 @@ class CPDF_Function { protected: explicit CPDF_Function(Type type); - static std::unique_ptr<CPDF_Function> Load(CPDF_Object* pFuncObj, - std::set<CPDF_Object*>* pVisited); - bool Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited); - virtual bool v_Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) = 0; + static std::unique_ptr<CPDF_Function> Load( + const CPDF_Object* pFuncObj, + std::set<const CPDF_Object*>* pVisited); + bool Init(const CPDF_Object* pObj, std::set<const CPDF_Object*>* pVisited); + virtual bool v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) = 0; virtual bool v_Call(const float* inputs, float* results) const = 0; uint32_t m_nInputs; diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 9ce4268a36..8720342d35 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -353,7 +353,7 @@ RetainPtr<CFX_DIBSource> CPDF_Image::DetachMask() { return std::move(m_pMask); } -bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, +bool CPDF_Image::StartLoadDIBSource(const CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, bool bStdCS, uint32_t GroupFamily, diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index 73ea92c666..9281a2c77d 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -50,7 +50,7 @@ class CPDF_Image : public Retainable { void ResetCache(CPDF_Page* pPage, const RetainPtr<CFX_DIBitmap>& pDIBitmap); // Returns whether to Continue() or not. - bool StartLoadDIBSource(CPDF_Dictionary* pFormResource, + bool StartLoadDIBSource(const CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, bool bStdCS = false, uint32_t GroupFamily = 0, diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp index 579678af41..57a5dd1da1 100644 --- a/core/fpdfapi/page/cpdf_meshstream.cpp +++ b/core/fpdfapi/page/cpdf_meshstream.cpp @@ -93,8 +93,8 @@ CPDF_MeshVertex::~CPDF_MeshVertex() = default; CPDF_MeshStream::CPDF_MeshStream( ShadingType type, const std::vector<std::unique_ptr<CPDF_Function>>& funcs, - CPDF_Stream* pShadingStream, - CPDF_ColorSpace* pCS) + const CPDF_Stream* pShadingStream, + const CPDF_ColorSpace* pCS) : m_type(type), m_funcs(funcs), m_pShadingStream(pShadingStream), @@ -120,7 +120,7 @@ bool CPDF_MeshStream::Load() { m_pStream->LoadAllDataFiltered(); m_BitStream = pdfium::MakeUnique<CFX_BitStream>( pdfium::make_span(m_pStream->GetData(), m_pStream->GetSize())); - CPDF_Dictionary* pDict = m_pShadingStream->GetDict(); + const CPDF_Dictionary* pDict = m_pShadingStream->GetDict(); m_nCoordBits = pDict->GetIntegerFor("BitsPerCoordinate"); m_nComponentBits = pDict->GetIntegerFor("BitsPerComponent"); if (ShouldCheckBPC(m_type)) { @@ -139,7 +139,7 @@ bool CPDF_MeshStream::Load() { return false; m_nComponents = m_funcs.empty() ? nComponents : 1; - CPDF_Array* pDecode = pDict->GetArrayFor("Decode"); + const CPDF_Array* pDecode = pDict->GetArrayFor("Decode"); if (!pDecode || pDecode->GetCount() != 4 + m_nComponents * 2) return false; diff --git a/core/fpdfapi/page/cpdf_meshstream.h b/core/fpdfapi/page/cpdf_meshstream.h index 9c97e09c15..1148494578 100644 --- a/core/fpdfapi/page/cpdf_meshstream.h +++ b/core/fpdfapi/page/cpdf_meshstream.h @@ -37,8 +37,8 @@ class CPDF_MeshStream { public: CPDF_MeshStream(ShadingType type, const std::vector<std::unique_ptr<CPDF_Function>>& funcs, - CPDF_Stream* pShadingStream, - CPDF_ColorSpace* pCS); + const CPDF_Stream* pShadingStream, + const CPDF_ColorSpace* pCS); ~CPDF_MeshStream(); bool Load(); @@ -66,8 +66,8 @@ class CPDF_MeshStream { const ShadingType m_type; const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs; - UnownedPtr<CPDF_Stream> const m_pShadingStream; - UnownedPtr<CPDF_ColorSpace> const m_pCS; + UnownedPtr<const CPDF_Stream> const m_pShadingStream; + UnownedPtr<const CPDF_ColorSpace> const m_pCS; uint32_t m_nCoordBits; uint32_t m_nComponentBits; uint32_t m_nFlagBits; diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index 47c02fcf44..dc1a607cf0 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -86,6 +86,7 @@ class CPDF_PageObjectHolder { void Transform(const CFX_Matrix& matrix); CFX_FloatRect CalcBoundingBox() const; + // TODO(thestig): Move |m_pFormStream| into CPDF_Form. UnownedPtr<CPDF_Stream> m_pFormStream; UnownedPtr<CPDF_Dictionary> m_pPageResources; UnownedPtr<CPDF_Dictionary> m_pResources; diff --git a/core/fpdfapi/page/cpdf_patterncs.cpp b/core/fpdfapi/page/cpdf_patterncs.cpp index 37e91aa4e0..69be3d2b82 100644 --- a/core/fpdfapi/page/cpdf_patterncs.cpp +++ b/core/fpdfapi/page/cpdf_patterncs.cpp @@ -16,7 +16,8 @@ CPDF_PatternCS::CPDF_PatternCS(CPDF_Document* pDoc) m_pCountedBaseCS(nullptr) {} CPDF_PatternCS::~CPDF_PatternCS() { - CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : nullptr; + const CPDF_ColorSpace* pCS = + m_pCountedBaseCS ? m_pCountedBaseCS->get() : nullptr; if (pCS && m_pDocument) { auto* pPageData = m_pDocument->GetPageData(); if (pPageData) @@ -29,9 +30,9 @@ void CPDF_PatternCS::InitializeStockPattern() { } uint32_t CPDF_PatternCS::v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) { - CPDF_Object* pBaseCS = pArray->GetDirectObjectAt(1); + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Object* pBaseCS = pArray->GetDirectObjectAt(1); if (pBaseCS == m_pArray) return 0; diff --git a/core/fpdfapi/page/cpdf_patterncs.h b/core/fpdfapi/page/cpdf_patterncs.h index 45365cc738..23735fd8f2 100644 --- a/core/fpdfapi/page/cpdf_patterncs.h +++ b/core/fpdfapi/page/cpdf_patterncs.h @@ -24,8 +24,8 @@ class CPDF_PatternCS : public CPDF_ColorSpace { // CPDF_ColorSpace: uint32_t v_Load(CPDF_Document* pDoc, - CPDF_Array* pArray, - std::set<CPDF_Object*>* pVisited) override; + const CPDF_Array* pArray, + std::set<const CPDF_Object*>* pVisited) override; bool GetRGB(const float* pBuf, float* R, float* G, float* B) const override; CPDF_PatternCS* AsPatternCS() override; const CPDF_PatternCS* AsPatternCS() const override; @@ -35,8 +35,8 @@ class CPDF_PatternCS : public CPDF_ColorSpace { float* B) const override; private: - CPDF_ColorSpace* m_pBaseCS; - CPDF_CountedColorSpace* m_pCountedBaseCS; + const CPDF_ColorSpace* m_pBaseCS; + const CPDF_CountedColorSpace* m_pCountedBaseCS; }; #endif // CORE_FPDFAPI_PAGE_CPDF_PATTERNCS_H_ diff --git a/core/fpdfapi/page/cpdf_psfunc.cpp b/core/fpdfapi/page/cpdf_psfunc.cpp index 2230d4e241..be0afe9659 100644 --- a/core/fpdfapi/page/cpdf_psfunc.cpp +++ b/core/fpdfapi/page/cpdf_psfunc.cpp @@ -13,7 +13,8 @@ CPDF_PSFunc::CPDF_PSFunc() : CPDF_Function(Type::kType4PostScript) {} CPDF_PSFunc::~CPDF_PSFunc() {} -bool CPDF_PSFunc::v_Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) { +bool CPDF_PSFunc::v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) { auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pObj->AsStream()); pAcc->LoadAllDataFiltered(); return m_PS.Parse(pAcc->GetSpan()); diff --git a/core/fpdfapi/page/cpdf_psfunc.h b/core/fpdfapi/page/cpdf_psfunc.h index b4bc5bd2ef..459da5a599 100644 --- a/core/fpdfapi/page/cpdf_psfunc.h +++ b/core/fpdfapi/page/cpdf_psfunc.h @@ -20,7 +20,8 @@ class CPDF_PSFunc : public CPDF_Function { ~CPDF_PSFunc() override; // CPDF_Function - bool v_Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) override; + bool v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) override; bool v_Call(const float* inputs, float* results) const override; private: diff --git a/core/fpdfapi/page/cpdf_sampledfunc.cpp b/core/fpdfapi/page/cpdf_sampledfunc.cpp index 3777254f34..9f19c1c468 100644 --- a/core/fpdfapi/page/cpdf_sampledfunc.cpp +++ b/core/fpdfapi/page/cpdf_sampledfunc.cpp @@ -36,9 +36,9 @@ CPDF_SampledFunc::CPDF_SampledFunc() : CPDF_Function(Type::kType0Sampled) {} CPDF_SampledFunc::~CPDF_SampledFunc() {} -bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj, - std::set<CPDF_Object*>* pVisited) { - CPDF_Stream* pStream = pObj->AsStream(); +bool CPDF_SampledFunc::v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) { + const CPDF_Stream* pStream = pObj->AsStream(); if (!pStream) return false; diff --git a/core/fpdfapi/page/cpdf_sampledfunc.h b/core/fpdfapi/page/cpdf_sampledfunc.h index cbf2dd3648..bd129662cf 100644 --- a/core/fpdfapi/page/cpdf_sampledfunc.h +++ b/core/fpdfapi/page/cpdf_sampledfunc.h @@ -31,7 +31,8 @@ class CPDF_SampledFunc : public CPDF_Function { ~CPDF_SampledFunc() override; // CPDF_Function - bool v_Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) override; + bool v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) override; bool v_Call(const float* inputs, float* results) const override; const std::vector<SampleEncodeInfo>& GetEncodeInfo() const { diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp index f1e75b726a..628155c575 100644 --- a/core/fpdfapi/page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp @@ -83,7 +83,7 @@ bool CPDF_ShadingPattern::Load() { m_pFunctions.push_back(CPDF_Function::Load(pFunc)); } } - CPDF_Object* pCSObj = pShadingDict->GetDirectObjectFor("ColorSpace"); + const CPDF_Object* pCSObj = pShadingDict->GetDirectObjectFor("ColorSpace"); if (!pCSObj) return false; diff --git a/core/fpdfapi/page/cpdf_stitchfunc.cpp b/core/fpdfapi/page/cpdf_stitchfunc.cpp index aed17828d9..2083a91623 100644 --- a/core/fpdfapi/page/cpdf_stitchfunc.cpp +++ b/core/fpdfapi/page/cpdf_stitchfunc.cpp @@ -22,8 +22,8 @@ CPDF_StitchFunc::CPDF_StitchFunc() : CPDF_Function(Type::kType3Stitching) {} CPDF_StitchFunc::~CPDF_StitchFunc() {} -bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj, - std::set<CPDF_Object*>* pVisited) { +bool CPDF_StitchFunc::v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) { if (m_nInputs != kRequiredNumInputs) return false; @@ -66,7 +66,7 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj, { Optional<uint32_t> nOutputs; for (uint32_t i = 0; i < nSubs; ++i) { - CPDF_Object* pSub = pFunctionsArray->GetDirectObjectAt(i); + const CPDF_Object* pSub = pFunctionsArray->GetDirectObjectAt(i); if (pSub == pObj) return false; diff --git a/core/fpdfapi/page/cpdf_stitchfunc.h b/core/fpdfapi/page/cpdf_stitchfunc.h index d6dd63d2d5..20dac6cbc1 100644 --- a/core/fpdfapi/page/cpdf_stitchfunc.h +++ b/core/fpdfapi/page/cpdf_stitchfunc.h @@ -19,7 +19,8 @@ class CPDF_StitchFunc : public CPDF_Function { ~CPDF_StitchFunc() override; // CPDF_Function - bool v_Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) override; + bool v_Init(const CPDF_Object* pObj, + std::set<const CPDF_Object*>* pVisited) override; bool v_Call(const float* inputs, float* results) const override; const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const { diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 736e91b3c8..df69aa43b9 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -1161,7 +1161,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") { ByteString defname = "Default"; defname += name.Right(name.GetLength() - 7); - CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname); + const CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname); if (!pDefObj) { if (name == "DeviceGray") { return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY); @@ -1173,7 +1173,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( } return m_pDocument->LoadColorSpace(pDefObj); } - CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name); + const CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name); if (!pCSObj) { m_bResourceMissing = true; return nullptr; diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index b6658ee5fb..8652490a22 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -114,7 +114,7 @@ CPDF_StreamParser::~CPDF_StreamParser() {} std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream( CPDF_Document* pDoc, std::unique_ptr<CPDF_Dictionary> pDict, - CPDF_Object* pCSObj) { + const CPDF_Object* pCSObj) { if (m_Pos < m_pBuf.size() && PDFCharIsWhitespace(m_pBuf[m_Pos])) m_Pos++; diff --git a/core/fpdfapi/page/cpdf_streamparser.h b/core/fpdfapi/page/cpdf_streamparser.h index 78727da481..062527813c 100644 --- a/core/fpdfapi/page/cpdf_streamparser.h +++ b/core/fpdfapi/page/cpdf_streamparser.h @@ -40,7 +40,7 @@ class CPDF_StreamParser { std::unique_ptr<CPDF_Stream> ReadInlineStream( CPDF_Document* pDoc, std::unique_ptr<CPDF_Dictionary> pDict, - CPDF_Object* pCSObj); + const CPDF_Object* pCSObj); private: friend class cpdf_streamparser_ReadHexString_Test; |