diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-25 21:49:49 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-25 21:49:49 +0000 |
commit | de579ab0092d43fe037c381710da998b9ff823e9 (patch) | |
tree | 9b164e67d06aea6e96054bf4cb4a7db951481f4c /core/fpdfapi/parser | |
parent | 5cee3f28ead05cb336377483e24664c004af8b0a (diff) | |
download | pdfium-de579ab0092d43fe037c381710da998b9ff823e9.tar.xz |
Add proper const/non-const versions of CPDF_Dictionary::GetArrayFor().
BUG=pdfium:234
Change-Id: I5c900aa0547afef0c60de35422b4ee489daa6cfb
Reviewed-on: https://pdfium-review.googlesource.com/32913
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp index 0bdb8a8b16..1ede5e707a 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/parser/cpdf_dictionary.cpp @@ -141,7 +141,11 @@ CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const ByteString& key) const { return nullptr; } -CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) const { +const CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) const { + return ToArray(GetDirectObjectFor(key)); +} + +CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) { return ToArray(GetDirectObjectFor(key)); } @@ -155,7 +159,7 @@ CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) { CFX_FloatRect CPDF_Dictionary::GetRectFor(const ByteString& key) const { CFX_FloatRect rect; - CPDF_Array* pArray = GetArrayFor(key); + const CPDF_Array* pArray = GetArrayFor(key); if (pArray) rect = pArray->GetRect(); return rect; @@ -163,7 +167,7 @@ CFX_FloatRect CPDF_Dictionary::GetRectFor(const ByteString& key) const { CFX_Matrix CPDF_Dictionary::GetMatrixFor(const ByteString& key) const { CFX_Matrix matrix; - CPDF_Array* pArray = GetArrayFor(key); + const CPDF_Array* pArray = GetArrayFor(key); if (pArray) matrix = pArray->GetMatrix(); return matrix; diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index f2ee588dab..df789aa7b4 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -54,7 +54,8 @@ class CPDF_Dictionary : public CPDF_Object { CPDF_Dictionary* GetDictFor(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; + const CPDF_Array* GetArrayFor(const ByteString& key) const; + CPDF_Array* GetArrayFor(const ByteString& key); CFX_FloatRect GetRectFor(const ByteString& key) const; CFX_Matrix GetMatrixFor(const ByteString& key) const; float GetFloatFor(const ByteString& key) const { return GetNumberFor(key); } |