diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 09:58:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 11:43:03 +0000 |
commit | 99e09b18b76c22c654a2c40e8176807ceff77c5f (patch) | |
tree | 3ef02d4e400acb05a8d65733da08d9fd46f8b76b /extensions | |
parent | 18c2a1a902659c03fb12caea731ba5cb9aaf6226 (diff) |
new loplugin: useuniqueptr: extensions
Change-Id: Iaafaf0117a339dbb435cec2bbf4dca55629ab8a2
Reviewed-on: https://gerrit.libreoffice.org/33154
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/inc/componentmodule.cxx | 11 | ||||
-rw-r--r-- | extensions/source/resource/oooresourceloader.cxx | 9 |
2 files changed, 8 insertions, 12 deletions
diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx index 17f820e1f6f5..3f1f4925ea9d 100644 --- a/extensions/source/inc/componentmodule.cxx +++ b/extensions/source/inc/componentmodule.cxx @@ -42,9 +42,9 @@ namespace COMPMOD_NAMESPACE // implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner class OModuleImpl { - ResMgr* m_pResources; - bool m_bInitialized; - OString m_sFilePrefix; + std::unique_ptr<ResMgr> m_pResources; + bool m_bInitialized; + OString m_sFilePrefix; public: /// ctor @@ -66,7 +66,6 @@ namespace COMPMOD_NAMESPACE OModuleImpl::~OModuleImpl() { - delete m_pResources; } @@ -77,7 +76,7 @@ namespace COMPMOD_NAMESPACE { DBG_ASSERT(!m_sFilePrefix.isEmpty(), "OModuleImpl::getResManager: no resource file prefix!"); // create a manager with a fixed prefix - m_pResources = ResMgr::CreateResMgr(m_sFilePrefix.getStr()); + m_pResources.reset( ResMgr::CreateResMgr(m_sFilePrefix.getStr()) ); DBG_ASSERT(m_pResources, OStringBuffer("OModuleImpl::getResManager: could not create the resource manager (file name: ") .append(m_sFilePrefix) @@ -85,7 +84,7 @@ namespace COMPMOD_NAMESPACE m_bInitialized = true; } - return m_pResources; + return m_pResources.get(); } diff --git a/extensions/source/resource/oooresourceloader.cxx b/extensions/source/resource/oooresourceloader.cxx index 0961cc0b34e6..f50d22ebd624 100644 --- a/extensions/source/resource/oooresourceloader.cxx +++ b/extensions/source/resource/oooresourceloader.cxx @@ -84,7 +84,7 @@ namespace extensions { namespace resource ::osl::Mutex m_aMutex; Reference< XResourceBundle > m_xParent; Locale m_aLocale; - SimpleResMgr* m_pResourceManager; + std::unique_ptr<SimpleResMgr> m_pResourceManager; ResourceTypes m_aResourceTypes; public: @@ -177,13 +177,11 @@ namespace extensions { namespace resource :m_aLocale( _rLocale ) ,m_pResourceManager( nullptr ) { - m_pResourceManager = new SimpleResMgr( OUStringToOString( _rBaseName, RTL_TEXTENCODING_UTF8 ).getStr(), - LanguageTag( m_aLocale) ); + m_pResourceManager.reset( new SimpleResMgr( OUStringToOString( _rBaseName, RTL_TEXTENCODING_UTF8 ).getStr(), + LanguageTag( m_aLocale) ) ); if ( !m_pResourceManager->IsValid() ) { - delete m_pResourceManager; - m_pResourceManager = nullptr; throw MissingResourceException(); } @@ -194,7 +192,6 @@ namespace extensions { namespace resource OpenOfficeResourceBundle::~OpenOfficeResourceBundle() { - delete m_pResourceManager; } Reference< XResourceBundle > SAL_CALL OpenOfficeResourceBundle::getParent() throw (RuntimeException, std::exception) |