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

Unified Diff: core/src/fpdfdoc/doc_basic.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_basic.cpp
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index b32e34bb4c2a956800fc7db1f7ee7e68033058f4..414f5749d0b8952f1eae9bc7ebb0e9f5f4c6589f 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,

Powered by Google App Engine
This is Rietveld 408576698