From 0415cb335b953b9c10075fa524d7707db4aa55e5 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 18 Jan 2017 13:57:55 +0200 Subject: new loplugin: useuniqueptr: sot..tools Change-Id: Ided435d016ae28e7c3f2726e41eedd981572ae10 Reviewed-on: https://gerrit.libreoffice.org/33263 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- stoc/source/corereflection/base.hxx | 10 ++++++---- stoc/source/corereflection/crcomp.cxx | 3 +-- stoc/source/corereflection/crenum.cxx | 3 +-- stoc/source/inspect/introspection.cxx | 9 +++------ 4 files changed, 11 insertions(+), 14 deletions(-) (limited to 'stoc') diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index b92da9a59866..15a95309c8b0 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -42,6 +42,7 @@ #include #endif #include +#include #include #include @@ -229,9 +230,10 @@ public: class CompoundIdlClassImpl : public IdlClassImpl { - css::uno::Reference< css::reflection::XIdlClass > _xSuperClass; - - css::uno::Sequence< css::uno::Reference< css::reflection::XIdlField > > * _pFields; + css::uno::Reference< css::reflection::XIdlClass > + _xSuperClass; + std::unique_ptr< css::uno::Sequence< css::uno::Reference< css::reflection::XIdlField > > > + _pFields; OUString2Field _aName2Field; public: @@ -294,7 +296,7 @@ public: class EnumIdlClassImpl : public IdlClassImpl { - css::uno::Sequence< css::uno::Reference< css::reflection::XIdlField > > * _pFields; + std::unique_ptr< css::uno::Sequence< css::uno::Reference< css::reflection::XIdlField > > > _pFields; OUString2Field _aName2Field; public: diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index 6e76911b2fff..3596e220a3c4 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -277,7 +277,6 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue ) CompoundIdlClassImpl::~CompoundIdlClassImpl() { - delete _pFields; } @@ -374,7 +373,7 @@ Sequence< Reference< XIdlField > > CompoundIdlClassImpl::getFields() } } - _pFields = pFields; + _pFields.reset( pFields ); } return *_pFields; } diff --git a/stoc/source/corereflection/crenum.cxx b/stoc/source/corereflection/crenum.cxx index 74c7a565bdca..594897049fef 100644 --- a/stoc/source/corereflection/crenum.cxx +++ b/stoc/source/corereflection/crenum.cxx @@ -165,7 +165,6 @@ void IdlEnumFieldImpl::set( Any &, const Any & ) EnumIdlClassImpl::~EnumIdlClassImpl() { - delete _pFields; } // IdlClassImpl modifications @@ -203,7 +202,7 @@ Sequence< Reference< XIdlField > > EnumIdlClassImpl::getFields() getReflection(), aName, IdlClassImpl::getTypeDescr(), getTypeDescr()->pEnumValues[nFields] ); } - _pFields = pFields; + _pFields.reset( pFields ); } } return *_pFields; diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 4a4ac6bcc170..da3b8c961ead 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -209,7 +210,7 @@ class IntrospectionAccessStatic_Impl: public salhelper::SimpleReferenceObject bool mbUnoTunnel; // Original handles of FastPropertySets - sal_Int32* mpOrgPropertyHandleArray; + std::unique_ptr mpOrgPropertyHandleArray; // MethodSequence, that accepts all methods std::vector< Reference > maAllMethodSeq; @@ -230,10 +231,6 @@ class IntrospectionAccessStatic_Impl: public salhelper::SimpleReferenceObject public: explicit IntrospectionAccessStatic_Impl( Reference< XIdlReflection > const & xCoreReflection_ ); - virtual ~IntrospectionAccessStatic_Impl() override - { - delete[] mpOrgPropertyHandleArray; - } sal_Int32 getPropertyIndex( const OUString& aPropertyName ) const; sal_Int32 getMethodIndex( const OUString& aMethodName ) const; @@ -1779,7 +1776,7 @@ css::uno::Reference Implementation::inspect( // For a FastPropertySet we must remember the original handles if( bFast ) - pAccess->mpOrgPropertyHandleArray = new sal_Int32[ nLen ]; + pAccess->mpOrgPropertyHandleArray.reset( new sal_Int32[ nLen ] ); for( i = 0 ; i < nLen ; i++ ) { -- cgit