diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 13:57:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 09:35:21 +0000 |
commit | 0415cb335b953b9c10075fa524d7707db4aa55e5 (patch) | |
tree | f714106565c6c58a4711b21f966ecc09c8b83157 /stoc | |
parent | c3e6d12301b42a44bd0d4584005686e324533b60 (diff) |
new loplugin: useuniqueptr: sot..tools
Change-Id: Ided435d016ae28e7c3f2726e41eedd981572ae10
Reviewed-on: https://gerrit.libreoffice.org/33263
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 10 | ||||
-rw-r--r-- | stoc/source/corereflection/crcomp.cxx | 3 | ||||
-rw-r--r-- | stoc/source/corereflection/crenum.cxx | 3 | ||||
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 9 |
4 files changed, 11 insertions, 14 deletions
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 <algorithm> #endif #include <unordered_map> +#include <memory> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -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 <cstddef> #include <limits> #include <map> +#include <memory> #include <set> #include <o3tl/any.hxx> @@ -209,7 +210,7 @@ class IntrospectionAccessStatic_Impl: public salhelper::SimpleReferenceObject bool mbUnoTunnel; // Original handles of FastPropertySets - sal_Int32* mpOrgPropertyHandleArray; + std::unique_ptr<sal_Int32[]> mpOrgPropertyHandleArray; // MethodSequence, that accepts all methods std::vector< Reference<XIdlMethod> > 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<css::beans::XIntrospectionAccess> 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++ ) { |