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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 25 10:03:08 UTC 2018


 ucb/source/ucp/cmis/cmis_datasupplier.cxx |   16 +++++-----------
 ucb/source/ucp/cmis/cmis_datasupplier.hxx |    4 +---
 2 files changed, 6 insertions(+), 14 deletions(-)

New commits:
commit 88e26267844ac96f39d341ef05bd1536f210af74
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 19 16:35:25 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Sep 25 12:02:47 2018 +0200

    loplugin:useuniqueptr in cmis::DataSupplier
    
    Change-Id: If12889ffe320c6a2e2808709ce53438e92077a58
    Reviewed-on: https://gerrit.libreoffice.org/60958
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index 01819ad36a03..42c5c10157d2 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -47,7 +47,7 @@ namespace cmis
                  ( mnOpenMode == ucb::OpenMode::DOCUMENTS && !bIsFolder ) ||
                  ( mnOpenMode == ucb::OpenMode::ALL ) )
             {
-                maResults.push_back( new ResultListEntry( *it ) );
+                maResults.emplace_back( *it );
             }
         }
         mbCountFinal = true;
@@ -55,12 +55,6 @@ namespace cmis
 
     DataSupplier::~DataSupplier()
     {
-        while ( maResults.size( ) > 0 )
-        {
-            ResultListEntry* back = maResults.back( );
-            maResults.pop_back( );
-            delete back;
-        }
     }
 
     OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
@@ -80,7 +74,7 @@ namespace cmis
         if (!getResult(nIndex))
             return uno::Reference<ucb::XContent>();
 
-        return maResults[ nIndex ]->xContent;
+        return maResults[ nIndex ].xContent;
     }
 
     bool DataSupplier::getResult( sal_uInt32 nIndex )
@@ -115,7 +109,7 @@ namespace cmis
     {
         if ( nIndex < maResults.size() )
         {
-            uno::Reference< sdbc::XRow > xRow = maResults[ nIndex ]->xRow;
+            uno::Reference< sdbc::XRow > xRow = maResults[ nIndex ].xRow;
             if ( xRow.is() )
             {
                 // Already cached.
@@ -142,7 +136,7 @@ namespace cmis
                     uno::Reference< sdbc::XRow > xRow;
                     if ( aResult >>= xRow )
                     {
-                        maResults[ nIndex ]->xRow = xRow;
+                        maResults[ nIndex ].xRow = xRow;
                         return xRow;
                     }
                 }
@@ -157,7 +151,7 @@ namespace cmis
     void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
     {
         if ( nIndex < maResults.size() )
-            maResults[ nIndex ]->xRow.clear();
+            maResults[ nIndex ].xRow.clear();
     }
 
     void DataSupplier::close()
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.hxx b/ucb/source/ucp/cmis/cmis_datasupplier.hxx
index 0f618f04bc54..f7cad8774dc4 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.hxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.hxx
@@ -31,8 +31,6 @@ namespace cmis
         }
     };
 
-    typedef std::vector< ResultListEntry* > ResultList;
-
     class DataSupplier : public ucbhelper::ResultSetDataSupplier
     {
         private:
@@ -40,7 +38,7 @@ namespace cmis
             sal_Int32 mnOpenMode;
             bool mbCountFinal;
             void getData();
-            ResultList maResults;
+            std::vector< ResultListEntry > maResults;
 
         public:
             DataSupplier( ChildrenProvider* pChildrenProvider, sal_Int32 nOpenMode );


More information about the Libreoffice-commits mailing list