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

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

Issue 2530933002: Use unique pointers in CXFA_FMParse (Closed)
Patch Set: Address comments Created 4 years, 1 month 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_fmparse.cpp ('k') | xfa/fxfa/fm2js/xfa_simpleexpression.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/fm2js/xfa_program.cpp
diff --git a/xfa/fxfa/fm2js/xfa_program.cpp b/xfa/fxfa/fm2js/xfa_program.cpp
index 5146a5e1296b807e67fbb4af4a9e6c2ec3ed9d86..ac18c15e6d3b50f4b73f9298ea411e31fb2e9c8c 100644
--- a/xfa/fxfa/fm2js/xfa_program.cpp
+++ b/xfa/fxfa/fm2js/xfa_program.cpp
@@ -6,6 +6,11 @@
#include "xfa/fxfa/fm2js/xfa_program.h"
+#include <utility>
+#include <vector>
+
+#include "third_party/base/ptr_util.h"
+
CXFA_FMProgram::CXFA_FMProgram() {}
CXFA_FMProgram::~CXFA_FMProgram() {}
@@ -15,21 +20,17 @@ int32_t CXFA_FMProgram::Init(const CFX_WideStringC& wsFormcalc) {
}
int32_t CXFA_FMProgram::ParseProgram() {
- CFX_ArrayTemplate<CXFA_FMExpression*>* expressions = nullptr;
m_parse.NextToken();
- if (!m_pErrorInfo.message.IsEmpty()) {
+ if (!m_pErrorInfo.message.IsEmpty())
return -1;
- }
- expressions = m_parse.ParseTopExpression();
- if (!m_pErrorInfo.message.IsEmpty()) {
- for (int32_t u = 0; u < expressions->GetSize(); ++u)
- delete expressions->GetAt(u);
- delete expressions;
+ std::vector<std::unique_ptr<CXFA_FMExpression>> expressions =
+ m_parse.ParseTopExpression();
+ if (!m_pErrorInfo.message.IsEmpty())
return -1;
- }
- m_globalFunction.reset(
- new CXFA_FMFunctionDefinition(1, 1, FX_WSTRC(L""), nullptr, expressions));
+
+ m_globalFunction = pdfium::MakeUnique<CXFA_FMFunctionDefinition>(
+ 1, true, L"", nullptr, std::move(expressions));
return 0;
}
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fmparse.cpp ('k') | xfa/fxfa/fm2js/xfa_simpleexpression.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698