From de694ba260e1b48ca06ea88c03f8f5f97ac4990e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 23 Jan 2018 11:59:41 +0100 Subject: Point default ctor already zero-initializes the members Change-Id: I9cb59c77a420c975933070eea691cda52b066b0b Reviewed-on: https://gerrit.libreoffice.org/48397 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- tools/source/generic/poly.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index ce1156bac990..3c78b5a04bc8 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -496,7 +496,6 @@ void ImplPolygon::ImplInitSize(sal_uInt16 nInitSize, bool bFlags) if (nInitSize) { mxPointAry.reset(new Point[nInitSize]); - memset(mxPointAry.get(), 0, nInitSize * sizeof(Point)); } if (bFlags) @@ -525,9 +524,8 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) // Copy the old points if ( mnPoints < nNewSize ) { - // New points initialized to zero + // New points are already implicitly initialized to zero const std::size_t nOldSz(mnPoints * sizeof(Point)); - memset(xNewAry.get() + mnPoints, 0, nNewSz - nOldSz); if (mxPointAry) memcpy(xNewAry.get(), mxPointAry.get(), nOldSz); } @@ -606,8 +604,6 @@ bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon con if( pInitPoly ) memcpy(xNewAry.get() + nPos, pInitPoly->mxPointAry.get(), nSpaceSize); - else - memset(xNewAry.get() + nPos, 0, nSpaceSize); memcpy(xNewAry.get() + nSecPos, mxPointAry.get() + nPos, nRest * sizeof(Point)); mxPointAry = std::move(xNewAry); -- cgit