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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 06:59:50 UTC 2018


 sw/source/core/doc/docnum.cxx |    5 ++---
 sw/source/core/doc/doctxm.cxx |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 38a4b614c0f517e61c2979c4729921360960754b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 10 14:42:08 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 12 08:59:35 2018 +0200

    loplugin:useuniqueptr in SwDoc::GetUniqueNumRuleName
    
    Change-Id: I9612e3874aefa874b3d8733ac32b6f0a2e9a2a48
    Reviewed-on: https://gerrit.libreoffice.org/60349
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index e61ae5bfdcbb..1b975dc48942 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2229,8 +2229,8 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c
     }
 
     sal_uInt16 nNum(0), nTmp, nFlagSize = ( mpNumRuleTable->size() / 8 ) +2;
-    sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
-    memset( pSetFlags, 0, nFlagSize );
+    std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
+    memset( pSetFlags.get(), 0, nFlagSize );
 
     sal_Int32 nNmLen = aName.getLength();
     if( !bAutoNum && pChkStr )
@@ -2277,7 +2277,6 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c
                 break;
             }
     }
-    delete [] pSetFlags;
     if( pChkStr && !pChkStr->isEmpty() )
         return *pChkStr;
     return aName + OUString::number( ++nNum );
commit a13701cb6f0c01b1955b613d5d7507e47d4dbbfd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 10 14:41:41 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 12 08:59:24 2018 +0200

    loplugin:useuniqueptr in SwDoc::GetUniqueTOXBaseName
    
    Change-Id: I73851c8b630493980e58dad7d39da7c415517e77
    Reviewed-on: https://gerrit.libreoffice.org/60348
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 274d3eebe2c6..4aeab823bac3 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -625,8 +625,8 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
 
     SwSectionFormats::size_type nNum = 0;
     const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) +2;
-    sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
-    memset( pSetFlags, 0, nFlagSize );
+    std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
+    memset( pSetFlags.get(), 0, nFlagSize );
 
     for( auto pSectionFormat : *mpSectionFormatTable )
     {
@@ -670,7 +670,6 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
             }
         }
     }
-    delete [] pSetFlags;
     if ( bUseChkStr )
         return sChkStr;
     return aName + OUString::number( ++nNum );


More information about the Libreoffice-commits mailing list