diff options
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_simpleexpression.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 872fe7e2e8..fabdaa60f0 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -153,28 +153,29 @@ CXFA_FMStringExpression::~CXFA_FMStringExpression() {} void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsString); - if (tempStr.GetLength() > 2) { - javascript.AppendChar(L'\"'); - wchar_t oneChar; - for (int16_t i = 1; i < tempStr.GetLength() - 1; i++) { - oneChar = tempStr[i]; - switch (oneChar) { - case L'\"': { - i++; - javascript << L"\\\""; - } break; - case 0x0d: - break; - case 0x0a: { - javascript << L"\\n"; - } break; - default: { javascript.AppendChar(oneChar); } break; - } - } - javascript.AppendChar(L'\"'); - } else { + if (tempStr.GetLength() <= 2) { javascript << tempStr; + return; + } + javascript.AppendChar(L'\"'); + for (int32_t i = 1; i < tempStr.GetLength() - 1; i++) { + wchar_t oneChar = tempStr[i]; + switch (oneChar) { + case L'\"': + i++; + javascript << L"\\\""; + break; + case 0x0d: + break; + case 0x0a: + javascript << L"\\n"; + break; + default: + javascript.AppendChar(oneChar); + break; + } } + javascript.AppendChar(L'\"'); } CXFA_FMIdentifierExpression::CXFA_FMIdentifierExpression( |