diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdochandler.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 216 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 29 | ||||
-rw-r--r-- | xfa/fxjse/context.cpp | 25 | ||||
-rw-r--r-- | xfa/fxjse/context.h | 9 | ||||
-rw-r--r-- | xfa/fxjse/include/fxjse.h | 9 | ||||
-rw-r--r-- | xfa/fxjse/value.cpp | 14 | ||||
-rw-r--r-- | xfa/fxjse/value.h | 4 |
11 files changed, 166 insertions, 155 deletions
diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp index 53ce9c0e26..e65dd914d1 100644 --- a/xfa/fxfa/app/xfa_ffdochandler.cpp +++ b/xfa/fxfa/app/xfa_ffdochandler.cpp @@ -45,7 +45,7 @@ FX_BOOL CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, const CFX_WideStringC& wsScript, CFXJSE_Value* pRetValue, - CFXJSE_Value* pThisObject) { + CFXJSE_Value* pThisValue) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); if (!pXFADoc) return FALSE; @@ -56,6 +56,7 @@ FX_BOOL CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, return pScriptContext->RunScript( (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, pRetValue, - pThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(pThisObject, nullptr) - : nullptr); + pThisValue + ? static_cast<CXFA_Object*>(FXJSE_Value_ToObject(pThisValue, nullptr)) + : nullptr); } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 1745969927..e778d42994 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -502,7 +502,7 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Abs"); return; @@ -532,7 +532,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, } CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; FX_DOUBLE dSum = 0.0; @@ -603,7 +603,7 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ceil"); return; @@ -624,7 +624,7 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t iCount = 0; for (int32_t i = 0; i < args.GetLength(); i++) { @@ -687,7 +687,7 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Floor"); return; @@ -708,7 +708,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; FX_DOUBLE dMaxValue = 0.0; @@ -790,7 +790,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; FX_DOUBLE dMinValue = 0.0; @@ -891,7 +891,7 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 2) { std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); @@ -978,7 +978,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); uint8_t uPrecision = 0; @@ -1084,7 +1084,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); uint32_t uCount = 0; @@ -1177,7 +1177,7 @@ void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date"); } @@ -1232,7 +1232,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); } @@ -1277,7 +1277,7 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); } @@ -1299,7 +1299,7 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"IsoDate2Num"); } @@ -1310,7 +1310,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { @@ -1401,7 +1401,7 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"LocalDateFmt"); } @@ -1446,7 +1446,7 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"LocalTimeFmt"); } @@ -1595,7 +1595,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Date"); } @@ -1651,7 +1651,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2GMTime"); } @@ -1707,7 +1707,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Time"); } @@ -1728,7 +1728,7 @@ void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, ((iGMHour * 3600 + iGMMin * 60 + iGMSec) * 1000)); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time"); } @@ -1769,7 +1769,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, } if (!bFlags) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); IFX_Locale* pLocale = nullptr; @@ -1826,7 +1826,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time2Num"); } @@ -1871,7 +1871,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"TimeFmt"); } @@ -2209,7 +2209,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, const CFX_ByteStringC& szLocale, CFX_ByteString& strIsoDate) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return FALSE; @@ -2247,7 +2247,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(CFXJSE_Value* pThis, const CFX_ByteStringC& szLocale, CFX_ByteString& strIsoTime) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return FALSE; @@ -2288,7 +2288,7 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, const CFX_ByteStringC& szLocale, CFX_ByteString& strLocalDate) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return FALSE; @@ -2328,7 +2328,7 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, const CFX_ByteStringC& szLocale, CFX_ByteString& strLocalTime) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return FALSE; @@ -2370,7 +2370,7 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(CFXJSE_Value* pThis, const CFX_ByteStringC& szLocale, CFX_ByteString& strGMTTime) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return FALSE; @@ -2507,7 +2507,7 @@ void CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis, break; } CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return; @@ -2563,7 +2563,7 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis, break; } CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return; @@ -2668,7 +2668,7 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_DOUBLE nPrincipal = 0; @@ -2733,7 +2733,7 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_FLOAT nRate = 0; @@ -2771,7 +2771,7 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_DOUBLE nAmount = 0; @@ -2817,7 +2817,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 5) { FX_BOOL bFlags = FALSE; FX_FLOAT nPrincpalAmount = 0; @@ -2889,7 +2889,7 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); int32_t argc = args.GetLength(); if (argc > 2) { FX_BOOL bFlags = FALSE; @@ -2938,7 +2938,7 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_FLOAT nPrincipal = 0; @@ -2981,7 +2981,7 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 5) { FX_BOOL bFlags = FALSE; FX_FLOAT nPrincpalAmount = 0; @@ -3054,7 +3054,7 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_DOUBLE nAmount = 0; @@ -3096,7 +3096,7 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_FLOAT nFuture = 0; @@ -3135,7 +3135,7 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 3) { FX_BOOL bFlags = FALSE; FX_FLOAT nMount = 0; @@ -3174,7 +3174,7 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); if (argc > 1) { @@ -3251,7 +3251,7 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Choose"); } @@ -3267,7 +3267,7 @@ void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, FXJSE_Value_IsObject(argOne.get())); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Exists"); } @@ -3292,7 +3292,7 @@ void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"HasValue"); } @@ -3321,7 +3321,7 @@ void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, FX_Free(parametersValue); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Oneof"); } @@ -3360,7 +3360,7 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Within"); } @@ -3381,7 +3381,7 @@ void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, bCondition ? argFirstValue.get() : argSecondValue.get()); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"If"); } @@ -3392,7 +3392,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); @@ -3429,7 +3429,7 @@ void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); @@ -3610,7 +3610,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitType"); } @@ -3768,7 +3768,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitValue"); } @@ -3797,7 +3797,7 @@ void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"At"); } @@ -3830,7 +3830,7 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Concat"); } @@ -3874,7 +3874,7 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Decode"); } @@ -4150,7 +4150,7 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Encode"); } @@ -4453,7 +4453,7 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() >= 2) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); @@ -4559,7 +4559,7 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Left"); } @@ -4580,7 +4580,7 @@ void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Len"); } @@ -4625,7 +4625,7 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Lower"); } @@ -4648,7 +4648,7 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ltrim"); } @@ -4659,7 +4659,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 2) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); @@ -4851,7 +4851,7 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Replace"); } @@ -4883,7 +4883,7 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Right"); } @@ -4906,7 +4906,7 @@ void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Rtrim"); } @@ -4935,7 +4935,7 @@ void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Space"); } @@ -5055,7 +5055,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Str"); } @@ -5114,7 +5114,7 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Stuff"); } @@ -5159,7 +5159,7 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Substr"); } @@ -5183,7 +5183,7 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Uuid"); } @@ -5228,7 +5228,7 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Upper"); } @@ -5283,7 +5283,7 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"WordNum"); } @@ -5493,7 +5493,7 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 1) { CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { @@ -5529,7 +5529,7 @@ void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); int32_t argc = args.GetLength(); if ((argc >= 2) && (argc <= 5)) { CXFA_Document* pDoc = pContext->GetDocument(); @@ -5588,7 +5588,7 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); int32_t argc = args.GetLength(); if ((argc == 2) || (argc == 3)) { CXFA_Document* pDoc = pContext->GetDocument(); @@ -5631,7 +5631,7 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 2) { std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0); @@ -5691,7 +5691,7 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5713,7 +5713,7 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5752,7 +5752,7 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5790,7 +5790,7 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5800,7 +5800,7 @@ FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { FX_BOOL bRet = FALSE; CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); @@ -5852,7 +5852,7 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5887,7 +5887,7 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5918,7 +5918,7 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5953,7 +5953,7 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5975,7 +5975,7 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -5997,7 +5997,7 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -6019,7 +6019,7 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -6029,7 +6029,7 @@ void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 2) { std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); @@ -6064,7 +6064,7 @@ void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -6083,7 +6083,7 @@ void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -6102,7 +6102,7 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, } } else { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } } @@ -6112,7 +6112,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); if ((argc == 4) || (argc == 5)) { @@ -6261,7 +6261,7 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); if ((argc == 4) || (argc == 5)) { @@ -6405,7 +6405,7 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); CFX_ByteString argString; @@ -6465,7 +6465,7 @@ void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); @@ -6523,7 +6523,7 @@ void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); @@ -6575,7 +6575,7 @@ void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t iLength = 0; int32_t argc = args.GetLength(); @@ -6624,7 +6624,7 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( CFXJSE_Arguments& args, uint32_t index) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); ASSERT(index < (uint32_t)args.GetLength()); std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); @@ -6662,7 +6662,7 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( // static FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); FX_BOOL isNull = FALSE; if (FXJSE_Value_IsNull(arg)) { @@ -6708,7 +6708,7 @@ FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, CFXJSE_Value* arg) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t iLength = 0; if (FXJSE_Value_IsArray(arg)) { @@ -6750,7 +6750,7 @@ void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, int32_t& iCount, int32_t iStart) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); iCount = 0; int32_t argc = args.GetLength(); @@ -6875,7 +6875,7 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( const CFX_ByteStringC& szAccessorName) { FX_BOOL bFlags = FALSE; CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return bFlags; @@ -6906,7 +6906,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); int32_t iRet = -1; CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); CXFA_Document* pDoc = pContext->GetDocument(); if (!pDoc) { return iRet; @@ -6958,7 +6958,7 @@ void CXFA_FM2JSContext::ParseResolveResult( int32_t& iSize, FX_BOOL& bAttribute) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); iSize = 0; resultValues = nullptr; @@ -6999,7 +6999,7 @@ void CXFA_FM2JSContext::ParseResolveResult( int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t iValue = 0; if (FXJSE_Value_IsArray(pValue)) { @@ -7037,7 +7037,7 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); FX_FLOAT fRet = 0.0f; if (FXJSE_Value_IsArray(arg)) { @@ -7075,7 +7075,7 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* arg) { CXFA_FM2JSContext* pContext = - (CXFA_FM2JSContext*)FXJSE_Value_ToObject(pThis, nullptr); + static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); FX_DOUBLE dRet = 0; if (FXJSE_Value_IsArray(arg)) { diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 3a53533991..2af67f62cf 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -10,7 +10,7 @@ #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxjse/cfxjse_arguments.h" -class CXFA_FM2JSContext { +class CXFA_FM2JSContext : public CFXJSE_HostObject { public: static void Abs(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 8fc074c08f..17b624fb13 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -42,7 +42,7 @@ enum XFA_OBJECTTYPE { XFA_NODEFLAG_LayoutGeneratedNode = 0x10000, }; -class CXFA_Object { +class CXFA_Object : public CFXJSE_HostObject { public: CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags); virtual ~CXFA_Object() {} diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index 350588f8b5..da348f7a36 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -48,8 +48,8 @@ class CXFA_ValueArray : public CFX_ArrayTemplate<CFXJSE_Value*> { void GetAttributeObject(CXFA_ObjArray& objArray) { for (int32_t i = 0; i < GetSize(); i++) { - CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i), NULL); - objArray.Add(pObject); + objArray.Add( + static_cast<CXFA_Object*>(FXJSE_Value_ToObject(GetAt(i), nullptr))); } } 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) { diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp index d40e2af223..a277d4d412 100644 --- a/xfa/fxjse/context.cpp +++ b/xfa/fxjse/context.cpp @@ -16,27 +16,29 @@ v8::Local<v8::Object> FXJSE_GetGlobalObjectFromContext( } void FXJSE_UpdateObjectBinding(v8::Local<v8::Object>& hObject, - void* lpNewBinding) { + CFXJSE_HostObject* lpNewBinding) { ASSERT(!hObject.IsEmpty()); ASSERT(hObject->InternalFieldCount() > 0); - hObject->SetAlignedPointerInInternalField(0, lpNewBinding); + hObject->SetAlignedPointerInInternalField(0, + static_cast<void*>(lpNewBinding)); } -void* FXJSE_RetrieveObjectBinding(const v8::Local<v8::Object>& hJSObject, - CFXJSE_Class* lpClass) { +CFXJSE_HostObject* FXJSE_RetrieveObjectBinding( + const v8::Local<v8::Object>& hJSObject, + CFXJSE_Class* lpClass) { ASSERT(!hJSObject.IsEmpty()); if (!hJSObject->IsObject()) { - return NULL; + return nullptr; } v8::Local<v8::Object> hObject = hJSObject; if (hObject->InternalFieldCount() == 0) { v8::Local<v8::Value> hProtoObject = hObject->GetPrototype(); if (hProtoObject.IsEmpty() || !hProtoObject->IsObject()) { - return NULL; + return nullptr; } hObject = hProtoObject.As<v8::Object>(); if (hObject->InternalFieldCount() == 0) { - return NULL; + return nullptr; } } if (lpClass) { @@ -44,16 +46,17 @@ void* FXJSE_RetrieveObjectBinding(const v8::Local<v8::Object>& hJSObject, v8::Local<v8::FunctionTemplate>::New( lpClass->GetContext()->GetRuntime(), lpClass->GetTemplate()); if (!hClass->HasInstance(hObject)) { - return NULL; + return nullptr; } } - return hObject->GetAlignedPointerFromInternalField(0); + return static_cast<CFXJSE_HostObject*>( + hObject->GetAlignedPointerFromInternalField(0)); } CFXJSE_Context* FXJSE_Context_Create( v8::Isolate* pIsolate, const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass, - void* lpGlobalObject) { + CFXJSE_HostObject* lpGlobalObject) { return CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject); } @@ -153,7 +156,7 @@ v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, CFXJSE_Context* CFXJSE_Context::Create( v8::Isolate* pIsolate, const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass, - void* lpGlobalObject) { + CFXJSE_HostObject* lpGlobalObject) { CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate); CFXJSE_Context* pContext = new CFXJSE_Context(pIsolate); CFXJSE_Class* lpGlobalClassObj = NULL; diff --git a/xfa/fxjse/context.h b/xfa/fxjse/context.h index 79e5e0a740..e475752dad 100644 --- a/xfa/fxjse/context.h +++ b/xfa/fxjse/context.h @@ -23,7 +23,7 @@ class CFXJSE_Context { static CFXJSE_Context* Create( v8::Isolate* pIsolate, const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass = nullptr, - void* lpGlobalObject = nullptr); + CFXJSE_HostObject* lpGlobalObject = nullptr); ~CFXJSE_Context(); V8_INLINE v8::Isolate* GetRuntime(void) { return m_pIsolate; } @@ -54,9 +54,10 @@ v8::Local<v8::Object> FXJSE_GetGlobalObjectFromContext( const v8::Local<v8::Context>& hContext); void FXJSE_UpdateObjectBinding(v8::Local<v8::Object>& hObject, - void* lpNewBinding = nullptr); + CFXJSE_HostObject* lpNewBinding = nullptr); -void* FXJSE_RetrieveObjectBinding(const v8::Local<v8::Object>& hJSObject, - CFXJSE_Class* lpClass = nullptr); +CFXJSE_HostObject* FXJSE_RetrieveObjectBinding( + const v8::Local<v8::Object>& hJSObject, + CFXJSE_Class* lpClass = nullptr); #endif // XFA_FXJSE_CONTEXT_H_ diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h index e432858603..4a85251c03 100644 --- a/xfa/fxjse/include/fxjse.h +++ b/xfa/fxjse/include/fxjse.h @@ -16,6 +16,8 @@ class CFXJSE_Class; class CFXJSE_Context; class CFXJSE_Value; +class CFXJSE_HostObject {}; // C++ object which can be wrapped by CFXJSE_value. + typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args); @@ -73,7 +75,7 @@ void FXJSE_Runtime_Release(v8::Isolate* pIsolate, bool bOwnedRuntime); CFXJSE_Context* FXJSE_Context_Create( v8::Isolate* pIsolate, const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass, - void* lpGlobalObject); + CFXJSE_HostObject* lpGlobalObject); void FXJSE_Context_Release(CFXJSE_Context* pContext); CFXJSE_Value* FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext); @@ -98,7 +100,8 @@ double FXJSE_Value_ToDouble(CFXJSE_Value* pValue); int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue); void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue, CFX_ByteString& szStrOutput); -void* FXJSE_Value_ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass); +CFXJSE_HostObject* FXJSE_Value_ToObject(CFXJSE_Value* pValue, + CFXJSE_Class* pClass); void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue); void FXJSE_Value_SetNull(CFXJSE_Value* pValue); @@ -109,7 +112,7 @@ void FXJSE_Value_SetInteger(CFXJSE_Value* pValue, int32_t nInteger); void FXJSE_Value_SetFloat(CFXJSE_Value* pValue, FX_FLOAT fFloat); void FXJSE_Value_SetDouble(CFXJSE_Value* pValue, double dDouble); void FXJSE_Value_SetObject(CFXJSE_Value* pValue, - void* lpObject, + CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass); void FXJSE_Value_SetArray(CFXJSE_Value* pValue, uint32_t uValueCount, diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp index 6cdbb14aa3..b369c0bf3b 100644 --- a/xfa/fxjse/value.cpp +++ b/xfa/fxjse/value.cpp @@ -64,7 +64,8 @@ int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue) { return pValue->ToInteger(); } -void* FXJSE_Value_ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass) { +CFXJSE_HostObject* FXJSE_Value_ToObject(CFXJSE_Value* pValue, + CFXJSE_Class* pClass) { return pValue->ToObject(pClass); } @@ -98,14 +99,14 @@ void FXJSE_Value_SetDouble(CFXJSE_Value* pValue, double dDouble) { } void FXJSE_Value_SetObject(CFXJSE_Value* pValue, - void* lpObject, + CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass) { if (!pClass) { ASSERT(!lpObject); pValue->SetJSObject(); - } else { - pValue->SetHostObject(lpObject, pClass); + return; } + pValue->SetHostObject(lpObject, pClass); } void FXJSE_Value_SetArray(CFXJSE_Value* pValue, @@ -197,7 +198,7 @@ void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, pIsolate->ThrowException(hError); } -void* CFXJSE_Value::ToObject(CFXJSE_Class* lpClass) const { +CFXJSE_HostObject* CFXJSE_Value::ToObject(CFXJSE_Class* lpClass) const { ASSERT(!m_hValue.IsEmpty()); CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); @@ -256,7 +257,8 @@ void CFXJSE_Value::SetFloat(FX_FLOAT fFloat) { m_hValue.Reset(m_pIsolate, pValue); } -void CFXJSE_Value::SetHostObject(void* lpObject, CFXJSE_Class* lpClass) { +void CFXJSE_Value::SetHostObject(CFXJSE_HostObject* lpObject, + CFXJSE_Class* lpClass) { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); ASSERT(lpClass); v8::Local<v8::FunctionTemplate> hClass = diff --git a/xfa/fxjse/value.h b/xfa/fxjse/value.h index 2dec5824b3..362cd64ace 100644 --- a/xfa/fxjse/value.h +++ b/xfa/fxjse/value.h @@ -141,7 +141,7 @@ class CFXJSE_Value { v8::String::Utf8Value hStringVal(hString); szStrOutput = *hStringVal; } - void* ToObject(CFXJSE_Class* lpClass) const; + CFXJSE_HostObject* ToObject(CFXJSE_Class* lpClass) const; V8_INLINE void SetUndefined() { CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); @@ -182,7 +182,7 @@ class CFXJSE_Value { v8::Local<v8::Value> hValue = v8::Object::New(m_pIsolate); m_hValue.Reset(m_pIsolate, hValue); } - void SetHostObject(void* lpObject, CFXJSE_Class* lpClass); + void SetHostObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* lpClass); void SetArray(uint32_t uValueCount, CFXJSE_Value** rgValues); void SetDate(double dDouble); |