diff options
author | npm <npm@chromium.org> | 2016-11-28 12:31:13 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-28 12:31:13 -0800 |
commit | eb9625c04876c45862fb30e48a4fd6d5998db0e9 (patch) | |
tree | 67725226cdf317ff35213da6761dfc0455ec69fb /xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp | |
parent | c92e26defaa636b0d2ec9b9de0f88c6153ad7ed3 (diff) | |
download | pdfium-eb9625c04876c45862fb30e48a4fd6d5998db0e9.tar.xz |
Use unique pointers in CXFA_FMParse
Replaced CXFA_FMParse's returns to be unique pointers to prevent leaks.
Review-Url: https://codereview.chromium.org/2530933002
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp index 534fc18a6f..d54921f99a 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp @@ -5,21 +5,21 @@ #include "xfa/fxfa/fm2js/xfa_simpleexpression.h" #include <memory> +#include <utility> #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/fm2js/xfa_lexer.h" TEST(FMCallExpression, more_than_32_arguments) { // Use sign as it has 3 object parameters at positions 0, 5, and 6. - std::unique_ptr<CXFA_FMIdentifierExpression> exp( - new CXFA_FMIdentifierExpression(0, CFX_WideStringC(L"sign"))); + auto exp = pdfium::MakeUnique<CXFA_FMIdentifierExpression>(0, L"sign"); - std::unique_ptr<CFX_ArrayTemplate<CXFA_FMSimpleExpression*>> args( - new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>()); + std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> args; for (size_t i = 0; i < 50; i++) - args->Add(new CXFA_FMSimpleExpression(0, TOKnan)); + args.push_back(pdfium::MakeUnique<CXFA_FMSimpleExpression>(0, TOKnan)); - CXFA_FMCallExpression callExp(0, exp.release(), args.release(), true); + CXFA_FMCallExpression callExp(0, exp.release(), std::move(args), true); CFX_WideTextBuf js; callExp.ToJavaScript(js); |