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

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

Issue 1420583003: Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (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
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
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 f11a2bb8d1694b9b8d9fc2e817a7937026bafb2d..6d071f3ae065eb80252786227b3657af13c8c775 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 (pObject && pObject->GetType() == PDFOBJ_DICTIONARY) {
+ if (ToDictionary(pObject)) {
pGeneralState->m_pSoftMask = pObject;
FXSYS_memcpy(pGeneralState->m_SMaskMatrix,
&pParser->GetCurStates()->m_CTM, sizeof(CPDF_Matrix));
@@ -599,20 +599,21 @@ CPDF_ContentMarkItem::CPDF_ContentMarkItem(const CPDF_ContentMarkItem& src) {
m_MarkName = src.m_MarkName;
m_ParamType = src.m_ParamType;
if (m_ParamType == DirectDict) {
- m_pParam = ((CPDF_Dictionary*)src.m_pParam)->Clone();
+ m_pParam = ToDictionary(static_cast<CPDF_Object*>(src.m_pParam))->Clone();
} else {
m_pParam = src.m_pParam;
}
}
CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {
if (m_ParamType == DirectDict && m_pParam) {
- ((CPDF_Dictionary*)m_pParam)->Release();
+ ToDictionary(static_cast<CPDF_Object*>(m_pParam))->Release();
}
}
FX_BOOL CPDF_ContentMarkItem::HasMCID() const {
if (m_pParam &&
(m_ParamType == DirectDict || m_ParamType == PropertiesDict)) {
- return ((CPDF_Dictionary*)m_pParam)->KeyExist(FX_BSTRC("MCID"));
+ return ToDictionary(static_cast<CPDF_Object*>(m_pParam))
+ ->KeyExist(FX_BSTRC("MCID"));
}
return FALSE;
}
@@ -627,7 +628,8 @@ int CPDF_ContentMarkData::GetMCID() const {
type = m_Marks[i].GetParamType();
if (type == CPDF_ContentMarkItem::PropertiesDict ||
type == CPDF_ContentMarkItem::DirectDict) {
- CPDF_Dictionary* pDict = (CPDF_Dictionary*)m_Marks[i].GetParam();
+ CPDF_Dictionary* pDict =
+ ToDictionary(static_cast<CPDF_Object*>(m_Marks[i].GetParam()));
if (pDict->KeyExist(FX_BSTRC("MCID"))) {
return pDict->GetInteger(FX_BSTRC("MCID"));
}
@@ -677,7 +679,7 @@ FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
pDict = NULL;
if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict ||
item.GetParamType() == CPDF_ContentMarkItem::DirectDict) {
- pDict = (CPDF_Dictionary*)item.GetParam();
+ pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
}
return TRUE;
}
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698