From b97c84b1d94c8361ee40ef1c7d9c90526729f914 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 30 May 2020 20:54:07 +0200 Subject: [PATCH] Don't clear complex objects using memset() This is fine for simple structs but not class based objects. --- win/rfb_win32/DIBSectionBuffer.cxx | 2 -- win/rfb_win32/MonitorInfo.cxx | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/win/rfb_win32/DIBSectionBuffer.cxx b/win/rfb_win32/DIBSectionBuffer.cxx index 57bef2dc..424a5787 100644 --- a/win/rfb_win32/DIBSectionBuffer.cxx +++ b/win/rfb_win32/DIBSectionBuffer.cxx @@ -30,12 +30,10 @@ static LogWriter vlog("DIBSectionBuffer"); DIBSectionBuffer::DIBSectionBuffer(HWND window_) : bitmap(0), window(window_), device(0) { - memset(&format, 0, sizeof(format)); } DIBSectionBuffer::DIBSectionBuffer(HDC device_) : bitmap(0), window(0), device(device_) { - memset(&format, 0, sizeof(format)); } DIBSectionBuffer::~DIBSectionBuffer() { diff --git a/win/rfb_win32/MonitorInfo.cxx b/win/rfb_win32/MonitorInfo.cxx index 551017bd..0a949abb 100644 --- a/win/rfb_win32/MonitorInfo.cxx +++ b/win/rfb_win32/MonitorInfo.cxx @@ -36,7 +36,7 @@ using namespace win32; static LogWriter vlog("MonitorInfo"); -static void fillMonitorInfo(HMONITOR monitor, MonitorInfo* mi) { +static void fillMonitorInfo(HMONITOR monitor, MONITORINFOEXA* mi) { vlog.debug("monitor=%p", monitor); memset(mi, 0, sizeof(MONITORINFOEXA)); mi->cbSize = sizeof(MONITORINFOEXA); @@ -70,7 +70,7 @@ MonitorInfo::MonitorInfo(const RECT& r) { struct monitorByNameData { - MonitorInfo* info; + MONITORINFOEXA* info; const char* monitorName; }; -- 2.39.5