From 60a66bd57d17a2f72fbf852faf1eaad87eac6dec Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 9 Jan 2019 14:00:48 +0200 Subject: pass ScTokenArray around by unique_ptr Change-Id: I611554b1c4cbc506dbfc32748e9f14c9e8eb5156 Reviewed-on: https://gerrit.libreoffice.org/66022 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/qa/unit/helper/qahelper.cxx | 3 ++- sc/qa/unit/helper/qahelper.hxx | 2 +- sc/qa/unit/ucalc_formula.cxx | 7 ++----- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'sc/qa') diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index c8d9bfdfc655..cc23c7a207f5 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -477,7 +478,7 @@ bool checkFormulaPositions( return true; } -ScTokenArray* compileFormula( +std::unique_ptr compileFormula( ScDocument* pDoc, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram ) { diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 11a19d618d3e..671b3bdcad1b 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -134,7 +134,7 @@ SCQAHELPER_DLLPUBLIC bool checkFormulaPosition(ScDocument& rDoc, const ScAddress SCQAHELPER_DLLPUBLIC bool checkFormulaPositions( ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const SCROW* pRows, size_t nRowCount); -SCQAHELPER_DLLPUBLIC ScTokenArray* compileFormula( +SCQAHELPER_DLLPUBLIC std::unique_ptr compileFormula( ScDocument* pDoc, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_NATIVE ); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index fc505c281c18..9577a8fe1fab 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1003,11 +1003,8 @@ void Test::testFormulaCompiler() for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { - std::unique_ptr pArray; - { - pArray.reset(compileFormula(m_pDoc, OUString::createFromAscii(aTests[i].pInput), aTests[i].eInputGram)); - CPPUNIT_ASSERT_MESSAGE("Token array shouldn't be NULL!", pArray); - } + std::unique_ptr pArray = compileFormula(m_pDoc, OUString::createFromAscii(aTests[i].pInput), aTests[i].eInputGram); + CPPUNIT_ASSERT_MESSAGE("Token array shouldn't be NULL!", pArray); OUString aFormula = toString(*m_pDoc, ScAddress(), *pArray, aTests[i].eOutputGram); CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(aTests[i].pOutput), aFormula); -- cgit