loplugin:useuniqueptr in lingucomponent

Change-Id: I5d668718620114cb8b9d53375497a4d0b1759abb
Reviewed-on: https://gerrit.libreoffice.org/39852
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-07-12 09:34:07 +02:00
parent d65567230f
commit 0088f365b1
2 changed files with 4 additions and 5 deletions

View File

@@ -88,7 +88,6 @@ SpellChecker::~SpellChecker()
}
delete[] m_aDicts;
}
delete[] m_aDEncs;
delete[] m_aDLocs;
delete[] m_aDNames;
if (m_pPropHelper)
@@ -200,7 +199,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
// add dictionary information
m_aDicts = new Hunspell* [m_nNumDict];
m_aDEncs = new rtl_TextEncoding [m_nNumDict];
m_aDEncs.reset( new rtl_TextEncoding [m_nNumDict] );
m_aDLocs = new Locale [m_nNumDict];
m_aDNames = new OUString [m_nNumDict];
k = 0;
@@ -240,8 +239,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
m_nNumDict = 0;
delete[] m_aDicts;
m_aDicts = nullptr;
delete[] m_aDEncs;
m_aDEncs = nullptr;
m_aDEncs.reset();
delete[] m_aDLocs;
m_aDLocs = nullptr;
delete[] m_aDNames;

View File

@@ -34,6 +34,7 @@
#include <linguistic/lngprophelp.hxx>
#include <lingutil.hxx>
#include <memory>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -55,7 +56,7 @@ class SpellChecker :
{
Sequence< Locale > m_aSuppLocales;
Hunspell ** m_aDicts;
rtl_TextEncoding * m_aDEncs;
std::unique_ptr<rtl_TextEncoding[]> m_aDEncs;
Locale * m_aDLocs;
OUString * m_aDNames;
sal_Int32 m_nNumDict;