summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-20 13:30:34 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-20 13:30:34 -0400
commit937840e1722d1f2b77d80575d6e710d760662c9c (patch)
treeff065615d6d91abe8e5c788da3a08386fc2d25d6 /core/src/fpdfapi/fpdf_page
parentc29bee029cd5fe3f8a4ceb580235ac2d0e5ce8fd (diff)
downloadpdfium-937840e1722d1f2b77d80575d6e710d760662c9c.tar.xz
Revert "Add type cast definitions for CPDF_Dictionary."
This reverts commit 4816432671eef6467354aa252f22bb80acc315b7. Reason, broke the javascript_test Rendering PDF file /mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf. Non-linearized path... FAILURE: document_methods.in; Command '['/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/pdfium_test', '/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf']' returned non-zero exit status -11 BUG=pdfium:201 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1412413002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp23
4 files changed, 24 insertions, 24 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index d66a9efdaa..224c99bb69 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -818,8 +818,8 @@ CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
type = ((CPDF_Stream*)pFuncObj)
->GetDict()
->GetInteger(FX_BSTRC("FunctionType"));
- } else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) {
- type = pDict->GetInteger(FX_BSTRC("FunctionType"));
+ } else if (pFuncObj->GetType() == PDFOBJ_DICTIONARY) {
+ type = ((CPDF_Dictionary*)pFuncObj)->GetInteger(FX_BSTRC("FunctionType"));
} else {
return NULL;
}
@@ -853,7 +853,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
if (pObj->GetType() == PDFOBJ_STREAM) {
pDict = ((CPDF_Stream*)pObj)->GetDict();
} else {
- pDict = pObj->AsDictionary();
+ pDict = (CPDF_Dictionary*)pObj;
}
CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain"));
if (pDomains == NULL) {
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index 6d071f3ae0..f11a2bb8d1 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -530,7 +530,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
break;
}
case FXBSTR_ID('S', 'M', 'a', 's'):
- if (ToDictionary(pObject)) {
+ if (pObject && pObject->GetType() == PDFOBJ_DICTIONARY) {
pGeneralState->m_pSoftMask = pObject;
FXSYS_memcpy(pGeneralState->m_SMaskMatrix,
&pParser->GetCurStates()->m_CTM, sizeof(CPDF_Matrix));
@@ -599,21 +599,20 @@ CPDF_ContentMarkItem::CPDF_ContentMarkItem(const CPDF_ContentMarkItem& src) {
m_MarkName = src.m_MarkName;
m_ParamType = src.m_ParamType;
if (m_ParamType == DirectDict) {
- m_pParam = ToDictionary(static_cast<CPDF_Object*>(src.m_pParam))->Clone();
+ m_pParam = ((CPDF_Dictionary*)src.m_pParam)->Clone();
} else {
m_pParam = src.m_pParam;
}
}
CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {
if (m_ParamType == DirectDict && m_pParam) {
- ToDictionary(static_cast<CPDF_Object*>(m_pParam))->Release();
+ ((CPDF_Dictionary*)m_pParam)->Release();
}
}
FX_BOOL CPDF_ContentMarkItem::HasMCID() const {
if (m_pParam &&
(m_ParamType == DirectDict || m_ParamType == PropertiesDict)) {
- return ToDictionary(static_cast<CPDF_Object*>(m_pParam))
- ->KeyExist(FX_BSTRC("MCID"));
+ return ((CPDF_Dictionary*)m_pParam)->KeyExist(FX_BSTRC("MCID"));
}
return FALSE;
}
@@ -628,8 +627,7 @@ int CPDF_ContentMarkData::GetMCID() const {
type = m_Marks[i].GetParamType();
if (type == CPDF_ContentMarkItem::PropertiesDict ||
type == CPDF_ContentMarkItem::DirectDict) {
- CPDF_Dictionary* pDict =
- ToDictionary(static_cast<CPDF_Object*>(m_Marks[i].GetParam()));
+ CPDF_Dictionary* pDict = (CPDF_Dictionary*)m_Marks[i].GetParam();
if (pDict->KeyExist(FX_BSTRC("MCID"))) {
return pDict->GetInteger(FX_BSTRC("MCID"));
}
@@ -679,7 +677,7 @@ FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
pDict = NULL;
if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict ||
item.GetParamType() == CPDF_ContentMarkItem::DirectDict) {
- pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
+ pDict = (CPDF_Dictionary*)item.GetParam();
}
return TRUE;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
index 9cdf00e717..e9f70c14db 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -52,7 +52,8 @@ CPDF_Image* CPDF_Image::Clone() {
pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(),
m_bInline);
if (m_bInline) {
- pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE)));
+ CPDF_Dictionary* pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE);
+ pImage->SetInlineDict(pInlineDict);
}
return pImage;
}
@@ -85,7 +86,7 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) {
m_bInline = bInline;
CPDF_Dictionary* pDict = pStream->GetDict();
if (m_bInline) {
- m_pInlineDict = ToDictionary(pDict->Clone());
+ m_pInlineDict = (CPDF_Dictionary*)pDict->Clone();
}
m_pOC = pDict->GetDict(FX_BSTRC("OC"));
m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) ||
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index ffa5e62a07..127fb93250 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -418,9 +418,11 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
}
bDirect = FALSE;
}
- if (CPDF_Dictionary* pDict = pProperty->AsDictionary()) {
- m_CurContentMark.GetModify()->AddMark(tag, pDict, bDirect);
+ if (pProperty->GetType() != PDFOBJ_DICTIONARY) {
+ return;
}
+ m_CurContentMark.GetModify()->AddMark(tag, (CPDF_Dictionary*)pProperty,
+ bDirect);
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent() {
if (!m_Options.m_bMarkedContent) {
@@ -485,7 +487,7 @@ static CFX_ByteStringC _PDF_FindFullName(const _FX_BSTR* table,
void _PDF_ReplaceAbbr(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
- CPDF_Dictionary* pDict = pObj->AsDictionary();
+ CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
FX_POSITION pos = pDict->GetStartPos();
while (pos) {
CFX_ByteString key;
@@ -548,7 +550,7 @@ static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table,
void _PDF_ReplaceFull(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
- CPDF_Dictionary* pDict = pObj->AsDictionary();
+ CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
FX_POSITION pos = pDict->GetStartPos();
while (pos) {
CFX_ByteString key;
@@ -884,8 +886,8 @@ void CPDF_StreamContentParser::Handle_SetGray_Stroke() {
void CPDF_StreamContentParser::Handle_SetExtendGraphState() {
CFX_ByteString name = GetString(0);
CPDF_Dictionary* pGS =
- ToDictionary(FindResourceObj(FX_BSTRC("ExtGState"), name));
- if (!pGS) {
+ (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("ExtGState"), name);
+ if (pGS == NULL || pGS->GetType() != PDFOBJ_DICTIONARY) {
m_bResourceMissing = TRUE;
return;
}
@@ -1215,12 +1217,11 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
}
CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
CPDF_Dictionary* pFontDict =
- ToDictionary(FindResourceObj(FX_BSTRC("Font"), name));
- if (!pFontDict) {
+ (CPDF_Dictionary*)FindResourceObj(FX_BSTRC("Font"), name);
+ if (pFontDict == NULL || pFontDict->GetType() != PDFOBJ_DICTIONARY) {
m_bResourceMissing = TRUE;
return CPDF_Font::GetStockFont(m_pDocument, FX_BSTRC("Helvetica"));
}
-
CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict);
if (pFont && pFont->GetType3Font()) {
pFont->GetType3Font()->SetPageResources(m_pResources);
@@ -1260,8 +1261,8 @@ 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 == NULL || (pPattern->GetType() != PDFOBJ_DICTIONARY &&
+ pPattern->GetType() != PDFOBJ_STREAM)) {
m_bResourceMissing = TRUE;
return NULL;
}