[Libreoffice-commits] core.git: vcl/source
Stephan Bergmann
sbergman at redhat.com
Wed Jan 24 12:17:10 UTC 2018
vcl/source/gdi/impvect.cxx | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
New commits:
commit 797ae3d3431ac497d71676f6124010777377e794
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 23 12:21:29 2018 +0100
Make ImplColorSet default ctor zero-initialize all members
...allowing to simplify creating the pColorSet array (which might want to be
improved even further, turning it into a unique_ptr or vector)
Change-Id: Ic05bd987057a0844885ccfc6ca52700770a27282
Reviewed-on: https://gerrit.libreoffice.org/48401
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index 841f1895a970..b94886a841b1 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -95,8 +95,8 @@ static const ChainMove aImplMoveOuter[ 8 ] = {
struct ImplColorSet
{
BitmapColor maColor;
- sal_uInt16 mnIndex;
- bool mbSet;
+ sal_uInt16 mnIndex = 0;
+ bool mbSet = false;
};
extern "C" int ImplColorSetCmpFnc( const void* p1, const void* p2 )
@@ -644,9 +644,8 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
const long nHeight = pRAcc->Height();
const sal_uInt16 nColorCount = pRAcc->GetPaletteEntryCount();
sal_uInt16 n;
- ImplColorSet* pColorSet = reinterpret_cast<ImplColorSet*>(new sal_uInt8[ 256 * sizeof( ImplColorSet ) ]);
+ ImplColorSet* pColorSet = new ImplColorSet[ 256 ];
- memset( pColorSet, 0, 256 * sizeof( ImplColorSet ) );
rMtf.Clear();
// get used palette colors and sort them from light to dark colors
@@ -703,7 +702,7 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) );
}
- delete[] reinterpret_cast<sal_uInt8*>(pColorSet);
+ delete[] pColorSet;
if( rMtf.GetActionSize() )
{
More information about the Libreoffice-commits
mailing list