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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 13 06:31:21 UTC 2018


 sw/source/core/docnode/ndsect.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 43125f3b0b18b8d9bac9bd459fa234cb5ff9ddb4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 12 10:26:09 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 13 08:30:53 2018 +0200

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

diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 5e671ec72366..c64f7a0ab410 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1363,8 +1363,8 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
 
     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 pFormat : *mpSectionFormatTable )
     {
@@ -1404,7 +1404,7 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
             }
         }
     }
-    delete [] pSetFlags;
+    pSetFlags.reset();
     if( pChkStr )
         return *pChkStr;
     return aName + OUString::number( ++nNum );


More information about the Libreoffice-commits mailing list