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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.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/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index c27ede44cb4cfea3e5133f3cdeeb97bea277f5b4..b86d00851cfcdb216c06a75a145b82661177a0ff 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -960,10 +960,10 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) {
m_Status = Done;
return;
}
- if (pContent->GetType() == PDFOBJ_STREAM) {
+ if (CPDF_Stream* pStream = pContent->AsStream()) {
m_nStreams = 0;
m_pSingleStream = new CPDF_StreamAcc;
- m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, FALSE);
+ m_pSingleStream->LoadAllData(pStream, FALSE);
} else if (CPDF_Array* pArray = pContent->AsArray()) {
m_nStreams = pArray->GetCount();
if (m_nStreams == 0) {
@@ -1078,9 +1078,8 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
CPDF_Array* pContent =
m_pObjects->m_pFormDict->GetArray(FX_BSTRC("Contents"));
m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc;
- CPDF_Stream* pStreamObj =
- (CPDF_Stream*)(pContent ? pContent->GetElementValue(m_CurrentOffset)
- : NULL);
+ CPDF_Stream* pStreamObj = ToStream(
+ pContent ? pContent->GetElementValue(m_CurrentOffset) : nullptr);
m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE);
m_CurrentOffset++;
}

Powered by Google App Engine
This is Rietveld 408576698