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

Stephan Bergmann sbergman at redhat.com
Thu Jan 26 08:07:19 UTC 2017


 ucb/source/ucp/webdav/webdavcontentcaps.cxx  |    3 ++-
 ucb/source/ucp/webdav/webdavdatasupplier.cxx |   23 +++++++++++++----------
 ucb/source/ucp/webdav/webdavdatasupplier.hxx |    5 ++++-
 ucb/source/ucp/webdav/webdavprovider.cxx     |    7 ++-----
 ucb/source/ucp/webdav/webdavprovider.hxx     |    6 +++++-
 5 files changed, 26 insertions(+), 18 deletions(-)

New commits:
commit 9f5c54856fe24f5ada639f7eaff2cfbf744c8cfe
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 26 09:06:38 2017 +0100

    loplugin:useuniqueptr
    
    Change-Id: I5091c2b4550dee1f0b602a5337e17fe78b9d07f9

diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
index 08e95e2..d8e1944 100644
--- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/util/DateTime.hpp>
 #include <com/sun/star/ucb/Lock.hpp>
 #include <com/sun/star/ucb/LockEntry.hpp>
+#include <o3tl/make_unique.hxx>
 #include "webdavcontent.hxx"
 #include "webdavprovider.hxx"
 #include "DAVSession.hxx"
@@ -52,7 +53,7 @@ bool ContentProvider::getProperty(
         osl::MutexGuard aGuard( m_aMutex );
         if ( !m_pProps )
         {
-            m_pProps = new PropertyMap;
+            m_pProps = o3tl::make_unique<PropertyMap>();
 
 
             // Fill map of known properties...
diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx
index 0cca80f..cbc7cc3 100644
--- a/ucb/source/ucp/webdav/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav/webdavprovider.cxx
@@ -37,17 +37,14 @@ using namespace http_dav_ucp;
 ContentProvider::ContentProvider(
                 const uno::Reference< uno::XComponentContext >& rContext )
 : ::ucbhelper::ContentProviderImplHelper( rContext ),
-  m_xDAVSessionFactory( new DAVSessionFactory() ),
-  m_pProps( nullptr )
+  m_xDAVSessionFactory( new DAVSessionFactory() )
 {
 }
 
 
 // virtual
 ContentProvider::~ContentProvider()
-{
-    delete m_pProps;
-}
+{}
 
 
 // XInterface methods.
diff --git a/ucb/source/ucp/webdav/webdavprovider.hxx b/ucb/source/ucp/webdav/webdavprovider.hxx
index 3231eb2..2672b26 100644
--- a/ucb/source/ucp/webdav/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav/webdavprovider.hxx
@@ -21,6 +21,10 @@
 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_WEBDAVPROVIDER_HXX
 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_WEBDAVPROVIDER_HXX
 
+#include <sal/config.h>
+
+#include <memory>
+
 #include <rtl/ref.hxx>
 #include <com/sun/star/beans/Property.hpp>
 #include "DAVSessionFactory.hxx"
@@ -62,7 +66,7 @@ namespace http_dav_ucp {
 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
 {
     rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory;
-    PropertyMap * m_pProps;
+    std::unique_ptr<PropertyMap> m_pProps;
 
 public:
     explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rContext );
commit 6a16775c7828358ba0bf6ecdbd785991c06036f7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 26 08:56:55 2017 +0100

    loplugin:useuniqueptr
    
    Change-Id: I1fa141ee0d8d818f3ed5b31faa1ac578ba791e39

diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.cxx b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
index cfb8dd5..9765d84 100644
--- a/ucb/source/ucp/webdav/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
@@ -17,6 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <memory>
+#include <utility>
+
+#include <o3tl/make_unique.hxx>
 #include <osl/diagnose.h>
 #include <com/sun/star/ucb/OpenMode.hpp>
 #include <ucbhelper/contentidentifier.hxx>
@@ -43,10 +49,9 @@ struct ResultListEntry
     uno::Reference< ucb::XContentIdentifier > xId;
     uno::Reference< ucb::XContent >           xContent;
     uno::Reference< sdbc::XRow >              xRow;
-    const ContentProperties*                  pData;
+    std::unique_ptr<ContentProperties> pData;
 
-    explicit ResultListEntry( const ContentProperties* pEntry ) : pData( pEntry ) {}
-    ~ResultListEntry() { delete pData; }
+    explicit ResultListEntry( std::unique_ptr<ContentProperties> && pEntry ) : pData( std::move(pEntry) ) {}
 };
 
 
@@ -101,16 +106,14 @@ DataSupplier::DataSupplier(
             const uno::Reference< uno::XComponentContext >& rxContext,
             const rtl::Reference< Content >& rContent,
             sal_Int32 nOpenMode )
-: m_pImpl( new DataSupplier_Impl( rxContext, rContent, nOpenMode ) )
+: m_pImpl(o3tl::make_unique<DataSupplier_Impl>(rxContext, rContent, nOpenMode))
 {
 }
 
 
 // virtual
 DataSupplier::~DataSupplier()
-{
-    delete m_pImpl;
-}
+{}
 
 
 // virtual
@@ -415,8 +418,8 @@ bool DataSupplier::getData()
                         }
                     }
 
-                    ContentProperties* pContentProperties
-                        = new ContentProperties( rRes );
+                    std::unique_ptr<ContentProperties> pContentProperties
+                        = o3tl::make_unique<ContentProperties>( rRes );
 
                     // Check resource against open mode.
                     switch ( m_pImpl->m_nOpenMode )
@@ -455,7 +458,7 @@ bool DataSupplier::getData()
                     }
 
                     m_pImpl->m_aResults.push_back(
-                        new ResultListEntry( pContentProperties ) );
+                        new ResultListEntry( std::move(pContentProperties) ) );
                 }
             }
             catch ( DAVException const & )
diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.hxx b/ucb/source/ucp/webdav/webdavdatasupplier.hxx
index 053e61a..7c168c0 100644
--- a/ucb/source/ucp/webdav/webdavdatasupplier.hxx
+++ b/ucb/source/ucp/webdav/webdavdatasupplier.hxx
@@ -21,6 +21,9 @@
 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_WEBDAVDATASUPPLIER_HXX
 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_WEBDAVDATASUPPLIER_HXX
 
+#include <sal/config.h>
+
+#include <memory>
 #include <vector>
 #include <rtl/ref.hxx>
 #include <ucbhelper/resultset.hxx>
@@ -34,7 +37,7 @@ class ContentProperties;
 
 class DataSupplier : public ucbhelper::ResultSetDataSupplier
 {
-    DataSupplier_Impl* m_pImpl;
+    std::unique_ptr<DataSupplier_Impl> m_pImpl;
 
 private:
     bool getData();


More information about the Libreoffice-commits mailing list