From 0d86f765b8361b7f9f3a5fcc659de2f52c806bd0 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 25 May 2018 21:17:49 +0000 Subject: Add proper const/non-const versions of CPDF_Dictionary::GetStreamFor(). BUG=pdfium:234 Change-Id: Ia3e758bbe5c445c3856f5215e900e02a16b4d7d7 Reviewed-on: https://pdfium-review.googlesource.com/32910 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- core/fpdfapi/parser/cpdf_dictionary.cpp | 6 +++++- core/fpdfapi/parser/cpdf_dictionary.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'core/fpdfapi/parser') diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp index 29571d6c51..0bdb8a8b16 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/parser/cpdf_dictionary.cpp @@ -145,7 +145,11 @@ CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) const { return ToArray(GetDirectObjectFor(key)); } -CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) const { +const CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) const { + return ToStream(GetDirectObjectFor(key)); +} + +CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) { return ToStream(GetDirectObjectFor(key)); } diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index 8ecbe2d6fc..f2ee588dab 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -52,7 +52,8 @@ class CPDF_Dictionary : public CPDF_Object { bool GetBooleanFor(const ByteString& key, bool bDefault = false) const; float GetNumberFor(const ByteString& key) const; CPDF_Dictionary* GetDictFor(const ByteString& key) const; - CPDF_Stream* GetStreamFor(const ByteString& key) const; + const CPDF_Stream* GetStreamFor(const ByteString& key) const; + CPDF_Stream* GetStreamFor(const ByteString& key); CPDF_Array* GetArrayFor(const ByteString& key) const; CFX_FloatRect GetRectFor(const ByteString& key) const; CFX_Matrix GetMatrixFor(const ByteString& key) const; -- cgit v1.2.3