summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_script_imp.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-31 14:22:09 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-31 14:22:09 -0700
commit29adee77d4a7566bc6832cc825198c0571426163 (patch)
treee8fd009fe853b4d8aad499d6e92cfff8f7dd6efa /xfa/fxfa/parser/xfa_script_imp.cpp
parentfb96900eeea15b252245b0caf4330a5ade369172 (diff)
downloadpdfium-29adee77d4a7566bc6832cc825198c0571426163.tar.xz
Replace void* with CFXJSE_HostObect and make wrapped objects inherit from it
This will avoid a re-occurrence of BUG 613607 should someone again optimize away CXFA_Object's virtual dtor. Review-Url: https://codereview.chromium.org/2019333006
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index fb42e802be..eb71097cdf 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -146,7 +146,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
CXFA_Object* lpOrginalNode =
- (CXFA_Object*)FXJSE_Value_ToObject(pObject, nullptr);
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pObject, nullptr));
CXFA_Document* pDoc = lpOrginalNode->GetDocument();
CXFA_ScriptContext* lpScriptContext =
(CXFA_ScriptContext*)pDoc->GetScriptContext();
@@ -203,7 +203,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
CXFA_Object* pOriginalObject =
- (CXFA_Object*)FXJSE_Value_ToObject(pObject, nullptr);
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pObject, nullptr));
CXFA_Document* pDoc = pOriginalObject->GetDocument();
CXFA_ScriptContext* lpScriptContext =
(CXFA_ScriptContext*)pDoc->GetScriptContext();
@@ -258,7 +258,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pReturnValue) {
CXFA_Object* pOriginalObject =
- (CXFA_Object*)FXJSE_Value_ToObject(pOriginalValue, nullptr);
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pOriginalValue, nullptr));
if (!pOriginalObject) {
FXJSE_Value_SetUndefined(pReturnValue);
return;
@@ -304,7 +304,7 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pReturnValue) {
CXFA_Object* pOriginalObject =
- (CXFA_Object*)FXJSE_Value_ToObject(pOriginalValue, nullptr);
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pOriginalValue, nullptr));
if (!pOriginalObject)
return;
@@ -356,7 +356,7 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter(
const CFX_ByteStringC& szPropName,
FX_BOOL bQueryIn) {
CXFA_Object* pObject =
- (CXFA_Object*)FXJSE_Value_ToObject(pOriginalValue, nullptr);
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pOriginalValue, nullptr));
if (!pObject)
return FXJSE_ClassPropType_None;
@@ -379,7 +379,7 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter(
const CFX_ByteStringC& szPropName,
FX_BOOL bQueryIn) {
CXFA_Object* pObject =
- (CXFA_Object*)FXJSE_Value_ToObject(pOriginalValue, nullptr);
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pOriginalValue, nullptr));
if (!pObject)
return FXJSE_ClassPropType_None;
@@ -396,7 +396,8 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter(
void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args) {
- CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(pThis, nullptr);
+ CXFA_Object* pObject =
+ static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pThis, nullptr));
if (!pObject)
return;
@@ -441,11 +442,11 @@ CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext(
}
CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject,
FX_BOOL bScriptNode) {
- if (pObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) {
- return bScriptNode ? ((CXFA_ThisProxy*)pObject)->GetScriptNode()
- : ((CXFA_ThisProxy*)pObject)->GetThisNode();
- }
- return pObject;
+ if (pObject->GetObjectType() != XFA_OBJECTTYPE_VariablesThis)
+ return pObject;
+
+ CXFA_ThisProxy* pProxy = static_cast<CXFA_ThisProxy*>(pObject);
+ return bScriptNode ? pProxy->GetScriptNode() : pProxy->GetThisNode();
}
FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) {
@@ -652,8 +653,8 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
(rndFind.m_Nodes[0]->*(rndFind.m_pScriptAttribute->lpfnCallback))(
pValue.get(), FALSE,
(XFA_ATTRIBUTE)rndFind.m_pScriptAttribute->eAttribute);
- rndFind.m_Nodes.SetAt(
- 0, (CXFA_Object*)FXJSE_Value_ToObject(pValue.get(), nullptr));
+ rndFind.m_Nodes.SetAt(0, static_cast<CXFA_Object*>(FXJSE_Value_ToObject(
+ pValue.get(), nullptr)));
}
int32_t iSize = m_upObjectArray.GetSize();
if (iSize) {