From 26a080b5ada55fd8453ee6a497c5a2c37a6ce41c Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 21 Jan 2014 15:01:46 +1100 Subject: Avoid memset for safety. --- win32/PlatWin.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 548d620d3..ead2d679b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -272,7 +272,7 @@ static D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(int extraFontFlag) { #endif static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) { - memset(&lf, 0, sizeof(lf)); + lf = LOGFONTA(); // The negative is to allow for leading lf.lfHeight = -(abs(static_cast(size + 0.5))); lf.lfWeight = weight; @@ -1013,7 +1013,7 @@ void SurfaceGDI::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION * } } else if (IsNT() || (codePage==0) || win9xACPSame) { // Zero positions to avoid random behaviour on failure. - memset(positions, 0, len * sizeof(*positions)); + std::fill(positions, positions + len, 0.0f); // len may be larger than platform supports so loop over segments small enough for platform int startOffset = 0; while (len > 0) { -- cgit v1.2.3