[Libreoffice-commits] core.git: sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Jul 13 06:40:45 UTC 2018
sc/source/filter/inc/XclExpChangeTrack.hxx | 8 ++++----
sc/source/filter/xcl97/XclExpChangeTrack.cxx | 17 ++++++++---------
2 files changed, 12 insertions(+), 13 deletions(-)
New commits:
commit 281f1281edbd0063b1d1d9151bcbfc1299a0082e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Jul 12 16:38:14 2018 +0200
loplugin:useuniqueptr in XclExpChTrCellContent
Change-Id: I8002f1bbb45a48244b981051abc02c1414a2fa34
Reviewed-on: https://gerrit.libreoffice.org/57361
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index 5bdcd7a7bdd9..f447747cd2d8 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -464,15 +464,15 @@ struct XclExpChTrData
class XclExpChTrCellContent final : public XclExpChTrAction, protected XclExpRoot
{
- XclExpChTrData* pOldData;
- XclExpChTrData* pNewData;
+ std::unique_ptr<XclExpChTrData> pOldData;
+ std::unique_ptr<XclExpChTrData> pNewData;
sal_uInt16 nOldLength; // this is not the record size
ScAddress aPosition;
- static void MakeEmptyChTrData( XclExpChTrData*& rpData );
+ static void MakeEmptyChTrData( std::unique_ptr<XclExpChTrData>& rpData );
void GetCellData(
- const XclExpRoot& rRoot, const ScCellValue& rScCell, XclExpChTrData*& rpData,
+ const XclExpRoot& rRoot, const ScCellValue& rScCell, std::unique_ptr<XclExpChTrData>& rpData,
sal_uInt32& rXclLength1, sal_uInt16& rXclLength2 );
virtual void SaveActionData( XclExpStream& rStrm ) const override;
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 240dfbc6336f..43492b6fb5c1 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -838,21 +838,21 @@ XclExpChTrCellContent::XclExpChTrCellContent(
XclExpChTrCellContent::~XclExpChTrCellContent()
{
- delete pOldData;
- delete pNewData;
+ pOldData.reset();
+ pNewData.reset();
}
-void XclExpChTrCellContent::MakeEmptyChTrData( XclExpChTrData*& rpData )
+void XclExpChTrCellContent::MakeEmptyChTrData( std::unique_ptr<XclExpChTrData>& rpData )
{
if( rpData )
rpData->Clear();
else
- rpData = new XclExpChTrData;
+ rpData.reset( new XclExpChTrData );
}
void XclExpChTrCellContent::GetCellData(
const XclExpRoot& rRoot, const ScCellValue& rScCell,
- XclExpChTrData*& rpData, sal_uInt32& rXclLength1, sal_uInt16& rXclLength2 )
+ std::unique_ptr<XclExpChTrData>& rpData, sal_uInt32& rXclLength1, sal_uInt16& rXclLength2 )
{
MakeEmptyChTrData( rpData );
rXclLength1 = 0x0000003A;
@@ -860,8 +860,7 @@ void XclExpChTrCellContent::GetCellData(
if (rScCell.isEmpty())
{
- delete rpData;
- rpData = nullptr;
+ rpData.reset();
return;
}
@@ -1069,7 +1068,7 @@ void XclExpChTrCellContent::SaveXml( XclExpXmlStream& rRevisionLogStrm )
FSEND );
if( pOldData )
{
- lcl_WriteCell( rRevisionLogStrm, XML_oc, aPosition, pOldData );
+ lcl_WriteCell( rRevisionLogStrm, XML_oc, aPosition, pOldData.get() );
if (!pNewData)
{
pStream->singleElement(XML_nc,
@@ -1079,7 +1078,7 @@ void XclExpChTrCellContent::SaveXml( XclExpXmlStream& rRevisionLogStrm )
}
if( pNewData )
{
- lcl_WriteCell( rRevisionLogStrm, XML_nc, aPosition, pNewData );
+ lcl_WriteCell( rRevisionLogStrm, XML_nc, aPosition, pNewData.get() );
}
// OOXTODO: XML_odxf, XML_ndxf, XML_extLst elements
pStream->endElement( XML_rcc );
More information about the Libreoffice-commits
mailing list