summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/fm2js')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp12
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmexpression.cpp30
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp3
3 files changed, 31 insertions, 14 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
index 445d729668..1910e60e3e 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
@@ -1138,7 +1138,8 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis,
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
CFX_ByteString szArgString = ValueToUTF8String(argOne.get());
- szArgString = szArgString.Mid(szArgString.Find('T', 0) + 1);
+ FX_STRSIZE pos = szArgString.Find('T', 0);
+ szArgString = szArgString.Mid(pos + 1, szArgString.GetLength() - (pos + 1));
if (szArgString.IsEmpty()) {
args.GetReturnValue()->SetInteger(0);
return;
@@ -3692,7 +3693,9 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis,
wsDatePattern += wsPattern.Left(iTChar) + L"} ";
CFX_WideString wsTimePattern(L"time{");
- wsTimePattern += wsPattern.Mid(iTChar + 1) + L"}";
+ wsTimePattern +=
+ wsPattern.Mid(iTChar + 1, wsPattern.GetLength() - (iTChar + 1)) +
+ L"}";
wsPattern = wsDatePattern + wsTimePattern;
} break;
case XFA_VT_DATE: {
@@ -3877,7 +3880,10 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis,
case XFA_VT_DATETIME: {
FX_STRSIZE iTChar = wsPattern.Find(L'T');
CFX_WideString wsDatePattern(L"date{" + wsPattern.Left(iTChar) + L"} ");
- CFX_WideString wsTimePattern(L"time{" + wsPattern.Mid(iTChar + 1) + L"}");
+ CFX_WideString wsTimePattern(
+ L"time{" +
+ wsPattern.Mid(iTChar + 1, wsPattern.GetLength() - (iTChar + 1)) +
+ L"}");
wsPattern = wsDatePattern + wsTimePattern;
CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale,
pMgr);
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index 7e6e0954aa..b201863b25 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -61,7 +61,8 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) {
}
javascript << L"function ";
if (m_wsName.GetAt(0) == L'!') {
- CFX_WideString tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1);
+ CFX_WideString tempName =
+ EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1, m_wsName.GetLength() - 1);
javascript << tempName;
} else {
javascript << m_wsName;
@@ -73,7 +74,8 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L", ";
if (identifier.GetAt(0) == L'!') {
CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + identifier.Mid(1);
+ EXCLAMATION_IN_IDENTIFIER +
+ identifier.Mid(1, identifier.GetLength() - 1);
javascript << tempIdentifier;
} else {
javascript << identifier;
@@ -127,7 +129,8 @@ bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L"var ";
CFX_WideString tempName(m_wsName);
if (m_wsName.GetAt(0) == L'!') {
- tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1);
+ tempName =
+ EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1, m_wsName.GetLength() - 1);
}
javascript << tempName;
javascript << L" = ";
@@ -150,7 +153,8 @@ bool CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
javascript << L"var ";
CFX_WideString tempName(m_wsName);
if (m_wsName.GetAt(0) == L'!') {
- tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1);
+ tempName =
+ EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1, m_wsName.GetLength() - 1);
}
javascript << tempName;
javascript << L" = ";
@@ -456,7 +460,8 @@ bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L"{\nvar ";
CFX_WideString tempVariant;
if (m_wsVariant.GetAt(0) == L'!') {
- tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Mid(1);
+ tempVariant = EXCLAMATION_IN_IDENTIFIER +
+ m_wsVariant.Mid(1, m_wsVariant.GetLength() - 1);
javascript << tempVariant;
} else {
tempVariant = m_wsVariant;
@@ -510,7 +515,8 @@ bool CXFA_FMForExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
javascript << L"{\nvar ";
CFX_WideString tempVariant;
if (m_wsVariant.GetAt(0) == L'!') {
- tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Mid(1);
+ tempVariant = EXCLAMATION_IN_IDENTIFIER +
+ m_wsVariant.Mid(1, m_wsVariant.GetLength() - 1);
javascript << tempVariant;
} else {
tempVariant = m_wsVariant;
@@ -576,7 +582,8 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L"var ";
if (m_wsIdentifier.GetAt(0) == L'!') {
CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1);
+ EXCLAMATION_IN_IDENTIFIER +
+ m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
} else {
javascript << m_wsIdentifier;
@@ -607,7 +614,8 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << L".length)\n{\n";
if (m_wsIdentifier.GetAt(0) == L'!') {
CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1);
+ EXCLAMATION_IN_IDENTIFIER +
+ m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
} else {
javascript << m_wsIdentifier;
@@ -631,7 +639,8 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
javascript << L"var ";
if (m_wsIdentifier.GetAt(0) == L'!') {
CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1);
+ EXCLAMATION_IN_IDENTIFIER +
+ m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
} else {
javascript << m_wsIdentifier;
@@ -661,7 +670,8 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
javascript << L".length)\n{\n";
if (m_wsIdentifier.GetAt(0) == L'!') {
CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Mid(1);
+ EXCLAMATION_IN_IDENTIFIER +
+ m_wsIdentifier.Mid(1, m_wsIdentifier.GetLength() - 1);
javascript << tempIdentifier;
} else {
javascript << m_wsIdentifier;
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
index 955b06fe93..1a3a125032 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
@@ -180,7 +180,8 @@ bool CXFA_FMIdentifierExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
} else if (tempStr == L"$template") {
tempStr = L"xfa.template";
} else if (tempStr[0] == L'!') {
- tempStr = EXCLAMATION_IN_IDENTIFIER + tempStr.Mid(1);
+ tempStr =
+ EXCLAMATION_IN_IDENTIFIER + tempStr.Mid(1, tempStr.GetLength() - 1);
}
javascript << tempStr;
return true;