Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: core/src/fpdfdoc/doc_tagged.cpp

Issue 1402413004: Add type cast definitions for CPDF_Stream. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfdoc/doc_tagged.cpp
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index 2b20e07bb8241d3a96be98652e9ddd2eb033bfdf..f74aa7f6f55e4e3aec9d03083b68c42f020bea34 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -317,8 +317,8 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
CPDF_Dictionary* pDict = nullptr;
if (pAttrs->IsDictionary()) {
pDict = pAttrs->AsDictionary();
- } else if (pAttrs->GetType() == PDFOBJ_STREAM) {
- pDict = ((CPDF_Stream*)pAttrs)->GetDict();
+ } else if (CPDF_Stream* pStream = pAttrs->AsStream()) {
+ pDict = pStream->GetDict();
} else if (CPDF_Array* pArray = pAttrs->AsArray()) {
for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetElementValue(i);
@@ -327,10 +327,9 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
return pDict;
}
}
- if (pDict && pDict->GetString(FX_BSTRC("O")) == owner) {
+ if (pDict && pDict->GetString(FX_BSTRC("O")) == owner)
return pDict;
- }
- return NULL;
+ return nullptr;
}
CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,

Powered by Google App Engine
This is Rietveld 408576698