[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 17 08:47:57 UTC 2018
sw/source/filter/ww8/ww8toolbar.cxx | 11 ++++-------
sw/source/filter/ww8/ww8toolbar.hxx | 2 +-
2 files changed, 5 insertions(+), 8 deletions(-)
New commits:
commit 200b4f3324c18667b3f2ddcb8d4ca26a1d2bb55d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 16 11:07:18 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 17 10:47:32 2018 +0200
loplugin:useuniqueptr in Tcg255
Change-Id: I68aa80fbd9d1b1dcd22ecee3a8c51fefe5574ece
Reviewed-on: https://gerrit.libreoffice.org/59226
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index fa868eda0350..bd74fa06acb2 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -654,9 +654,6 @@ Tcg255::Tcg255()
Tcg255::~Tcg255()
{
- std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
- for ( ; it != rgtcgData.end(); ++it )
- delete *it;
}
bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS )
@@ -702,19 +699,19 @@ bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS )
xSubStruct->ch = nId;
if (!xSubStruct->Read(rS))
return false;
- rgtcgData.push_back(xSubStruct.release());
+ rgtcgData.push_back(std::move(xSubStruct));
return true;
}
bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
{
// Find the SwCTBWrapper
- for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
+ for ( auto & rSubStruct : rgtcgData )
{
- if ( (*it)->id() == 0x12 )
+ if ( rSubStruct->id() == 0x12 )
{
// not so great, shouldn't really have to do a horror casting
- SwCTBWrapper* pCTBWrapper = dynamic_cast< SwCTBWrapper* > ( *it );
+ SwCTBWrapper* pCTBWrapper = dynamic_cast< SwCTBWrapper* > ( rSubStruct.get() );
if ( pCTBWrapper )
{
if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
diff --git a/sw/source/filter/ww8/ww8toolbar.hxx b/sw/source/filter/ww8/ww8toolbar.hxx
index aad70b859e5b..ea5456ede91c 100644
--- a/sw/source/filter/ww8/ww8toolbar.hxx
+++ b/sw/source/filter/ww8/ww8toolbar.hxx
@@ -314,7 +314,7 @@ public:
class Tcg255 : public TBBase
{
- std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
+ std::vector< std::unique_ptr<Tcg255SubStruct> > rgtcgData; // array of sub structures
Tcg255(const Tcg255&) = delete;
Tcg255& operator = ( const Tcg255&) = delete;
bool processSubStruct( sal_uInt8 nId, SvStream& );
More information about the Libreoffice-commits
mailing list