From acc711238df5cf7cdd5b470d1439f6dc439f895a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 17 Sep 2018 13:56:00 +0200 Subject: loplugin:useuniqueptr in SvMetaSlot no need to store ref-counted object like OString on the heap Change-Id: Ifd031ae68dfd615e99f54414cb2dc32aac60daa8 Reviewed-on: https://gerrit.libreoffice.org/60623 Tested-by: Jenkins Reviewed-by: Noel Grandin --- idl/inc/object.hxx | 2 +- idl/inc/slot.hxx | 2 +- idl/source/objects/object.cxx | 6 ++---- idl/source/objects/slot.cxx | 10 +++++----- 4 files changed, 9 insertions(+), 11 deletions(-) (limited to 'idl') diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx index 5b4bdb1eb6eb..822e562c26e1 100644 --- a/idl/inc/object.hxx +++ b/idl/inc/object.hxx @@ -59,7 +59,7 @@ private: static void WriteSlotStubs( const OString& rShellName, SvSlotElementList & rSlotList, - std::vector & rList, + std::vector & rList, SvStream & rOutStm ); static sal_uInt16 WriteSlotParamArray( SvIdlDataBase & rBase, SvSlotElementList & rSlotList, diff --git a/idl/inc/slot.hxx b/idl/inc/slot.hxx index deef59ca6373..34709bc86bf2 100644 --- a/idl/inc/slot.hxx +++ b/idl/inc/slot.hxx @@ -119,7 +119,7 @@ public: virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) override; virtual void Insert( SvSlotElementList& ) override; void WriteSlotStubs( const OString& rShellName, - std::vector & rList, + std::vector & rList, SvStream & rOutStm ) const; sal_uInt16 WriteSlotMap( const OString& rShellName, sal_uInt16 nCount, diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 0ff06ae6562b..4becd0240289 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -251,7 +251,7 @@ void SvMetaClass::FillClasses( SvMetaClassList & rList ) void SvMetaClass::WriteSlotStubs( const OString& rShellName, SvSlotElementList & rSlotList, - std::vector & rList, + std::vector & rList, SvStream & rOutStm ) { // write all attributes @@ -306,10 +306,8 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) rOutStm << endl; rOutStm.WriteCharPtr( "};" ) << endl << endl; - std::vector aStringList; + std::vector aStringList; WriteSlotStubs( GetName(), aSlotList, aStringList, rOutStm ); - for ( size_t i = 0, n = aStringList.size(); i < n; ++i ) - delete aStringList[ i ]; aStringList.clear(); rOutStm << endl; diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index e04edb927e5b..25de8ecb17d0 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -354,7 +354,7 @@ static OString MakeSlotName( SvStringHashEntry const * pEntry ) }; void SvMetaSlot::WriteSlotStubs( const OString& rShellName, - std::vector & rList, + std::vector & rList, SvStream & rOutStm ) const { if ( !GetExport() && !GetHidden() ) @@ -367,7 +367,7 @@ void SvMetaSlot::WriteSlotStubs( const OString& rShellName, bool bIn = false; for( size_t n = 0; n < rList.size(); n++ ) { - if (*rList[n] == aMethodName) + if (rList[n] == aMethodName) { bIn = true; break; @@ -376,7 +376,7 @@ void SvMetaSlot::WriteSlotStubs( const OString& rShellName, if ( !bIn ) { - rList.push_back( new OString(aMethodName) ); + rList.push_back( aMethodName ); rOutStm.WriteCharPtr( "SFX_EXEC_STUB(" ) .WriteOString( rShellName ) .WriteChar( ',' ) @@ -392,7 +392,7 @@ void SvMetaSlot::WriteSlotStubs( const OString& rShellName, bool bIn = false; for ( size_t n=0; n < rList.size(); n++ ) { - if (*rList[n] == aMethodName) + if (rList[n] == aMethodName) { bIn = true; break; @@ -401,7 +401,7 @@ void SvMetaSlot::WriteSlotStubs( const OString& rShellName, if ( !bIn ) { - rList.push_back( new OString(aMethodName) ); + rList.push_back( aMethodName ); rOutStm.WriteCharPtr( "SFX_STATE_STUB(" ) .WriteOString( rShellName ) .WriteChar( ',' ) -- cgit