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>
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user