summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-16 11:07:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-17 10:47:32 +0200
commit200b4f3324c18667b3f2ddcb8d4ca26a1d2bb55d (patch)
treed4d9e557bd463ae137b142401c81bea7d8cad9bd /sw
parent99aad471716bfd212e29eebdcbdfb260627f1ae1 (diff)
loplugin:useuniqueptr in Tcg255
Change-Id: I68aa80fbd9d1b1dcd22ecee3a8c51fefe5574ece Reviewed-on: https://gerrit.libreoffice.org/59226 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx11
-rw-r--r--sw/source/filter/ww8/ww8toolbar.hxx2
2 files changed, 5 insertions, 8 deletions
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& );