[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 4 08:58:55 UTC 2018
sw/source/filter/xml/xmltble.cxx | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
New commits:
commit 4f5b39b949d1748683de1553ec4998b7f389990f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Oct 3 12:20:58 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 4 10:58:31 2018 +0200
loplugin:useuniqueptr in SwXMLTableColumns_Impl
Change-Id: Iee894bccfc162bd97093def7eb86d54be9fde13d
Reviewed-on: https://gerrit.libreoffice.org/61341
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index a15b7269da01..5930a1cd543f 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -95,9 +95,7 @@ struct SwXMLTableColumnCmpWidth_Impl
}
};
-class SwXMLTableColumns_Impl : public o3tl::sorted_vector<SwXMLTableColumn_Impl*, o3tl::less_ptr_to<SwXMLTableColumn_Impl> > {
-public:
- ~SwXMLTableColumns_Impl() { DeleteAndDestroyAll(); }
+class SwXMLTableColumns_Impl : public o3tl::sorted_vector<std::unique_ptr<SwXMLTableColumn_Impl>, o3tl::less_uniqueptr_to<SwXMLTableColumn_Impl> > {
};
class SwXMLTableColumnsSortByWidth_Impl : public o3tl::sorted_vector<SwXMLTableColumn_Impl*, SwXMLTableColumnCmpWidth_Impl> {};
@@ -140,11 +138,10 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) :
if( nBox < nBoxes-1U || nWidth==0 )
{
nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox );
- SwXMLTableColumn_Impl *pCol =
- new SwXMLTableColumn_Impl( nCPos );
+ std::unique_ptr<SwXMLTableColumn_Impl> pCol(
+ new SwXMLTableColumn_Impl( nCPos ));
- if( !aCols.insert( pCol ).second )
- delete pCol;
+ aCols.insert( std::move(pCol) );
if( nBox==nBoxes-1U )
{
@@ -580,7 +577,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines,
const size_t nColumns = rCols.size();
for( size_t nColumn=0U; nColumn<nColumns; ++nColumn )
{
- SwXMLTableColumn_Impl *pColumn = rCols[nColumn];
+ SwXMLTableColumn_Impl *pColumn = rCols[nColumn].get();
sal_uInt32 nOldCPos = nCPos;
nCPos = pColumn->GetPos();
@@ -1002,12 +999,12 @@ void SwXMLExport::ExportTableLines( const SwTableLines& rLines,
size_t nColumn = 0U;
const size_t nColumns = rCols.size();
sal_Int32 nColRep = 1;
- SwXMLTableColumn_Impl *pColumn = (nColumns > 0) ? rCols[0U] : nullptr;
+ SwXMLTableColumn_Impl *pColumn = (nColumns > 0) ? rCols.front().get() : nullptr;
while( pColumn )
{
nColumn++;
SwXMLTableColumn_Impl *pNextColumn =
- (nColumn < nColumns) ? rCols[nColumn] : nullptr;
+ (nColumn < nColumns) ? rCols[nColumn].get() : nullptr;
if( pNextColumn &&
pNextColumn->GetStyleName() == pColumn->GetStyleName() )
{
More information about the Libreoffice-commits
mailing list