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

Noel Grandin noel.grandin at collabora.co.uk
Mon May 28 06:47:05 UTC 2018


 dbaccess/source/ui/inc/querycontroller.hxx         |    4 ++--
 dbaccess/source/ui/querydesign/querycontroller.cxx |   10 ++++------
 svgio/source/svgreader/svgtextpathnode.cxx         |   12 ++++--------
 3 files changed, 10 insertions(+), 16 deletions(-)

New commits:
commit c269761290866b1634779dab89e2d5e2626caaa8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon May 21 15:49:30 2018 +0200

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

diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx
index dae7f4e47bd8..288782cfbcff 100644
--- a/svgio/source/svgreader/svgtextpathnode.cxx
+++ b/svgio/source/svgreader/svgtextpathnode.cxx
@@ -44,7 +44,7 @@ namespace svgio
             const sal_uInt32                mnMaxIndex;
             sal_uInt32                      mnIndex;
             basegfx::B2DCubicBezier         maCurrentSegment;
-            basegfx::B2DCubicBezierHelper*  mpB2DCubicBezierHelper;
+            std::unique_ptr<basegfx::B2DCubicBezierHelper> mpB2DCubicBezierHelper;
             double                          mfCurrentSegmentLength;
             double                          mfSegmentStartPosition;
 
@@ -72,21 +72,17 @@ namespace svgio
 
         void pathTextBreakupHelper::freeB2DCubicBezierHelper()
         {
-            if(mpB2DCubicBezierHelper)
-            {
-                delete mpB2DCubicBezierHelper;
-                mpB2DCubicBezierHelper = nullptr;
-            }
+            mpB2DCubicBezierHelper.reset();
         }
 
         basegfx::B2DCubicBezierHelper* pathTextBreakupHelper::getB2DCubicBezierHelper()
         {
             if(!mpB2DCubicBezierHelper && maCurrentSegment.isBezier())
             {
-                mpB2DCubicBezierHelper = new basegfx::B2DCubicBezierHelper(maCurrentSegment);
+                mpB2DCubicBezierHelper.reset(new basegfx::B2DCubicBezierHelper(maCurrentSegment));
             }
 
-            return mpB2DCubicBezierHelper;
+            return mpB2DCubicBezierHelper.get();
         }
 
         void pathTextBreakupHelper::advanceToPosition(double fNewPosition)
commit 9aff9f22adf20aa0c00663648d1875e325b24d42
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon May 21 15:48:23 2018 +0200

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

diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index 6e99796fc474..3f6df60719e8 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -61,9 +61,9 @@ namespace dbaui
 
         css::uno::Sequence< css::beans::PropertyValue >       m_aFieldInformation;
 
-        ::svxform::OSystemParseContext*         m_pParseContext;
+        std::unique_ptr<::svxform::OSystemParseContext>       m_pParseContext;
         ::connectivity::OSQLParser              m_aSqlParser;
-        ::connectivity::OSQLParseTreeIterator*  m_pSqlIterator;
+        std::unique_ptr<::connectivity::OSQLParseTreeIterator> m_pSqlIterator;
 
         css::uno::Reference< css::sdb::XSQLQueryComposer >    m_xComposer;
         /// if we're editing an existing view, this is non-NULL
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index f60e1a76f7b7..8f065adb3a43 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -239,8 +239,7 @@ OQueryController::OQueryController(const Reference< XComponentContext >& _rM)
     :OJoinController(_rM)
     ,OQueryController_PBase( getBroadcastHelper() )
     ,m_pParseContext( new svxform::OSystemParseContext )
-    ,m_aSqlParser( _rM, m_pParseContext )
-    ,m_pSqlIterator(nullptr)
+    ,m_aSqlParser( _rM, m_pParseContext.get() )
     ,m_nLimit(-1)
     ,m_nVisibleRows(0x400)
     ,m_nSplitPos(-1)
@@ -343,8 +342,7 @@ void OQueryController::deleteIterator()
     {
         delete m_pSqlIterator->getParseTree();
         m_pSqlIterator->dispose();
-        delete m_pSqlIterator;
-        m_pSqlIterator = nullptr;
+        m_pSqlIterator.reset();
     }
 }
 
@@ -354,7 +352,7 @@ void OQueryController::disposing()
 
     deleteIterator();
 
-    delete m_pParseContext;
+    m_pParseContext.reset();
 
     clearFields();
     OTableFields().swap(m_vUnUsedFieldsDesc);
@@ -942,7 +940,7 @@ void OQueryController::setQueryComposer()
             OSL_ENSURE(m_xComposer.is(),"No querycomposer available!");
             Reference<XTablesSupplier> xTablesSup(getConnection(), UNO_QUERY);
             deleteIterator();
-            m_pSqlIterator = new ::connectivity::OSQLParseTreeIterator( getConnection(), xTablesSup->getTables(), m_aSqlParser );
+            m_pSqlIterator.reset(new ::connectivity::OSQLParseTreeIterator( getConnection(), xTablesSup->getTables(), m_aSqlParser ));
         }
     }
 }


More information about the Libreoffice-commits mailing list