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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 26 07:57:21 UTC 2018


 chart2/source/view/charttypes/Splines.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 8913a08423e732f27ae7645cad9570aadb5aaf2b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 25 13:23:17 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 26 09:53:00 2018 +0200

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

diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index d0b2389c550f..248954a387f5 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -584,8 +584,8 @@ void SplineCalculater::CalculateCubicSplines(
 
         // generate a spline for each coordinate. It holds the complete
         // information to calculate each point of the curve
-        lcl_SplineCalculation* aSplineX;
-        lcl_SplineCalculation* aSplineY;
+        std::unique_ptr<lcl_SplineCalculation> aSplineX;
+        std::unique_ptr<lcl_SplineCalculation> aSplineY;
         // lcl_SplineCalculation* aSplineZ; the z-coordinates of all points in
         // a data series are equal. No spline calculation needed, but copy
         // coordinate to output
@@ -595,8 +595,8 @@ void SplineCalculater::CalculateCubicSplines(
             pOldZ[ 0 ] == pOldZ[nMaxIndexPoints] &&
             nMaxIndexPoints >=2 )
         {   // periodic spline
-            aSplineX = new lcl_SplineCalculation( aInputX) ;
-            aSplineY = new lcl_SplineCalculation( aInputY) ;
+            aSplineX.reset(new lcl_SplineCalculation( aInputX));
+            aSplineY.reset(new lcl_SplineCalculation( aInputY));
             // aSplineZ = new lcl_SplineCalculation( aInputZ) ;
         }
         else // generate the kind "natural spline"
@@ -605,8 +605,8 @@ void SplineCalculater::CalculateCubicSplines(
             ::rtl::math::setInf( &fInfty, false );
             double fXDerivation = fInfty;
             double fYDerivation = fInfty;
-            aSplineX = new lcl_SplineCalculation( aInputX, fXDerivation, fXDerivation );
-            aSplineY = new lcl_SplineCalculation( aInputY, fYDerivation, fYDerivation );
+            aSplineX.reset(new lcl_SplineCalculation( aInputX, fXDerivation, fXDerivation ));
+            aSplineY.reset(new lcl_SplineCalculation( aInputY, fYDerivation, fYDerivation ));
         }
 
         // fill result polygon with calculated values
@@ -645,9 +645,6 @@ void SplineCalculater::CalculateCubicSplines(
         pNewX[nNewPointIndex] = pOldX[nMaxIndexPoints];
         pNewY[nNewPointIndex] = pOldY[nMaxIndexPoints];
         pNewZ[nNewPointIndex] = pOldZ[nMaxIndexPoints];
-        delete aSplineX;
-        delete aSplineY;
-        // delete aSplineZ;
     }
 }
 


More information about the Libreoffice-commits mailing list