summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/salgdilayout.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-31 14:46:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 12:15:22 +0000
commit2489000d3fd66319a8355fd4e37cfdfda47296d0 (patch)
treecaad79e7b5bec3863604b20190b682c0d73d2b25 /vcl/source/gdi/salgdilayout.cxx
parent595848c85acc2609fcc48a40c7a9f216a2722cd8 (diff)
loplugin:useuniqueptr extend to check local vars
just the simple and obvious case for now, of a local var being allocated and deleted inside a single local block, and the delete happening at the end of the block Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625 Reviewed-on: https://gerrit.libreoffice.org/33749 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi/salgdilayout.cxx')
-rw-r--r--vcl/source/gdi/salgdilayout.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index f16d51357c05..6c607b0cfb23 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -419,7 +419,7 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints,
if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
// TODO: optimize, reduce new/delete calls
- SalPoint **pPtAry2 = new SalPoint*[nPoly];
+ std::unique_ptr<SalPoint*[]> pPtAry2( new SalPoint*[nPoly] );
sal_uLong i;
for(i=0; i<nPoly; i++)
{
@@ -428,11 +428,10 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints,
mirror( nPoints, pPtAry[i], pPtAry2[i], pOutDev );
}
- drawPolyPolygon( nPoly, pPoints, const_cast<PCONSTSALPOINT*>(pPtAry2) );
+ drawPolyPolygon( nPoly, pPoints, const_cast<PCONSTSALPOINT*>(pPtAry2.get()) );
for(i=0; i<nPoly; i++)
delete [] pPtAry2[i];
- delete [] pPtAry2;
}
else
drawPolyPolygon( nPoly, pPoints, pPtAry );
@@ -486,7 +485,7 @@ bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i
if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) )
{
// TODO: optimize, reduce new/delete calls
- SalPoint **pPtAry2 = new SalPoint*[i_nPoly];
+ std::unique_ptr<SalPoint*[]> pPtAry2( new SalPoint*[i_nPoly] );
sal_uLong i;
for(i=0; i<i_nPoly; i++)
{
@@ -495,11 +494,10 @@ bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i
mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_pOutDev );
}
- bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<PCONSTSALPOINT const *>(pPtAry2), i_pFlgAry );
+ bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, const_cast<PCONSTSALPOINT const *>(pPtAry2.get()), i_pFlgAry );
for(i=0; i<i_nPoly; i++)
delete [] pPtAry2[i];
- delete [] pPtAry2;
}
else
bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, i_pPtAry, i_pFlgAry );