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
diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp
index 53ce9c0..e65dd91 100644
--- a/xfa/fxfa/app/xfa_ffdochandler.cpp
+++ b/xfa/fxfa/app/xfa_ffdochandler.cpp
@@ -45,7 +45,7 @@
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 @@
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 1745969..e778d42 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -502,7 +502,7 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
((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 @@
}
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 @@
}
} 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 @@
}
} 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
} 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 @@
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 @@
}
} 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 @@
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 @@
}
} 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 @@
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 @@
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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
}
} 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 @@
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 @@
}
} 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 @@
}
} 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 @@
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 @@
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 @@
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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
}
} 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 @@
}
} 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 @@
}
} 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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_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 3a53533..2af67f6 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 8fc074c..17b624f 100644
--- a/xfa/fxfa/parser/xfa_object.h
+++ b/xfa/fxfa/parser/xfa_object.h
@@ -42,7 +42,7 @@
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 350588f..da348f7 100644
--- a/xfa/fxfa/parser/xfa_script.h
+++ b/xfa/fxfa/parser/xfa_script.h
@@ -48,8 +48,8 @@
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 fb42e80..eb71097 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -146,7 +146,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
(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 d40e2af..a277d4d 100644
--- a/xfa/fxjse/context.cpp
+++ b/xfa/fxjse/context.cpp
@@ -16,27 +16,29 @@
}
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 @@
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 @@
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 79e5e0a..e475752 100644
--- a/xfa/fxjse/context.h
+++ b/xfa/fxjse/context.h
@@ -23,7 +23,7 @@
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 @@
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 e432858..4a85251 100644
--- a/xfa/fxjse/include/fxjse.h
+++ b/xfa/fxjse/include/fxjse.h
@@ -16,6 +16,8 @@
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 @@
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 @@
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_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 6cdbb14..b369c0b 100644
--- a/xfa/fxjse/value.cpp
+++ b/xfa/fxjse/value.cpp
@@ -64,7 +64,8 @@
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_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 @@
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 @@
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 2dec582..362cd64 100644
--- a/xfa/fxjse/value.h
+++ b/xfa/fxjse/value.h
@@ -141,7 +141,7 @@
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 @@
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);