summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/xfa_expression.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-08 15:21:40 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-08 15:21:40 -0800
commit94afac986c9d6232b7791acff4f23d99fbd004ae (patch)
treefb6ba0181a44f91bc321989da6ef2fa3b48a7021 /xfa/fxfa/fm2js/xfa_expression.cpp
parent89ab499024b1f362b1d40dabd9fadded8b095203 (diff)
downloadpdfium-94afac986c9d6232b7791acff4f23d99fbd004ae.tar.xz
Replace CFX_WideStringCArray with std::vector.chromium/2946
Review-Url: https://codereview.chromium.org/2562833002
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_expression.cpp')
-rw-r--r--xfa/fxfa/fm2js/xfa_expression.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp
index a668fc9089..a4d1195933 100644
--- a/xfa/fxfa/fm2js/xfa_expression.cpp
+++ b/xfa/fxfa/fm2js/xfa_expression.cpp
@@ -34,12 +34,12 @@ CXFA_FMFunctionDefinition::CXFA_FMFunctionDefinition(
uint32_t line,
bool isGlobal,
const CFX_WideStringC& wsName,
- std::unique_ptr<CFX_WideStringCArray> pArguments,
- std::vector<std::unique_ptr<CXFA_FMExpression>>&& pExpressions)
+ std::vector<CFX_WideStringC>&& arguments,
+ std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions)
: CXFA_FMExpression(line, XFA_FM_EXPTYPE_FUNC),
m_wsName(wsName),
- m_pArguments(std::move(pArguments)),
- m_pExpressions(std::move(pExpressions)),
+ m_pArguments(std::move(arguments)),
+ m_pExpressions(std::move(expressions)),
m_isGlobal(isGlobal) {}
CXFA_FMFunctionDefinition::~CXFA_FMFunctionDefinition() {}
@@ -60,21 +60,18 @@ void CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << m_wsName;
}
javascript << FX_WSTRC(L"(");
- if (m_pArguments != 0) {
- CFX_WideStringC identifier = 0;
- for (int i = 0; i < m_pArguments->GetSize(); ++i) {
- identifier = m_pArguments->GetAt(i);
- if (identifier.GetAt(0) == L'!') {
- CFX_WideString tempIdentifier =
- EXCLAMATION_IN_IDENTIFIER + identifier.Mid(1);
- javascript << tempIdentifier;
- } else {
- javascript << identifier;
- }
- if (i + 1 < m_pArguments->GetSize()) {
- javascript << FX_WSTRC(L", ");
- }
+ bool bNeedComma = false;
+ for (const auto& identifier : m_pArguments) {
+ if (bNeedComma)
+ javascript << FX_WSTRC(L", ");
+ if (identifier.GetAt(0) == L'!') {
+ CFX_WideString tempIdentifier =
+ EXCLAMATION_IN_IDENTIFIER + identifier.Mid(1);
+ javascript << tempIdentifier;
+ } else {
+ javascript << identifier;
}
+ bNeedComma = true;
}
javascript << FX_WSTRC(L")\n{\n");
javascript << FX_WSTRC(L"var ");