[Libreoffice-commits] core.git: sc/inc sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 15 13:45:46 UTC 2020
sc/inc/conditio.hxx | 8 ++++----
sc/inc/validat.hxx | 8 ++++----
sc/source/core/data/conditio.cxx | 24 ++++++++++++------------
sc/source/core/data/validat.cxx | 10 +++++-----
sc/source/filter/excel/xicontent.cxx | 4 ++--
sc/source/filter/oox/condformatbuffer.cxx | 12 ++++++------
6 files changed, 33 insertions(+), 33 deletions(-)
New commits:
commit 0ba320d6a0a7a63c790384e295281c08bce929b2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 14 12:40:03 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 15 15:45:04 2020 +0200
ScCondFormatEntry ScDocument* arg always dereferenced
Change-Id: I6a5c930b7f59b877fab479f7dc4228a0658c0e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102739
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index cd49a361a324..364538749910 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -355,10 +355,10 @@ public:
Type eType = Type::Condition );
ScConditionEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
- ScDocument* pDocument, const ScAddress& rPos );
+ ScDocument& rDocument, const ScAddress& rPos );
ScConditionEntry( const ScConditionEntry& r ); // flat copy of formulas
// true copy of formulas (for Ref-Undo):
- ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r );
+ ScConditionEntry( ScDocument& rDocument, const ScConditionEntry& r );
virtual ~ScConditionEntry() override;
bool IsEqual( const ScFormatEntry& r, bool bIgnoreSrcPos ) const override;
@@ -463,10 +463,10 @@ public:
Type eType = Type::Condition);
ScCondFormatEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
- ScDocument* pDocument, const ScAddress& rPos,
+ ScDocument& rDocument, const ScAddress& rPos,
const OUString& rStyle );
ScCondFormatEntry( const ScCondFormatEntry& r );
- ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatEntry& r );
+ ScCondFormatEntry( ScDocument& rDocument, const ScCondFormatEntry& r );
virtual ~ScCondFormatEntry() override;
bool IsEqual( const ScFormatEntry& r, bool bIgnoreSrcPos ) const override;
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index 36b3ee5a1584..e42b0b3f018b 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -89,15 +89,15 @@ public:
formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT );
ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
- ScDocument* pDocument, const ScAddress& rPos );
+ ScDocument& rDocument, const ScAddress& rPos );
ScValidationData( const ScValidationData& r );
- ScValidationData( ScDocument* pDocument, const ScValidationData& r );
+ ScValidationData( ScDocument& rDocument, const ScValidationData& r );
virtual ~ScValidationData() override;
ScValidationData* Clone() const // real copy
- { return new ScValidationData( GetDocument(), *this ); }
+ { return new ScValidationData( *GetDocument(), *this ); }
ScValidationData* Clone(ScDocument* pNew) const override
- { return new ScValidationData( pNew, *this ); }
+ { return new ScValidationData( *pNew, *this ); }
void ResetInput();
void ResetError();
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index b3089a4053a2..bd239fc84fe4 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -202,8 +202,8 @@ ScConditionEntry::ScConditionEntry( const ScConditionEntry& r ) :
// Formula cells are created at IsValid
}
-ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r ) :
- ScFormatEntry(pDocument),
+ScConditionEntry::ScConditionEntry( ScDocument& rDocument, const ScConditionEntry& r ) :
+ ScFormatEntry(&rDocument),
eOp(r.eOp),
nOptions(r.nOptions),
nVal1(r.nVal1),
@@ -221,7 +221,7 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr
bRelRef1(r.bRelRef1),
bRelRef2(r.bRelRef2),
bFirstRun(true),
- mpListener(new ScFormulaListener(*pDocument)),
+ mpListener(new ScFormulaListener(rDocument)),
eConditionType( r.eConditionType),
pCondFormat(r.pCondFormat)
{
@@ -266,8 +266,8 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
- ScDocument* pDocument, const ScAddress& rPos ) :
- ScFormatEntry(pDocument),
+ ScDocument& rDocument, const ScAddress& rPos ) :
+ ScFormatEntry(&rDocument),
eOp(eOper),
nOptions(0),
nVal1(0.0),
@@ -280,7 +280,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
bRelRef1(false),
bRelRef2(false),
bFirstRun(true),
- mpListener(new ScFormulaListener(*pDocument)),
+ mpListener(new ScFormulaListener(rDocument)),
eConditionType(ScFormatEntry::Type::Condition),
pCondFormat(nullptr)
{
@@ -1390,7 +1390,7 @@ bool ScConditionEntry::MarkUsedExternalReferences() const
ScFormatEntry* ScConditionEntry::Clone(ScDocument* pDoc) const
{
- return new ScConditionEntry(pDoc, *this);
+ return new ScConditionEntry(*pDoc, *this);
}
ScConditionMode ScConditionEntry::GetModeFromApi(css::sheet::ConditionOperator nOperation)
@@ -1468,9 +1468,9 @@ ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper,
ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
- ScDocument* pDocument, const ScAddress& rPos,
+ ScDocument& rDocument, const ScAddress& rPos,
const OUString& rStyle ) :
- ScConditionEntry( eOper, pArr1, pArr2, pDocument, rPos ),
+ ScConditionEntry( eOper, pArr1, pArr2, rDocument, rPos ),
aStyleName( rStyle )
{
}
@@ -1482,8 +1482,8 @@ ScCondFormatEntry::ScCondFormatEntry( const ScCondFormatEntry& r ) :
{
}
-ScCondFormatEntry::ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatEntry& r ) :
- ScConditionEntry( pDocument, r ),
+ScCondFormatEntry::ScCondFormatEntry( ScDocument& rDocument, const ScCondFormatEntry& r ) :
+ ScConditionEntry( rDocument, r ),
aStyleName( r.aStyleName ),
eCondFormatType( r.eCondFormatType)
{
@@ -1508,7 +1508,7 @@ void ScCondFormatEntry::DataChanged() const
ScFormatEntry* ScCondFormatEntry::Clone( ScDocument* pDoc ) const
{
- return new ScCondFormatEntry( pDoc, *this );
+ return new ScCondFormatEntry( *pDoc, *this );
}
void ScConditionEntry::CalcAll()
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 75d9e4f0e27d..9356de1f2ce9 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -78,8 +78,8 @@ ScValidationData::ScValidationData( ScValidationMode eMode, ScConditionMode eOpe
ScValidationData::ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
- ScDocument* pDocument, const ScAddress& rPos )
- : ScConditionEntry( eOper, pArr1, pArr2, pDocument, rPos )
+ ScDocument& rDocument, const ScAddress& rPos )
+ : ScConditionEntry( eOper, pArr1, pArr2, rDocument, rPos )
, nKey( 0 )
, eDataMode( eMode )
, bShowInput(false)
@@ -105,8 +105,8 @@ ScValidationData::ScValidationData( const ScValidationData& r )
// Formulae copied by RefCount
}
-ScValidationData::ScValidationData( ScDocument* pDocument, const ScValidationData& r )
- : ScConditionEntry( pDocument, r )
+ScValidationData::ScValidationData( ScDocument& rDocument, const ScValidationData& r )
+ : ScConditionEntry( rDocument, r )
, nKey( r.nKey )
, eDataMode( r.eDataMode )
, bShowInput( r.bShowInput )
@@ -905,7 +905,7 @@ bool ScValidationData::FillSelectionList(std::vector<ScTypedStrData>& rStrColl,
bool ScValidationData::IsEqualToTokenArray( ScRefCellValue& rCell, const ScAddress& rPos, const ScTokenArray& rTokArr ) const
{
// create a condition entry that tests on equality and set the passed token array
- ScConditionEntry aCondEntry( ScConditionMode::Equal, &rTokArr, nullptr, GetDocument(), rPos );
+ ScConditionEntry aCondEntry( ScConditionMode::Equal, &rTokArr, nullptr, *GetDocument(), rPos );
return aCondEntry.IsCellValid(rCell, rPos);
}
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 814b284cba22..10e6f85acb1e 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -682,7 +682,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
mxScCondFmt->SetRange(maRanges);
}
- ScCondFormatEntry* pEntry = new ScCondFormatEntry(eMode, xTokArr1.get(), xTokArr2.get(), &GetDoc(), aPos, aStyleName);
+ ScCondFormatEntry* pEntry = new ScCondFormatEntry(eMode, xTokArr1.get(), xTokArr2.get(), GetDoc(), aPos, aStyleName);
mxScCondFmt->AddEntry( pEntry );
++mnCondIndex;
}
@@ -891,7 +891,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm )
XclTokenArrayHelper::ConvertStringToList(*xTokArr1, rDoc.GetSharedStringPool(), '\n');
maDVItems.push_back(
- std::make_unique<DVItem>(aScRanges, ScValidationData(eValMode, eCondMode, xTokArr1.get(), xTokArr2.get(), &rDoc, rScRange.aStart)));
+ std::make_unique<DVItem>(aScRanges, ScValidationData(eValMode, eCondMode, xTokArr1.get(), xTokArr2.get(), rDoc, rScRange.aStart)));
DVItem& rItem = *maDVItems.back();
rItem.maValidData.SetIgnoreBlank( ::get_flag( nFlags, EXC_DV_IGNOREBLANK ) );
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 348d898bab21..066a310a3d17 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -846,7 +846,7 @@ void CondFormatRule::finalizeImport()
{
ScDocument& rDoc = getScDocument();
OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
- ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, nullptr, nullptr, &rDoc, aPos, aStyleName );
+ ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, nullptr, nullptr, rDoc, aPos, aStyleName );
mpFormat->AddEntry(pNewEntry);
}
else if( eOperator == ScConditionMode::BeginsWith || eOperator == ScConditionMode::EndsWith ||
@@ -857,7 +857,7 @@ void CondFormatRule::finalizeImport()
svl::SharedStringPool& rSPool = rDoc.GetSharedStringPool();
aTokenArray.AddString(rSPool.intern(maModel.maText));
OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
- ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, nullptr, &rDoc, aPos, aStyleName );
+ ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, nullptr, rDoc, aPos, aStyleName );
mpFormat->AddEntry(pNewEntry);
}
else if( (eOperator != ScConditionMode::NONE) && !maModel.maFormulas.empty() )
@@ -876,7 +876,7 @@ void CondFormatRule::finalizeImport()
ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, maModel.maFormulas[ 0 ] );
rDoc.CheckLinkFormulaNeedingCheck( aTokenArray);
ScCondFormatEntry* pNewEntry = new ScCondFormatEntry(eOperator,
- &aTokenArray, pTokenArray2.get(), &rDoc, aPos, aStyleName);
+ &aTokenArray, pTokenArray2.get(), rDoc, aPos, aStyleName);
mpFormat->AddEntry(pNewEntry);
}
else if ( eOperator == ScConditionMode::Top10 || eOperator == ScConditionMode::Bottom10 ||
@@ -886,7 +886,7 @@ void CondFormatRule::finalizeImport()
ScTokenArray aTokenArray(rDoc);
aTokenArray.AddDouble( maModel.mnRank );
OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
- ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, nullptr, &rDoc, aPos, aStyleName );
+ ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, nullptr, rDoc, aPos, aStyleName );
mpFormat->AddEntry(pNewEntry);
}
else if( eOperator == ScConditionMode::AboveAverage || eOperator == ScConditionMode::BelowAverage ||
@@ -897,14 +897,14 @@ void CondFormatRule::finalizeImport()
ScTokenArray aTokenArrayDev(rDoc);
aTokenArrayDev.AddDouble( maModel.mnStdDev );
OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
- ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArrayDev, nullptr, &rDoc, aPos, aStyleName );
+ ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArrayDev, nullptr, rDoc, aPos, aStyleName );
mpFormat->AddEntry(pNewEntry);
}
else if( eOperator == ScConditionMode::Duplicate || eOperator == ScConditionMode::NotDuplicate )
{
ScDocument& rDoc = getScDocument();
OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
- ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, nullptr, nullptr, &rDoc, aPos, aStyleName );
+ ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, nullptr, nullptr, rDoc, aPos, aStyleName );
mpFormat->AddEntry(pNewEntry);
}
else if( maModel.mnType == XML_timePeriod )
More information about the Libreoffice-commits
mailing list