From 7e28208d26764438bef62e051d2e1fed13e1e0ec Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 9 May 2018 22:02:32 +0000 Subject: Add proper const/non-const versions of CPDF_Object methods. Instead of having const methods that return non-const pointers. BUG=pdfium:234 Change-Id: I598e9b4f267f702e2e71001cfe3aa3c9e9d8c12f Reviewed-on: https://pdfium-review.googlesource.com/32182 Commit-Queue: Lei Zhang Reviewed-by: Henrique Nakashima --- core/fpdfapi/parser/cpdf_stream.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_stream.cpp') diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp index 45d2ebb30d..fdbe308878 100644 --- a/core/fpdfapi/parser/cpdf_stream.cpp +++ b/core/fpdfapi/parser/cpdf_stream.cpp @@ -37,7 +37,11 @@ CPDF_Object::Type CPDF_Stream::GetType() const { return STREAM; } -CPDF_Dictionary* CPDF_Stream::GetDict() const { +CPDF_Dictionary* CPDF_Stream::GetDict() { + return m_pDict.get(); +} + +const CPDF_Dictionary* CPDF_Stream::GetDict() const { return m_pDict.get(); } @@ -84,11 +88,12 @@ std::unique_ptr CPDF_Stream::CloneNonCyclic( pAcc->LoadAllDataRaw(); uint32_t streamSize = pAcc->GetSize(); - CPDF_Dictionary* pDict = GetDict(); + const CPDF_Dictionary* pDict = GetDict(); std::unique_ptr pNewDict; if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) { - pNewDict = ToDictionary( - static_cast(pDict)->CloneNonCyclic(bDirect, pVisited)); + pNewDict = + ToDictionary(static_cast(pDict)->CloneNonCyclic( + bDirect, pVisited)); } return pdfium::MakeUnique(pAcc->DetachData(), streamSize, std::move(pNewDict)); -- cgit v1.2.3