summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-16 14:48:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-19 08:58:46 +0200
commit59548784486cfa42662490432474431f760dacc1 (patch)
treebfc33ae1d67c6f66864bac97ca4c90b7ef9f0fa7 /basic
parent263d7325691f4b0a1bda155f1c53bbcf712e9f09 (diff)
loplugin:useuniqueptr in SbiGlobals
Change-Id: I0ebec3193b4369039f90be4223ebdf6d048b8478
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sb.cxx16
-rw-r--r--basic/source/classes/sbintern.cxx6
-rw-r--r--basic/source/inc/sbintern.hxx6
-rw-r--r--basic/source/runtime/methods.cxx7
4 files changed, 18 insertions, 17 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 6562a3fc9d69..524b392a6e98 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -915,8 +915,8 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
if( !GetSbData()->nInst++ )
{
- GetSbData()->pSbFac = new SbiFactory;
- AddFactory( GetSbData()->pSbFac );
+ GetSbData()->pSbFac.reset( new SbiFactory );
+ AddFactory( GetSbData()->pSbFac.get() );
GetSbData()->pTypeFac = new SbTypeFactory;
AddFactory( GetSbData()->pTypeFac );
GetSbData()->pClassFac = new SbClassFactory;
@@ -925,8 +925,8 @@ StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
AddFactory( GetSbData()->pOLEFac );
GetSbData()->pFormFac = new SbFormFactory;
AddFactory( GetSbData()->pFormFac );
- GetSbData()->pUnoFac = new SbUnoFactory;
- AddFactory( GetSbData()->pUnoFac );
+ GetSbData()->pUnoFac.reset( new SbUnoFactory );
+ AddFactory( GetSbData()->pUnoFac.get() );
}
pRtl = new SbiStdObject(RTLNAME, this );
// Search via StarBasic is always global
@@ -954,10 +954,10 @@ StarBASIC::~StarBASIC()
if( !--GetSbData()->nInst )
{
- RemoveFactory( GetSbData()->pSbFac );
- delete GetSbData()->pSbFac; GetSbData()->pSbFac = nullptr;
- RemoveFactory( GetSbData()->pUnoFac );
- delete GetSbData()->pUnoFac; GetSbData()->pUnoFac = nullptr;
+ RemoveFactory( GetSbData()->pSbFac.get() );
+ GetSbData()->pSbFac.reset();
+ RemoveFactory( GetSbData()->pUnoFac.get() );
+ GetSbData()->pUnoFac.reset();
RemoveFactory( GetSbData()->pTypeFac );
delete GetSbData()->pTypeFac; GetSbData()->pTypeFac = nullptr;
RemoveFactory( GetSbData()->pClassFac );
diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx
index dc5d7b697fbe..1c4af0f5fa9b 100644
--- a/basic/source/classes/sbintern.cxx
+++ b/basic/source/classes/sbintern.cxx
@@ -60,9 +60,9 @@ SbiGlobals::SbiGlobals()
SbiGlobals::~SbiGlobals()
{
- delete pSbFac;
- delete pUnoFac;
- delete pTransliterationWrapper;
+ pSbFac.reset();
+ pUnoFac.reset();
+ pTransliterationWrapper.reset();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 4ff2d7ad547c..70e6e69a1e23 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -80,8 +80,8 @@ struct SbiGlobals
{
static SbiGlobals* pGlobals;
SbiInstance* pInst; // all active runtime instances
- SbiFactory* pSbFac; // StarBASIC-Factory
- SbUnoFactory* pUnoFac; // Factory for Uno-Structs at DIM AS NEW
+ std::unique_ptr<SbiFactory> pSbFac; // StarBASIC-Factory
+ std::unique_ptr<SbUnoFactory> pUnoFac; // Factory for Uno-Structs at DIM AS NEW
SbTypeFactory* pTypeFac; // Factory for user defined types
SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules)
SbOLEFactory* pOLEFac; // Factory for OLE types
@@ -98,7 +98,7 @@ struct SbiGlobals
bool bGlobalInitErr;
bool bRunInit; // true, if RunInit active from the Basic
OUString aErrMsg; // buffer for GetErrorText()
- ::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp
+ std::unique_ptr<::utl::TransliterationWrapper> pTransliterationWrapper; // For StrComp
bool bBlockCompilerError;
BasicManager* pAppBasMgr;
StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 17ee2b4f969d..58c8b35c9cb1 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1536,15 +1536,16 @@ void SbRtl_StrComp(StarBASIC *, SbxArray & rPar, bool)
sal_Int32 nRetValue = 0;
if( bTextCompare )
{
- ::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper;
+ ::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper.get();
if( !pTransliterationWrapper )
{
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
- pTransliterationWrapper = GetSbData()->pTransliterationWrapper =
+ GetSbData()->pTransliterationWrapper.reset(
new ::utl::TransliterationWrapper( xContext,
TransliterationFlags::IGNORE_CASE |
TransliterationFlags::IGNORE_KANA |
- TransliterationFlags::IGNORE_WIDTH );
+ TransliterationFlags::IGNORE_WIDTH ) );
+ pTransliterationWrapper = GetSbData()->pTransliterationWrapper.get();
}
LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType();