summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-09 14:00:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-10 11:22:25 +0100
commit60a66bd57d17a2f72fbf852faf1eaad87eac6dec (patch)
tree6b9e514c3422fdf2ef436533db48ee6fbb68c663 /sc/qa
parent612941b64970b3e1f246652a8661fbaa56373242 (diff)
pass ScTokenArray around by unique_ptr
Change-Id: I611554b1c4cbc506dbfc32748e9f14c9e8eb5156 Reviewed-on: https://gerrit.libreoffice.org/66022 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/helper/qahelper.cxx3
-rw-r--r--sc/qa/unit/helper/qahelper.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx7
3 files changed, 5 insertions, 7 deletions
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 <sfx2/docfile.hxx>
#include <unotools/tempfile.hxx>
#include <scitems.hxx>
+#include <tokenarray.hxx>
#include <orcus/csv_parser.hpp>
@@ -477,7 +478,7 @@ bool checkFormulaPositions(
return true;
}
-ScTokenArray* compileFormula(
+std::unique_ptr<ScTokenArray> 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<ScTokenArray> 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<ScTokenArray> 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<ScTokenArray> 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);