Kaydet (Commit) de694ba2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Point default ctor already zero-initializes the members

Change-Id: I9cb59c77a420c975933070eea691cda52b066b0b
Reviewed-on: https://gerrit.libreoffice.org/48397Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 6b75c472
...@@ -496,7 +496,6 @@ void ImplPolygon::ImplInitSize(sal_uInt16 nInitSize, bool bFlags) ...@@ -496,7 +496,6 @@ void ImplPolygon::ImplInitSize(sal_uInt16 nInitSize, bool bFlags)
if (nInitSize) if (nInitSize)
{ {
mxPointAry.reset(new Point[nInitSize]); mxPointAry.reset(new Point[nInitSize]);
memset(mxPointAry.get(), 0, nInitSize * sizeof(Point));
} }
if (bFlags) if (bFlags)
...@@ -525,9 +524,8 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) ...@@ -525,9 +524,8 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize )
// Copy the old points // Copy the old points
if ( mnPoints < nNewSize ) if ( mnPoints < nNewSize )
{ {
// New points initialized to zero // New points are already implicitly initialized to zero
const std::size_t nOldSz(mnPoints * sizeof(Point)); const std::size_t nOldSz(mnPoints * sizeof(Point));
memset(xNewAry.get() + mnPoints, 0, nNewSz - nOldSz);
if (mxPointAry) if (mxPointAry)
memcpy(xNewAry.get(), mxPointAry.get(), nOldSz); memcpy(xNewAry.get(), mxPointAry.get(), nOldSz);
} }
...@@ -606,8 +604,6 @@ bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon con ...@@ -606,8 +604,6 @@ bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon con
if( pInitPoly ) if( pInitPoly )
memcpy(xNewAry.get() + nPos, pInitPoly->mxPointAry.get(), nSpaceSize); 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)); memcpy(xNewAry.get() + nSecPos, mxPointAry.get() + nPos, nRest * sizeof(Point));
mxPointAry = std::move(xNewAry); mxPointAry = std::move(xNewAry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment