summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/window
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-31 15:40:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-12 08:43:48 +0200
commite4e4d5713e248f02faf7aa6199b11e152973de8e (patch)
tree836dffa89d0a966e41b1af8270db74b9590def22 /vcl/unx/generic/window
parentd4eabd5da8ea3b5ac40659c22cde19b26b3c002b (diff)
clang-tidy readability-delete-null-pointer
which in turn triggered some loplugin:useuniqueptr Change-Id: I0c38561fc9b68dac44e8cf58c8aa1f582196cc64 Reviewed-on: https://gerrit.libreoffice.org/38281 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/generic/window')
-rw-r--r--vcl/unx/generic/window/salframe.cxx3
-rw-r--r--vcl/unx/generic/window/salobj.cxx17
2 files changed, 7 insertions, 13 deletions
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 1744dc6e06bc..1ea8598c55f5 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -4136,8 +4136,7 @@ void X11SalFrame::ResetClipRegion()
void X11SalFrame::BeginSetClipRegion( sal_uLong nRects )
{
- if( m_pClipRectangles )
- delete [] m_pClipRectangles;
+ delete [] m_pClipRectangles;
if( nRects )
m_pClipRectangles = new XRectangle[nRects];
else
diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx
index 186af85cbe49..e3ec1b467290 100644
--- a/vcl/unx/generic/window/salobj.cxx
+++ b/vcl/unx/generic/window/salobj.cxx
@@ -187,17 +187,12 @@ SalClipRegion::SalClipRegion()
SalClipRegion::~SalClipRegion()
{
- if ( ClipRectangleList )
- delete [] ClipRectangleList;
}
void
SalClipRegion::BeginSetClipRegion( sal_uLong nRects )
{
- if (ClipRectangleList)
- delete [] ClipRectangleList;
-
- ClipRectangleList = new XRectangle[nRects];
+ ClipRectangleList.reset( new XRectangle[nRects] );
numClipRectangles = 0;
maxClipRectangles = nRects;
}
@@ -207,12 +202,12 @@ SalClipRegion::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
{
if ( nWidth && nHeight && (numClipRectangles < maxClipRectangles) )
{
- XRectangle *aRect = ClipRectangleList + numClipRectangles;
+ XRectangle& aRect = ClipRectangleList[numClipRectangles];
- aRect->x = (short) nX;
- aRect->y = (short) nY;
- aRect->width = (unsigned short) nWidth;
- aRect->height= (unsigned short) nHeight;
+ aRect.x = (short) nX;
+ aRect.y = (short) nY;
+ aRect.width = (unsigned short) nWidth;
+ aRect.height= (unsigned short) nHeight;
numClipRectangles++;
}