[Libreoffice-commits] core.git: extensions/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Jan 16 11:43:24 UTC 2017
extensions/source/inc/componentmodule.cxx | 11 +++++------
extensions/source/resource/oooresourceloader.cxx | 9 +++------
2 files changed, 8 insertions(+), 12 deletions(-)
New commits:
commit 99e09b18b76c22c654a2c40e8176807ceff77c5f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Jan 16 09:58:49 2017 +0200
new loplugin: useuniqueptr: extensions
Change-Id: Iaafaf0117a339dbb435cec2bbf4dca55629ab8a2
Reviewed-on: https://gerrit.libreoffice.org/33154
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx
index 17f820e..3f1f492 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 0961cc0..f50d22e 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)
More information about the Libreoffice-commits
mailing list