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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 15 05:57:42 UTC 2019


 sw/inc/swunohelper.hxx                 |    3 +--
 sw/source/core/unocore/swunohelper.cxx |    6 +++---
 sw/source/uibase/utlui/gloslst.cxx     |   14 +++++---------
 3 files changed, 9 insertions(+), 14 deletions(-)

New commits:
commit 1c4acfdcb10b2cdeac8efb331fc9db8d01de9c66
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jan 14 10:15:18 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jan 15 06:57:30 2019 +0100

    fix unnecessary delete
    
    the erase on the preceding line will delete it,
    
    ever since
        commit a846c7106d4e4e1b8cc61e237cc2e158d037e816
        Date:   Wed Jul 25 12:26:15 2018 +0200
        loplugin:useuniqueptr in SwGlossaryList
    
    Change-Id: I8f71bca8eebf762aeea3225d3a3b52ec2ac60e19
    Reviewed-on: https://gerrit.libreoffice.org/66316
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 2c92c4a5acbb..d7e97deff15b 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -318,7 +318,6 @@ void SwGlossaryList::Update()
                     if(!bFound)
                     {
                         aGroupArr.erase(aGroupArr.begin() + i);
-                        delete pGroup;
                     }
                 }
             }
commit f7214c70676b35baff427d986ffb85b8c79c0ca8
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jan 14 10:11:45 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jan 15 06:57:19 2019 +0100

    simplify UCB_GetFileListOfFolder
    
    no need to use heap objects here
    
    Change-Id: Iadc35b019da7b9446ede79c96a9d8ce8c6db81ef
    Reviewed-on: https://gerrit.libreoffice.org/66315
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx
index 35459bdcfa31..b87d7dda833e 100644
--- a/sw/inc/swunohelper.hxx
+++ b/sw/inc/swunohelper.hxx
@@ -56,11 +56,10 @@ SW_DLLPUBLIC bool UCB_IsReadOnlyFileName( const OUString& rURL );
     // options: pExtension = 0 -> all, else this specific extension
     //          pDateTime != 0 -> returns also the modified date/time of
     //                       the files in a vector -->
-    //                       !! objects must be deleted from the caller!!
 bool UCB_GetFileListOfFolder( const OUString& rURL,
                                 std::vector<OUString>& rList,
                                 const OUString* pExtension,
-                                std::vector<DateTime*>* pDateTimeList = nullptr );
+                                std::vector<DateTime>* pDateTimeList = nullptr );
 
     // is the URL an existing file?
 SW_DLLPUBLIC bool UCB_IsFile( const OUString& rURL );
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index e2fcdcf0724f..29e76e9bd554 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -184,7 +184,7 @@ bool UCB_IsDirectory( const OUString& rURL )
 bool UCB_GetFileListOfFolder( const OUString& rURL,
                                 std::vector<OUString>& rList,
                                 const OUString* pExtension,
-                                std::vector< ::DateTime* >* pDateTimeList )
+                                std::vector< ::DateTime >* pDateTimeList )
 {
     bool bOk = false;
     try
@@ -227,7 +227,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL,
                             if( pDateTimeList )
                             {
                                 css::util::DateTime aStamp = xRow->getTimestamp(2);
-                                ::DateTime* pDateTime = new ::DateTime(
+                                ::DateTime aDateTime(
                                         ::Date( aStamp.Day,
                                                 aStamp.Month,
                                                 aStamp.Year ),
@@ -235,7 +235,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL,
                                                 aStamp.Minutes,
                                                 aStamp.Seconds,
                                                 aStamp.NanoSeconds ));
-                                pDateTimeList->push_back( pDateTime );
+                                pDateTimeList->push_back( aDateTime );
                             }
                         }
 
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 0a05aa8acaf3..2c92c4a5acbb 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -270,14 +270,14 @@ void SwGlossaryList::Update()
         {
             std::vector<OUString> aFoundGroupNames;
             std::vector<OUString> aFiles;
-            std::vector<DateTime*> aDateTimeArr;
+            std::vector<DateTime> aDateTimeArr;
 
             SWUnoHelper::UCB_GetFileListOfFolder( rPathArr[nPath], aFiles,
                                                     &sExt, &aDateTimeArr );
             for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles )
             {
                 const OUString aTitle = aFiles[ nFiles ];
-                ::DateTime* pDT = aDateTimeArr[ nFiles ];
+                ::DateTime& rDT = aDateTimeArr[ nFiles ];
 
                 OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() ));
 
@@ -289,18 +289,15 @@ void SwGlossaryList::Update()
                     pFound = new AutoTextGroup;
                     pFound->sName = sName;
                     FillGroup( pFound, pGlossaries );
-                    pFound->aDateModified = *pDT;
+                    pFound->aDateModified = rDT;
 
                     aGroupArr.push_back(std::unique_ptr<AutoTextGroup>(pFound));
                 }
-                else if( pFound->aDateModified < *pDT )
+                else if( pFound->aDateModified < rDT )
                 {
                     FillGroup(pFound, pGlossaries);
-                    pFound->aDateModified = *pDT;
+                    pFound->aDateModified = rDT;
                 }
-
-                // don't need any more these pointers
-                delete pDT;
             }
 
             for( size_t i = aGroupArr.size(); i>0; )


More information about the Libreoffice-commits mailing list