diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-06 10:42:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-17 07:06:42 +0100 |
commit | cc85db4c4e2ca9ef8e1c9fc0af6d314767678faa (patch) | |
tree | 788302f5b9835a53aed72c6bb48e28b63d3011f3 /scaddins | |
parent | 722d0b9882f20b7ae535c28fd1e2846756129376 (diff) |
loplugin:useuniqueptr in scaddins
Change-Id: I5c2c8301078d19824fb35966b158471ce6650c10
Reviewed-on: https://gerrit.libreoffice.org/49873
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/analysis/analysis.cxx | 13 | ||||
-rw-r--r-- | scaddins/source/analysis/analysis.hxx | 6 | ||||
-rw-r--r-- | scaddins/source/pricing/pricing.cxx | 15 | ||||
-rw-r--r-- | scaddins/source/pricing/pricing.hxx | 5 |
4 files changed, 13 insertions, 26 deletions
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 6c6a94afdb42..34414abd0f50 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -73,12 +73,10 @@ void AnalysisAddIn::InitData() { aResLocale = Translate::Create("sca", LanguageTag(aFuncLoc)); - delete pFD; - pFD = new FuncDataList; + pFD.reset(new FuncDataList); InitFuncDataList(*pFD); - delete pDefLocales; - pDefLocales = nullptr; + pDefLocales.reset(); } AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xContext ) : @@ -92,9 +90,6 @@ AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xC AnalysisAddIn::~AnalysisAddIn() { - delete pCDL; - delete pFD; - delete[] pDefLocales; } sal_Int32 AnalysisAddIn::getDateMode( @@ -337,7 +332,7 @@ static const sal_uInt32 nNumOfLoc = SAL_N_ELEMENTS(pLang); void AnalysisAddIn::InitDefLocales() { - pDefLocales = new lang::Locale[ nNumOfLoc ]; + pDefLocales.reset( new lang::Locale[ nNumOfLoc ] ); for( sal_uInt32 n = 0 ; n < nNumOfLoc ; n++ ) { @@ -1099,7 +1094,7 @@ OUString SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const uno::An double SAL_CALL AnalysisAddIn::getConvert( double f, const OUString& aFU, const OUString& aTU ) { if( !pCDL ) - pCDL = new ConvertDataList(); + pCDL.reset(new ConvertDataList()); double fRet = pCDL->Convert( f, aFU, aTU ); RETURN_FINITE( fRet ); diff --git a/scaddins/source/analysis/analysis.hxx b/scaddins/source/analysis/analysis.hxx index f187836d4a02..c90c265abc82 100644 --- a/scaddins/source/analysis/analysis.hxx +++ b/scaddins/source/analysis/analysis.hxx @@ -53,10 +53,10 @@ class AnalysisAddIn : public cppu::WeakImplHelper< { private: css::lang::Locale aFuncLoc; - css::lang::Locale* pDefLocales; - sca::analysis::FuncDataList* pFD; + std::unique_ptr<css::lang::Locale[]> pDefLocales; + std::unique_ptr<sca::analysis::FuncDataList> pFD; std::unique_ptr<double[]> pFactDoubles; - sca::analysis::ConvertDataList* pCDL; + std::unique_ptr<sca::analysis::ConvertDataList> pCDL; std::locale aResLocale; sca::analysis::ScaAnyConverter aAnyConv; diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index d60e4516cbf4..271e18ac80b0 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -133,8 +133,6 @@ ScaPricingAddIn::ScaPricingAddIn() : ScaPricingAddIn::~ScaPricingAddIn() { - delete pFuncDataList; - delete[] pDefLocales; } static const sal_Char* pLang[] = { "de", "en" }; @@ -143,7 +141,7 @@ static const sal_uInt32 nNumOfLoc = SAL_N_ELEMENTS( pLang ); void ScaPricingAddIn::InitDefLocales() { - pDefLocales = new lang::Locale[ nNumOfLoc ]; + pDefLocales.reset( new lang::Locale[ nNumOfLoc ] ); for( sal_uInt32 nIndex = 0; nIndex < nNumOfLoc; nIndex++ ) { @@ -163,16 +161,9 @@ const lang::Locale& ScaPricingAddIn::GetLocale( sal_uInt32 nIndex ) void ScaPricingAddIn::InitData() { aResLocale = Translate::Create("sca", LanguageTag(aFuncLoc)); - delete pFuncDataList; - - pFuncDataList = new ScaFuncDataList; + pFuncDataList.reset(new ScaFuncDataList); InitScaFuncDataList(*pFuncDataList); - - if( pDefLocales ) - { - delete pDefLocales; - pDefLocales = nullptr; - } + pDefLocales.reset(); } OUString ScaPricingAddIn::GetFuncDescrStr(const char** pResId, sal_uInt16 nStrIndex) diff --git a/scaddins/source/pricing/pricing.hxx b/scaddins/source/pricing/pricing.hxx index eb353e0a2235..6ee27108c2ba 100644 --- a/scaddins/source/pricing/pricing.hxx +++ b/scaddins/source/pricing/pricing.hxx @@ -30,6 +30,7 @@ #include <string.h> #include <vector> +#include <memory> #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -131,9 +132,9 @@ class ScaPricingAddIn : public ::cppu::WeakImplHelper< { private: css::lang::Locale aFuncLoc; - css::lang::Locale* pDefLocales; + std::unique_ptr<css::lang::Locale[]> pDefLocales; std::locale aResLocale; - sca::pricing::ScaFuncDataList* pFuncDataList; + std::unique_ptr<sca::pricing::ScaFuncDataList> pFuncDataList; void InitDefLocales(); |