Kaydet (Commit) 200b4f33 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in Tcg255

Change-Id: I68aa80fbd9d1b1dcd22ecee3a8c51fefe5574ece
Reviewed-on: https://gerrit.libreoffice.org/59226
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 99aad471
...@@ -654,9 +654,6 @@ Tcg255::Tcg255() ...@@ -654,9 +654,6 @@ Tcg255::Tcg255()
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 ) bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS )
...@@ -702,19 +699,19 @@ bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS ) ...@@ -702,19 +699,19 @@ bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS )
xSubStruct->ch = nId; xSubStruct->ch = nId;
if (!xSubStruct->Read(rS)) if (!xSubStruct->Read(rS))
return false; return false;
rgtcgData.push_back(xSubStruct.release()); rgtcgData.push_back(std::move(xSubStruct));
return true; return true;
} }
bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh ) bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
{ {
// Find the SwCTBWrapper // 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 // 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 )
{ {
if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) ) if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
......
...@@ -314,7 +314,7 @@ public: ...@@ -314,7 +314,7 @@ public:
class Tcg255 : public TBBase 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(const Tcg255&) = delete;
Tcg255& operator = ( const Tcg255&) = delete; Tcg255& operator = ( const Tcg255&) = delete;
bool processSubStruct( sal_uInt8 nId, SvStream& ); bool processSubStruct( sal_uInt8 nId, SvStream& );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment