hw/xwin: Fix -Wmaybe-uninitialized warning in winWindowProc

This is possibly an actual bug in failing to check we successfully retrieved
the monitor size before using it to set the X screen size.

../hw/xwin/winwndproc.c: In function ‘winWindowProc’:
../hw/xwin/winwndproc.c:283:55: warning: ‘dwHeight’ may be used uninitialized in this function [-Wmaybe-uninitialized]
../hw/xwin/winwndproc.c:240:32: note: ‘dwHeight’ was declared here
../hw/xwin/winwndproc.c:281:54: warning: ‘dwWidth’ may be used uninitialized in this function [-Wmaybe-uninitialized]
../hw/xwin/winwndproc.c:240:23: note: ‘dwWidth’ was declared here

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
This commit is contained in:
Jon Turney 2017-04-19 13:30:27 +01:00 committed by Adam Jackson
parent 7a90c9b24e
commit 319daa7a9f

View File

@ -237,7 +237,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
fMultiWindow
#endif
)) {
DWORD dwWidth, dwHeight;
DWORD dwWidth = 0, dwHeight = 0;
if (s_pScreenInfo->fMultipleMonitors) {
/* resize to new virtual desktop size */
@ -273,8 +273,9 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
*/
/* Set screen size to match new size, if it is different to current */
if ((s_pScreenInfo->dwWidth != dwWidth) ||
(s_pScreenInfo->dwHeight != dwHeight)) {
if (((dwWidth != 0) && (dwHeight != 0)) &&
((s_pScreenInfo->dwWidth != dwWidth) ||
(s_pScreenInfo->dwHeight != dwHeight))) {
winDoRandRScreenSetSize(s_pScreen,
dwWidth,
dwHeight,