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>
This commit is contained in:
Noel Grandin 2017-01-16 09:58:49 +02:00
parent 18c2a1a902
commit 99e09b18b7
2 changed files with 8 additions and 12 deletions

View File

@ -42,7 +42,7 @@ namespace COMPMOD_NAMESPACE
// implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner
class OModuleImpl
{
ResMgr* m_pResources;
std::unique_ptr<ResMgr> m_pResources;
bool m_bInitialized;
OString m_sFilePrefix;
@ -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();
}

View File

@ -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)