diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-22 16:45:48 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-22 16:45:48 -0400 |
commit | aa435ba7fe0aacd9102e8c73311c5382ca112439 (patch) | |
tree | d37573646c6135126d3971358024a70ee222fb21 /core/src/fpdfdoc/doc_basic.cpp | |
parent | 2b11dc1220746d2f6f97a940fc9e4235c8ed4975 (diff) | |
download | pdfium-aa435ba7fe0aacd9102e8c73311c5382ca112439.tar.xz |
Merge to XFA: Add type cast definitions for CPDF_Stream.
This Cl adds ToStream, CPDF_Object::AsStream and CPDF_Object::IsStream and
updates the src to use them as needed.
BUG=pdfium:201
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1402413004 .
(cherry picked from commit 338805f1366dcdf9a5b48cf591541cf98d7490f1)
Review URL: https://codereview.chromium.org/1422513004 .
Diffstat (limited to 'core/src/fpdfdoc/doc_basic.cpp')
-rw-r--r-- | core/src/fpdfdoc/doc_basic.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index b32e34bb4c..414f5749d0 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -380,15 +380,13 @@ CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath) { #endif } CPDF_Stream* CPDF_FileSpec::GetFileStream() const { - if (m_pObj == NULL) { - return NULL; - } - int32_t iType = m_pObj->GetType(); - if (iType == PDFOBJ_STREAM) - return (CPDF_Stream*)m_pObj; + if (!m_pObj) + return nullptr; + if (CPDF_Stream* pStream = m_pObj->AsStream()) + return pStream; if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict(FX_BSTRC("EF"))) return pEF->GetStream(FX_BSTRC("F")); - return NULL; + return nullptr; } static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, const CFX_WideStringC& wsFileName, |