diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 13:19:19 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 13:19:19 -0400 |
commit | 4816432671eef6467354aa252f22bb80acc315b7 (patch) | |
tree | 403313130206e70abf8ceae78353042a38221bec /core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | |
parent | 8b8dfd7934d669b2c74a0502f82387e5df0f573b (diff) | |
download | pdfium-4816432671eef6467354aa252f22bb80acc315b7.tar.xz |
Add type cast definitions for CPDF_Dictionary.
This CL adds ToCPDFDictionary type definitions and updates one file to use
instead of straight casts. I had to fix two places where we'd casted off the
constness of the original pointer.
BUG=pdfium:201
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1399233003 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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 f11a2bb8d1..6d071f3ae0 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; } |