[Libreoffice-commits] core.git: tools/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 23 20:53:29 UTC 2018


 tools/source/generic/poly.cxx |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit de694ba260e1b48ca06ea88c03f8f5f97ac4990e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 23 11:59:41 2018 +0100

    Point default ctor already zero-initializes the members
    
    Change-Id: I9cb59c77a420c975933070eea691cda52b066b0b
    Reviewed-on: https://gerrit.libreoffice.org/48397
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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);


More information about the Libreoffice-commits mailing list