summaryrefslogtreecommitdiff
path: root/svx/source/xoutdev
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 12:58:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 14:20:20 +0200
commit8f719de217b1079bd985b3bc63bbfa97069483bc (patch)
treecb15a422b7df468d913cb0815d628f7c0bc4fd9b /svx/source/xoutdev
parentbfc298d02ca6275588d5897d97ced9498a3e91aa (diff)
loplugin:flatten in svx
Change-Id: I31f33a5f693d5fdb8282181c5bd7f31971efe784 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100236 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/xoutdev')
-rw-r--r--svx/source/xoutdev/_xpoly.cxx68
1 files changed, 34 insertions, 34 deletions
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index abb536aedc82..f56c1b411248 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -113,31 +113,31 @@ void ImpXPolygon::Resize( sal_uInt16 nNewSize, bool bDeletePoints )
memset( pFlagAry.get(), 0, nSize );
// copy if needed
- if( nOldSize )
+ if( !nOldSize )
+ return;
+
+ if( nOldSize < nSize )
{
- if( nOldSize < nSize )
- {
- memcpy( pPointAry.get(), pOldPointAry, nOldSize*sizeof( Point ) );
- memcpy( pFlagAry.get(), pOldFlagAry, nOldSize );
- }
- else
- {
- memcpy( pPointAry.get(), pOldPointAry, nSize*sizeof( Point ) );
- memcpy( pFlagAry.get(), pOldFlagAry, nSize );
+ memcpy( pPointAry.get(), pOldPointAry, nOldSize*sizeof( Point ) );
+ memcpy( pFlagAry.get(), pOldFlagAry, nOldSize );
+ }
+ else
+ {
+ memcpy( pPointAry.get(), pOldPointAry, nSize*sizeof( Point ) );
+ memcpy( pFlagAry.get(), pOldFlagAry, nSize );
- // adjust number of valid points
- if( nPoints > nSize )
- nPoints = nSize;
- }
- if ( bDeletePoints )
- {
- delete[] pOldPointAry;
- pOldPointAry = nullptr;
- }
- else
- bDeleteOldPoints = true;
- delete[] pOldFlagAry;
+ // adjust number of valid points
+ if( nPoints > nSize )
+ nPoints = nSize;
}
+ if ( bDeletePoints )
+ {
+ delete[] pOldPointAry;
+ pOldPointAry = nullptr;
+ }
+ else
+ bDeleteOldPoints = true;
+ delete[] pOldFlagAry;
}
void ImpXPolygon::InsertSpace( sal_uInt16 nPos, sal_uInt16 nCount )
@@ -169,20 +169,20 @@ void ImpXPolygon::Remove( sal_uInt16 nPos, sal_uInt16 nCount )
{
CheckPointDelete();
- if( (nPos + nCount) <= nPoints )
- {
- sal_uInt16 nMove = nPoints - nPos - nCount;
+ if( (nPos + nCount) > nPoints )
+ return;
- if( nMove )
- {
- memmove( &pPointAry[nPos], &pPointAry[nPos+nCount],
- nMove * sizeof(Point) );
- memmove( &pFlagAry[nPos], &pFlagAry[nPos+nCount], nMove );
- }
- std::fill(pPointAry.get() + (nPoints - nCount), pPointAry.get() + nPoints, Point());
- memset( &pFlagAry [nPoints - nCount], 0, nCount );
- nPoints = nPoints - nCount;
+ sal_uInt16 nMove = nPoints - nPos - nCount;
+
+ if( nMove )
+ {
+ memmove( &pPointAry[nPos], &pPointAry[nPos+nCount],
+ nMove * sizeof(Point) );
+ memmove( &pFlagAry[nPos], &pFlagAry[nPos+nCount], nMove );
}
+ std::fill(pPointAry.get() + (nPoints - nCount), pPointAry.get() + nPoints, Point());
+ memset( &pFlagAry [nPoints - nCount], 0, nCount );
+ nPoints = nPoints - nCount;
}
void ImpXPolygon::CheckPointDelete() const