[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 15 14:46:29 UTC 2020
sc/inc/reffind.hxx | 4 ++--
sc/qa/unit/ucalc.cxx | 8 ++++----
sc/source/core/tool/reffind.cxx | 12 ++++++------
sc/source/ui/view/editsh.cxx | 2 +-
sc/source/ui/view/viewfun4.cxx | 2 +-
5 files changed, 14 insertions(+), 14 deletions(-)
New commits:
commit cf301f5e1a8a3f8617c76c627042f20322673bdb
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 14 15:27:11 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 15 16:45:46 2020 +0200
ScRefFinder ScDocument* argument dereferenced on all paths
Change-Id: I0e78a9b286dbd8e9a4acbd411f556b6eea0ec1ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102742
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx
index 9cb3bd00b924..9defa2986a8b 100644
--- a/sc/inc/reffind.hxx
+++ b/sc/inc/reffind.hxx
@@ -28,7 +28,7 @@ class ScRefFinder
{
OUString maFormula;
formula::FormulaGrammar::AddressConvention meConv;
- ScDocument* mpDoc;
+ ScDocument& mrDoc;
ScAddress maPos;
sal_Int32 mnFound;
sal_Int32 mnSelStart;
@@ -36,7 +36,7 @@ class ScRefFinder
public:
ScRefFinder(
- const OUString& rFormula, const ScAddress& rPos, ScDocument* pDoc,
+ const OUString& rFormula, const ScAddress& rPos, ScDocument& rDoc,
formula::FormulaGrammar::AddressConvention eConvP = formula::FormulaGrammar::CONV_OOO );
~ScRefFinder();
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d79146f92a86..bfb741b07166 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2959,7 +2959,7 @@ void Test::testToggleRefFlag()
OUString aFormula("=B100");
ScAddress aPos(1, 5, 0);
- ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_OOO);
+ ScRefFinder aFinder(aFormula, aPos, *m_pDoc, formula::FormulaGrammar::CONV_OOO);
// Original
CPPUNIT_ASSERT_EQUAL_MESSAGE("Does not equal the original text.", aFormula, aFinder.GetText());
@@ -2990,7 +2990,7 @@ void Test::testToggleRefFlag()
OUString aFormula("=R2C1");
ScAddress aPos(3, 5, 0);
- ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
+ ScRefFinder aFinder(aFormula, aPos, *m_pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
// Original
CPPUNIT_ASSERT_EQUAL_MESSAGE("Does not equal the original text.", aFormula, aFinder.GetText());
@@ -3021,7 +3021,7 @@ void Test::testToggleRefFlag()
// overlap the formula string at all (inspired by fdo#39135).
OUString aFormula("=R1C1");
ScAddress aPos(1, 1, 0);
- ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
+ ScRefFinder aFinder(aFormula, aPos, *m_pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
// Original
CPPUNIT_ASSERT_EQUAL(aFormula, aFinder.GetText());
@@ -3055,7 +3055,7 @@ void Test::testToggleRefFlag()
// Calc A1:
OUString aFormula("=A1+4");
ScAddress aPos(1, 1, 0);
- ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_OOO);
+ ScRefFinder aFinder(aFormula, aPos, *m_pDoc, formula::FormulaGrammar::CONV_OOO);
// Original
CPPUNIT_ASSERT_EQUAL(aFormula, aFinder.GetText());
diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx
index 07d658ceb464..b4e7ea49eddf 100644
--- a/sc/source/core/tool/reffind.cxx
+++ b/sc/source/core/tool/reffind.cxx
@@ -204,10 +204,10 @@ void ExpandToText(const sal_Unicode* p, sal_Int32 nLen, sal_Int32& rStartPos, sa
ScRefFinder::ScRefFinder(
const OUString& rFormula, const ScAddress& rPos,
- ScDocument* pDoc, formula::FormulaGrammar::AddressConvention eConvP) :
+ ScDocument& rDoc, formula::FormulaGrammar::AddressConvention eConvP) :
maFormula(rFormula),
meConv(eConvP),
- mpDoc(pDoc),
+ mrDoc(rDoc),
maPos(rPos),
mnFound(0),
mnSelStart(0),
@@ -269,7 +269,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
// Check the validity of the expression, and toggle the relative flag.
ScAddress::Details aDetails(meConv, maPos.Row(), maPos.Col());
ScAddress::ExternalInfo aExtInfo;
- ScRefFlags nResult = aAddr.Parse(aExpr, mpDoc, aDetails, &aExtInfo);
+ ScRefFlags nResult = aAddr.Parse(aExpr, &mrDoc, aDetails, &aExtInfo);
if ( nResult & ScRefFlags::VALID )
{
ScRefFlags nFlags;
@@ -292,10 +292,10 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
{
OUString aRef = aExpr.copy(nSep+1);
OUString aExtDocNameTabName = aExpr.copy(0, nSep+1);
- nResult = aAddr.Parse(aRef, mpDoc, aDetails);
+ nResult = aAddr.Parse(aRef, &mrDoc, aDetails);
aAddr.SetTab(0); // force to first tab to avoid error on checking
nFlags = lcl_NextFlags( nResult );
- aExpr = aExtDocNameTabName + aAddr.Format(nFlags, mpDoc, aDetails);
+ aExpr = aExtDocNameTabName + aAddr.Format(nFlags, &mrDoc, aDetails);
}
else
{
@@ -305,7 +305,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
else
{
nFlags = lcl_NextFlags( nResult );
- aExpr = aAddr.Format(nFlags, mpDoc, aDetails);
+ aExpr = aAddr.Format(nFlags, &mrDoc, aDetails);
}
sal_Int32 nAbsStart = nStartPos+aResult.getLength()+aSep.getLength();
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 11a100da976c..fff2c90738b1 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -535,7 +535,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
ESelection aSel = pEditView->GetSelection(); // current View
ScDocument* pDoc = pViewData->GetDocument();
- ScRefFinder aFinder(aText, pViewData->GetCurPos(), pDoc, pDoc->GetAddressConvention());
+ ScRefFinder aFinder(aText, pViewData->GetCurPos(), *pDoc, pDoc->GetAddressConvention());
aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos );
if (aFinder.GetFound())
{
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 270dd0081641..2c9f55dc7dd4 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -258,7 +258,7 @@ void ScViewFunc::DoRefConversion()
nLen -= 2;
aOld = aOld.copy( 1, nLen);
}
- ScRefFinder aFinder( aOld, aIter.GetPos(), pDoc, pDoc->GetAddressConvention() );
+ ScRefFinder aFinder( aOld, aIter.GetPos(), *pDoc, pDoc->GetAddressConvention() );
aFinder.ToggleRel( 0, nLen );
if (aFinder.GetFound())
{
More information about the Libreoffice-commits
mailing list