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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 06:29:40 UTC 2018


 chart2/source/controller/inc/AxisItemConverter.hxx            |    6 +--
 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx |   16 +++-------
 dbaccess/source/core/api/query.cxx                            |    2 -
 dbaccess/source/core/api/querydescriptor.cxx                  |    8 +----
 dbaccess/source/core/api/querydescriptor.hxx                  |    2 -
 5 files changed, 13 insertions(+), 21 deletions(-)

New commits:
commit f77302d76a5132a4b0f1dfb580111d829dd5415d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 28 16:03:42 2018 +0200

    loplugin:useuniqueptr in OQueryDescriptor_Base
    
    Change-Id: I9cea18df52bc0a35f94c2a42dfbe3edb61e1e8c0
    Reviewed-on: https://gerrit.libreoffice.org/50699
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index d1ade9cc26d5..d5234c7929dd 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -130,7 +130,7 @@ void OQuery::rebuildColumns()
         {
             xColumnDefinitions = xColSup->getColumns();
             if ( xColumnDefinitions.is() )
-                m_pColumnMediator = new OContainerMediator( m_pColumns, xColumnDefinitions );
+                m_pColumnMediator = new OContainerMediator( m_pColumns.get(), xColumnDefinitions );
         }
 
         // fill the columns with columns from the statement
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index 6ec94bfd291b..84b4ae657bfa 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -120,14 +120,14 @@ OQueryDescriptor_Base::OQueryDescriptor_Base(::osl::Mutex&  _rMutex,::cppu::OWea
     :m_bColumnsOutOfDate(true)
     ,m_rMutex(_rMutex)
 {
-    m_pColumns = new OColumns(_rMySelf, m_rMutex, true,std::vector< OUString>(), this,this);
+    m_pColumns.reset( new OColumns(_rMySelf, m_rMutex, true,std::vector< OUString>(), this,this) );
 }
 
 OQueryDescriptor_Base::OQueryDescriptor_Base(const OQueryDescriptor_Base& _rSource,::cppu::OWeakObject& _rMySelf)
     :m_bColumnsOutOfDate(true)
     ,m_rMutex(_rSource.m_rMutex)
 {
-    m_pColumns = new OColumns(_rMySelf, m_rMutex, true,std::vector< OUString>(), this,this);
+    m_pColumns.reset( new OColumns(_rMySelf, m_rMutex, true,std::vector< OUString>(), this,this) );
 
     m_sCommand = _rSource.m_sCommand;
     m_bEscapeProcessing = _rSource.m_bEscapeProcessing;
@@ -141,8 +141,6 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base()
 {
     m_pColumns->acquire();
     m_pColumns->disposing();
-    delete m_pColumns;
-
 }
 
 sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
@@ -204,7 +202,7 @@ Reference< XNameAccess > SAL_CALL OQueryDescriptor_Base::getColumns( )
         }
     }
 
-    return m_pColumns;
+    return m_pColumns.get();
 }
 
 OUString SAL_CALL OQueryDescriptor_Base::getImplementationName(  )
diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx
index 479e15d43105..0d2f9fe1da80 100644
--- a/dbaccess/source/core/api/querydescriptor.hxx
+++ b/dbaccess/source/core/api/querydescriptor.hxx
@@ -55,7 +55,7 @@ private:
     ::osl::Mutex&   m_rMutex;
 
 protected:
-    OColumns*       m_pColumns;                 // our column descriptions
+    std::unique_ptr<OColumns> m_pColumns;                 // our column descriptions
     OUString m_sElementName;
     virtual ~OQueryDescriptor_Base();
 
commit 4b44ab2fdf0d71428bdec3ca4090e7968851b24d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 28 16:00:56 2018 +0200

    loplugin:useuniqueptr in AxisItemConverter
    
    Change-Id: Idbe3a52a62da43e86e9695a3f1519d611e63011a
    Reviewed-on: https://gerrit.libreoffice.org/50698
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx
index ad742691ada5..3a82e54124af 100644
--- a/chart2/source/controller/inc/AxisItemConverter.hxx
+++ b/chart2/source/controller/inc/AxisItemConverter.hxx
@@ -56,15 +56,15 @@ protected:
     virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
 
 private:
-    std::vector< ItemConverter * >               m_aConverters;
+    std::vector< std::unique_ptr<ItemConverter> >  m_aConverters;
     css::uno::Reference<
         css::chart2::XAxis >  m_xAxis;
 
     css::uno::Reference<
         css::chart2::XChartDocument >      m_xChartDoc;
 
-    ExplicitScaleData*      m_pExplicitScale;
-    ExplicitIncrementData*  m_pExplicitIncrement;
+    std::unique_ptr<ExplicitScaleData>  m_pExplicitScale;
+    std::unique_ptr<ExplicitIncrementData>  m_pExplicitIncrement;
 };
 
 }}
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index 6b59fcb5394f..b0ba96674cf9 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -80,22 +80,20 @@ AxisItemConverter::AxisItemConverter(
     ::chart::ExplicitIncrementData const * pIncrement /* = NULL */,
     const awt::Size* pRefSize ) :
         ItemConverter( rPropertySet, rItemPool ),
-        m_xChartDoc( xChartDoc ),
-        m_pExplicitScale( nullptr ),
-        m_pExplicitIncrement( nullptr )
+        m_xChartDoc( xChartDoc )
 {
     Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
 
     if( pScale )
-        m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale );
+        m_pExplicitScale.reset( new ::chart::ExplicitScaleData( *pScale ) );
     if( pIncrement )
-        m_pExplicitIncrement = new ::chart::ExplicitIncrementData( *pIncrement );
+        m_pExplicitIncrement.reset( new ::chart::ExplicitIncrementData( *pIncrement ) );
 
-    m_aConverters.push_back( new GraphicPropertyItemConverter(
+    m_aConverters.emplace_back( new GraphicPropertyItemConverter(
                                  rPropertySet, rItemPool, rDrawModel,
                                  xNamedPropertyContainerFactory,
                                  GraphicObjectType::LineProperties ));
-    m_aConverters.push_back(
+    m_aConverters.emplace_back(
         new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
 
     m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
@@ -104,10 +102,6 @@ AxisItemConverter::AxisItemConverter(
 
 AxisItemConverter::~AxisItemConverter()
 {
-    delete m_pExplicitScale;
-    delete m_pExplicitIncrement;
-
-    std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
 }
 
 void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const


More information about the Libreoffice-commits mailing list