[Libreoffice-commits] core.git: lingucomponent/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Jul 12 13:53:00 UTC 2017


 lingucomponent/source/spellcheck/spell/sspellimp.cxx |    6 ++----
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |    3 ++-
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 0088f365b1c1e3103b310ac3371bc5c918fe617e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jul 12 09:34:07 2017 +0200

    loplugin:useuniqueptr in lingucomponent
    
    Change-Id: I5d668718620114cb8b9d53375497a4d0b1759abb
    Reviewed-on: https://gerrit.libreoffice.org/39852
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index a3c9696fa142..97b5c48a1676 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -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;
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index 63b13d19b11d..3a61900e8c15 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -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;


More information about the Libreoffice-commits mailing list