Index: xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
index 0aa0599f23b8ccf624236e8185623546c2e07536..6629de09d4fbef0163ad80c4c1b3315573170d76 100644 |
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
@@ -649,8 +649,8 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, |
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); |
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); |
if (FXJSE_Value_IsNull(propertyValue.get())) { |
- for (int32_t i = 2; i < iLength; i++) { |
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, |
+ for (int32_t j = 2; j < iLength; j++) { |
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, |
jsObjectValue.get()); |
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
if (!FXJSE_Value_IsNull(newPropertyValue.get())) |
@@ -659,8 +659,8 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, |
} else { |
CFX_ByteString propertyStr; |
FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); |
- for (int32_t i = 2; i < iLength; i++) { |
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, |
+ for (int32_t j = 2; j < iLength; j++) { |
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, |
jsObjectValue.get()); |
FXJSE_Value_GetObjectProp(jsObjectValue.get(), |
propertyStr.AsStringC(), |
@@ -733,8 +733,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, |
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); |
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); |
if (FXJSE_Value_IsNull(propertyValue.get())) { |
- for (int32_t i = 2; i < iLength; i++) { |
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, |
+ for (int32_t j = 2; j < iLength; j++) { |
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, |
jsObjectValue.get()); |
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
if (FXJSE_Value_IsNull(newPropertyValue.get())) |
@@ -747,8 +747,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, |
} else { |
CFX_ByteString propertyStr; |
FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); |
- for (int32_t i = 2; i < iLength; i++) { |
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, |
+ for (int32_t j = 2; j < iLength; j++) { |
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, |
jsObjectValue.get()); |
FXJSE_Value_GetObjectProp(jsObjectValue.get(), |
propertyStr.AsStringC(), |
@@ -810,8 +810,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, |
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); |
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); |
if (FXJSE_Value_IsNull(propertyValue.get())) { |
- for (int32_t i = 2; i < iLength; i++) { |
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, |
+ for (int32_t j = 2; j < iLength; j++) { |
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, |
jsObjectValue.get()); |
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
if (!FXJSE_Value_IsNull(newPropertyValue.get())) { |
@@ -829,8 +829,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, |
} else { |
CFX_ByteString propertyStr; |
FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); |
- for (int32_t i = 2; i < iLength; i++) { |
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i, |
+ for (int32_t j = 2; j < iLength; j++) { |
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, |
jsObjectValue.get()); |
FXJSE_Value_GetObjectProp(jsObjectValue.get(), |
propertyStr.AsStringC(), |
@@ -2075,21 +2075,21 @@ FX_BOOL CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, |
} |
if (*(pData + iIndex) == '.') { |
++iIndex; |
- FX_CHAR strTemp[4]; |
- strTemp[3] = '\0'; |
+ FX_CHAR strSec[4]; |
+ strSec[3] = '\0'; |
if (*(pData + iIndex) > '9' || *(pData + iIndex) < '0') { |
return iRet; |
} |
- strTemp[0] = *(pData + iIndex); |
+ strSec[0] = *(pData + iIndex); |
if (*(pData + iIndex + 1) > '9' || *(pData + iIndex + 1) < '0') { |
return iRet; |
} |
- strTemp[1] = *(pData + iIndex + 1); |
+ strSec[1] = *(pData + iIndex + 1); |
if (*(pData + iIndex + 2) > '9' || *(pData + iIndex + 2) < '0') { |
return iRet; |
} |
- strTemp[2] = *(pData + iIndex + 2); |
- iMilliSecond = FXSYS_atoi(strTemp); |
+ strSec[2] = *(pData + iIndex + 2); |
+ iMilliSecond = FXSYS_atoi(strSec); |
if (iMilliSecond > 100) { |
iMilliSecond = 0; |
return iRet; |
@@ -3175,9 +3175,9 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, |
CFXJSE_Arguments& args) { |
CXFA_FM2JSContext* pContext = |
static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
- v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
int32_t argc = args.GetLength(); |
if (argc > 1) { |
+ v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
FX_BOOL argOneIsNull = FALSE; |
int32_t iIndex = 0; |
@@ -3250,8 +3250,6 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, |
} |
} |
} else { |
- CXFA_FM2JSContext* pContext = |
- static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
L"Choose"); |
} |
@@ -3393,8 +3391,8 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, |
CFXJSE_Arguments& args) { |
CXFA_FM2JSContext* pContext = |
static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
- v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
if (args.GetLength() == 1) { |
+ v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); |
CFX_ByteString utf8ScriptString; |
ValueToUTF8String(scriptValue.get(), utf8ScriptString); |
@@ -3407,16 +3405,16 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, |
CXFA_FM2JSContext::Translate( |
CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), |
wsJavaScriptBuf, wsError); |
- CFXJSE_Context* pContext = |
+ CFXJSE_Context* pNewContext = |
FXJSE_Context_Create(pIsolate, nullptr, nullptr); |
std::unique_ptr<CFXJSE_Value> returnValue(new CFXJSE_Value(pIsolate)); |
javaScript = wsJavaScriptBuf.AsStringC(); |
FXJSE_ExecuteScript( |
- pContext, |
+ pNewContext, |
FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(), |
returnValue.get()); |
FXJSE_Value_Set(args.GetReturnValue(), returnValue.get()); |
- FXJSE_Context_Release(pContext); |
+ FXJSE_Context_Release(pNewContext); |
} |
} else { |
pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
@@ -3668,32 +3666,32 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, |
GetSimpleValue(pThis, args, 1); |
CFX_ByteString unitTempString; |
ValueToUTF8String(unitValue.get(), unitTempString); |
- const FX_CHAR* pData = unitTempString.c_str(); |
- int32_t u = 0; |
- while (*(pData + u) == ' ' || *(pData + u) == 0x09 || |
- *(pData + u) == 0x0B || *(pData + u) == 0x0C || |
- *(pData + u) == 0x0A || *(pData + u) == 0x0D) { |
- ++u; |
+ const FX_CHAR* pChar = unitTempString.c_str(); |
+ int32_t uVal = 0; |
+ while (*(pChar + uVal) == ' ' || *(pChar + uVal) == 0x09 || |
+ *(pChar + uVal) == 0x0B || *(pChar + uVal) == 0x0C || |
+ *(pChar + uVal) == 0x0A || *(pChar + uVal) == 0x0D) { |
+ ++uVal; |
} |
- while (u < unitTempString.GetLength()) { |
- if ((*(pData + u) > '9' || *(pData + u) < '0') && |
- *(pData + u) != '.') { |
+ while (uVal < unitTempString.GetLength()) { |
+ if ((*(pChar + uVal) > '9' || *(pChar + uVal) < '0') && |
+ *(pChar + uVal) != '.') { |
break; |
} |
- ++u; |
+ ++uVal; |
} |
- while (*(pData + u) == ' ' || *(pData + u) == 0x09 || |
- *(pData + u) == 0x0B || *(pData + u) == 0x0C || |
- *(pData + u) == 0x0A || *(pData + u) == 0x0D) { |
- ++u; |
+ while (*(pChar + uVal) == ' ' || *(pChar + uVal) == 0x09 || |
+ *(pChar + uVal) == 0x0B || *(pChar + uVal) == 0x0C || |
+ *(pChar + uVal) == 0x0A || *(pChar + uVal) == 0x0D) { |
+ ++uVal; |
} |
- int32_t uLen = unitTempString.GetLength(); |
- while (u < uLen) { |
- if (*(pData + u) == ' ') { |
+ int32_t uValLen = unitTempString.GetLength(); |
+ while (uVal < uValLen) { |
+ if (*(pChar + uVal) == ' ') { |
break; |
} |
- strUnit += (*(pData + u)); |
- ++u; |
+ strUnit += (*(pChar + uVal)); |
+ ++uVal; |
} |
strUnit.MakeLower(); |
} else { |
@@ -4775,10 +4773,10 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, |
} else { |
wsTestPattern = FX_WSTRC(L"text{") + wsPattern; |
wsTestPattern += FX_WSTRC(L"}"); |
- CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern, |
- pLocale, (CXFA_LocaleMgr*)pMgr); |
- if (localeValue.IsValid()) { |
- szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
+ CXFA_LocaleValue localeValue2(XFA_VT_TEXT, wsValue, wsTestPattern, |
+ pLocale, (CXFA_LocaleMgr*)pMgr); |
+ if (localeValue2.IsValid()) { |
+ szParsedValue = FX_UTF8Encode(localeValue2.GetValue()); |
FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
szParsedValue.AsStringC()); |
} else { |
@@ -5468,14 +5466,12 @@ void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData, |
if (iInteger < iLength) { |
strBuf << " And "; |
iIndex = iInteger + 1; |
- int32_t iCount = 0; |
while (iIndex < iLength) { |
- iCount = (iLength - iIndex) % 12; |
- if (!iCount && iLength - iIndex > 0) { |
- iCount = 12; |
- } |
- TrillionUS(CFX_ByteStringC(pData + iIndex, iCount), strBuf); |
- iIndex += iCount; |
+ int32_t iSize = (iLength - iIndex) % 12; |
+ if (!iSize && iLength - iIndex > 0) |
+ iSize = 12; |
+ TrillionUS(CFX_ByteStringC(pData + iIndex, iSize), strBuf); |
+ iIndex += iSize; |
if (iIndex < iLength) { |
strBuf << " Trillion "; |
} |