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

Caolán McNamara caolanm at redhat.com
Sun Apr 9 16:34:54 UTC 2017


 vcl/source/filter/wmf/enhwmf.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 7cd4b5912363de89c6ded921b6b5940493afc1cf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 8 21:56:50 2017 +0100

    std::unique[]->std::vector
    
    Change-Id: If1b66f273e412f2206274a903a06bee90a2a6c91
    Reviewed-on: https://gerrit.libreoffice.org/36307
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index de15d4e6ed7c..02776fa83997 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -603,12 +603,12 @@ void EnhWMFReader::ReadAndDrawPolyPolygon()
         return;
 
     // Get number of points in each polygon
-    std::unique_ptr<sal_uInt16[]> pnPoints(new sal_uInt16[ nPoly ]);
+    std::vector<sal_uInt16> aPoints(nPoly);
     for (sal_uInt32 i = 0; i < nPoly && pWMF->good(); ++i)
     {
         sal_uInt32 nPoints(0);
         pWMF->ReadUInt32( nPoints );
-        pnPoints[ i ] = (sal_uInt16)nPoints;
+        aPoints[i] = (sal_uInt16)nPoints;
     }
     if ( pWMF->good() && ( nGesPoints * (sizeof(T)+sizeof(T)) ) <= ( nEndPos - pWMF->Tell() ) )
     {
@@ -616,20 +616,20 @@ void EnhWMFReader::ReadAndDrawPolyPolygon()
         tools::PolyPolygon aPolyPoly(nPoly, nPoly);
         for (sal_uInt32 i = 0; i < nPoly && pWMF->good(); ++i)
         {
-            const sal_uInt16 nPointCount(pnPoints[i]);
-            std::unique_ptr<Point[]> pPtAry(new Point[nPointCount]);
+            const sal_uInt16 nPointCount(aPoints[i]);
+            std::vector<Point> aPtAry(nPointCount);
             for (sal_uInt16 j = 0; j < nPointCount && pWMF->good(); ++j)
             {
                 T nX(0), nY(0);
                 *pWMF >> nX >> nY;
-                pPtAry[ j ] = Point( nX, nY );
+                aPtAry[j] = Point( nX, nY );
                 ++nReadPoints;
             }
 
-            aPolyPoly.Insert( tools::Polygon(nPointCount, pPtAry.get()) );
+            aPolyPoly.Insert(tools::Polygon(aPtAry.size(), aPtAry.data()));
         }
 
-        pOut->DrawPolyPolygon( aPolyPoly, bRecordPath );
+        pOut->DrawPolyPolygon(aPolyPoly, bRecordPath);
     }
 
     OSL_ENSURE(nReadPoints == nGesPoints, "The number Points processed from EMR_POLYPOLYGON is unequal imported number (!)");


More information about the Libreoffice-commits mailing list