diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-16 15:47:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-23 11:17:34 +0100 |
commit | 18bc0ea4f26eb3ce020597d9feef9ee852a26096 (patch) | |
tree | 10cfb8f4b20a7ec32f2e8006be2ddb49f16dd6bd /sfx2 | |
parent | 53c304789eb8da8f5a7b2209ece68eeaec819a8f (diff) |
loplugin:useuniqueptr in SfxDocTplService_Impl
Change-Id: Iacda2920f632a6f21d852d843e97086a23479bbd
Reviewed-on: https://gerrit.libreoffice.org/48370
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index eee0ac0363ac..61bf957b5713 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -185,7 +185,7 @@ class SfxDocTplService_Impl Sequence< OUString > maTemplateDirs; Sequence< OUString > maInternalTemplateDirs; OUString maRootURL; - std::vector< NamePair_Impl* > maNames; + std::vector< std::unique_ptr<NamePair_Impl> > maNames; lang::Locale maLocale; Content maRootContent; bool mbIsInitialized : 1; @@ -506,11 +506,11 @@ void SfxDocTplService_Impl::readFolderList() const size_t nCount = std::min(SAL_N_ELEMENTS(TEMPLATE_SHORT_NAMES_ARY), SAL_N_ELEMENTS(TEMPLATE_LONG_NAMES_ARY)); for (size_t i = 0; i < nCount; ++i) { - NamePair_Impl* pPair = new NamePair_Impl; + std::unique_ptr<NamePair_Impl> pPair( new NamePair_Impl ); pPair->maShortName = OUString::createFromAscii(TEMPLATE_SHORT_NAMES_ARY[i]); pPair->maLongName = SfxResId(TEMPLATE_LONG_NAMES_ARY[i]); - maNames.push_back( pPair ); + maNames.push_back( std::move(pPair) ); } } @@ -519,7 +519,7 @@ OUString SfxDocTplService_Impl::getLongName( const OUString& rShortName ) { OUString aRet; - for (NamePair_Impl* pPair : maNames) + for (auto const & pPair : maNames) { if ( pPair->maShortName == rShortName ) { @@ -1086,9 +1086,6 @@ SfxDocTplService_Impl::SfxDocTplService_Impl( const uno::Reference< XComponentCo SfxDocTplService_Impl::~SfxDocTplService_Impl() { ::osl::MutexGuard aGuard( maMutex ); - - for (NamePair_Impl* p : maNames) - delete p; maNames.clear(); } |