[Libreoffice-commits] core.git: 2 commits - lotuswordpro/inc lotuswordpro/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 06:31:33 UTC 2018


 lotuswordpro/inc/lwpfont.hxx           |    4 ++--
 lotuswordpro/source/filter/lwpfont.cxx |   14 ++------------
 2 files changed, 4 insertions(+), 14 deletions(-)

New commits:
commit ce7cb67aad5e49cfb59e7ca3927cfef610a6ca43
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 10:32:15 2018 +0200

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

diff --git a/lotuswordpro/inc/lwpfont.hxx b/lotuswordpro/inc/lwpfont.hxx
index 6413f6ea887b..bcaec1233876 100644
--- a/lotuswordpro/inc/lwpfont.hxx
+++ b/lotuswordpro/inc/lwpfont.hxx
@@ -164,7 +164,7 @@ public:
     OUString GetNameByIndex(sal_uInt16 index);
 private:
     sal_uInt16 m_nCount;
-    LwpFontNameEntry* m_pFontNames;
+    std::unique_ptr<LwpFontNameEntry[]> m_pFontNames;
     LwpFontTable m_FontTbl;
 
 public:
diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx
index 6b4739577083..fda432add2b4 100644
--- a/lotuswordpro/source/filter/lwpfont.cxx
+++ b/lotuswordpro/source/filter/lwpfont.cxx
@@ -362,11 +362,6 @@ LwpFontNameManager::LwpFontNameManager()
 
 LwpFontNameManager::~LwpFontNameManager()
 {
-    if(m_pFontNames)
-    {
-        delete [] m_pFontNames;
-        m_pFontNames = nullptr;
-    }
 }
 
 void LwpFontNameManager::Read(LwpObjectStream *pStrm)
@@ -374,7 +369,7 @@ void LwpFontNameManager::Read(LwpObjectStream *pStrm)
     m_nCount = pStrm->QuickReaduInt16();
     if(m_nCount>0)
     {
-        m_pFontNames = new LwpFontNameEntry[m_nCount];
+        m_pFontNames.reset( new LwpFontNameEntry[m_nCount] );
         for(sal_uInt16 i=0; i<m_nCount; i++)
         {
             m_pFontNames[i].Read(pStrm);
commit 34bda0fef87bf17440372d5663239c091c92b55b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 10:30:59 2018 +0200

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

diff --git a/lotuswordpro/inc/lwpfont.hxx b/lotuswordpro/inc/lwpfont.hxx
index 93fdce7fe882..6413f6ea887b 100644
--- a/lotuswordpro/inc/lwpfont.hxx
+++ b/lotuswordpro/inc/lwpfont.hxx
@@ -100,7 +100,7 @@ public:
 //  void RegisterFontDecls();
 private:
     sal_uInt16 m_nCount;
-    LwpFontTableEntry* m_pFontEntries;
+    std::unique_ptr<LwpFontTableEntry[]> m_pFontEntries;
 };
 
 class LwpFontNameEntry
diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx
index eee1f3eb8807..6b4739577083 100644
--- a/lotuswordpro/source/filter/lwpfont.cxx
+++ b/lotuswordpro/source/filter/lwpfont.cxx
@@ -253,7 +253,7 @@ void LwpFontTable::Read(LwpObjectStream *pStrm)
     m_nCount = pStrm->QuickReaduInt16();
     if(m_nCount>0)
     {
-        m_pFontEntries = new LwpFontTableEntry[m_nCount];
+        m_pFontEntries.reset( new LwpFontTableEntry[m_nCount] );
         for(sal_uInt16 i=0; i<m_nCount; i++)
         {
             m_pFontEntries[i].Read(pStrm);
@@ -270,11 +270,6 @@ OUString LwpFontTable::GetFaceName(sal_uInt16 index) //index: start from 1
 
 LwpFontTable::~LwpFontTable()
 {
-    if(m_pFontEntries)
-    {
-        delete [] m_pFontEntries;
-        m_pFontEntries = nullptr;
-    }
 }
 
 void LwpFontNameEntry::Read(LwpObjectStream *pStrm)


More information about the Libreoffice-commits mailing list