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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 1422513004: Merge to XFA: Add type cast definitions for CPDF_Stream. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 7aa2cf8aa3bb7a56e68923bf9741cae0eb734495..3295b7f9e034875582758e7efa8cffddfc95c80d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -716,12 +716,12 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
return;
}
}
- CPDF_Stream* pXObject =
- (CPDF_Stream*)FindResourceObj(FX_BSTRC("XObject"), name);
- if (pXObject == NULL || pXObject->GetType() != PDFOBJ_STREAM) {
+ CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name));
+ if (!pXObject) {
m_bResourceMissing = TRUE;
return;
}
+
CFX_ByteStringC type =
pXObject->GetDict()
? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype"))
@@ -1151,7 +1151,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() {
bbox = m_BBox;
}
if (pShading->m_ShadingType >= 4) {
- bbox.Intersect(_GetShadingBBox((CPDF_Stream*)pShading->m_pShadingObj,
+ bbox.Intersect(_GetShadingBBox(ToStream(pShading->m_pShadingObj),
pShading->m_ShadingType, &pObj->m_Matrix,
pShading->m_pFunctions, pShading->m_nFuncs,
pShading->m_pCS));
@@ -1262,8 +1262,7 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
FX_BOOL bShading) {
CPDF_Object* pPattern = FindResourceObj(
bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name);
- if (pPattern == NULL ||
- (!pPattern->IsDictionary() && pPattern->GetType() != PDFOBJ_STREAM)) {
+ if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) {
m_bResourceMissing = TRUE;
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698