Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: xfa/fxfa/fm2js/xfa_fmparse.cpp

Issue 2562833002: Replace CFX_WideStringCArray with std::vector. (Closed)
Patch Set: comment Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_expression.cpp ('k') | xfa/fxfa/fm2js/xfa_program.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/fm2js/xfa_fmparse.cpp
diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp
index 53e94666de4953a6b5527863c11fa0c6a9d2ebde..2dfdfdb4d2c5fe54e6b1560f82c59b4ca7ca8d06 100644
--- a/xfa/fxfa/fm2js/xfa_fmparse.cpp
+++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp
@@ -78,9 +78,8 @@ CXFA_FMParse::ParseTopExpression() {
}
std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseFunction() {
- std::unique_ptr<CXFA_FMExpression> expr;
CFX_WideStringC ident;
- std::unique_ptr<CFX_WideStringCArray> pArguments;
+ std::vector<CFX_WideStringC> arguments;
std::vector<std::unique_ptr<CXFA_FMExpression>> expressions;
uint32_t line = m_pToken->m_uLinenum;
NextToken();
@@ -96,12 +95,9 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseFunction() {
if (m_pToken->m_type == TOKrparen) {
NextToken();
} else {
- pArguments = pdfium::MakeUnique<CFX_WideStringCArray>();
- CFX_WideStringC p;
while (1) {
if (m_pToken->m_type == TOKidentifier) {
- p = m_pToken->m_wstring;
- pArguments->Add(p);
+ arguments.push_back(m_pToken->m_wstring);
NextToken();
if (m_pToken->m_type == TOKcomma) {
NextToken();
@@ -129,13 +125,11 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseFunction() {
expressions = ParseTopExpression();
Check(TOKendfunc);
}
- if (m_pErrorInfo->message.IsEmpty()) {
- expr = pdfium::MakeUnique<CXFA_FMFunctionDefinition>(
- line, false, ident, std::move(pArguments), std::move(expressions));
- } else if (pArguments) {
- pArguments->RemoveAll();
- }
- return expr;
+ if (!m_pErrorInfo->message.IsEmpty())
+ return nullptr;
+
+ return pdfium::MakeUnique<CXFA_FMFunctionDefinition>(
+ line, false, ident, std::move(arguments), std::move(expressions));
}
std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseExpression() {
« no previous file with comments | « xfa/fxfa/fm2js/xfa_expression.cpp ('k') | xfa/fxfa/fm2js/xfa_program.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698