From af7cefd2725a4afb41700cb5568bd99710ebad5d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 27 Jan 2017 13:23:52 +0100 Subject: [PATCH] Widgets/qwidgetbackingstore.cpp: Fix developer build with MinGW In showYellowThing_win(), replace the switch by an array of COLORREF and simplify the code accordingly, fixing: kernel\qwidgetbackingstore.cpp: In function 'void showYellowThing_win(QWidget*, const QRegion&, int)': kernel\qwidgetbackingstore.cpp:188:39: error: 'brush' may be used uninitialized in this function [-Werror=maybe-uninitialized] FillRect(hdc, &winRect, brush); ^ Change-Id: Id60be0e01e1edb2fa939d64abaf2e58357bcc14d Reviewed-by: Maurice Kalinowski --- src/widgets/kernel/qwidgetbackingstore.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 910704498cf..781ad9600d7 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -164,23 +164,11 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec return; const HDC hdc = reinterpret_cast(hdcV); - HBRUSH brush; - static int i = 0; - switch (i) { - case 0: - brush = CreateSolidBrush(RGB(255, 255, 0)); - break; - case 1: - brush = CreateSolidBrush(RGB(255, 200, 55)); - break; - case 2: - brush = CreateSolidBrush(RGB(200, 255, 55)); - break; - case 3: - brush = CreateSolidBrush(RGB(200, 200, 0)); - break; - } - i = (i + 1) & 3; + static const COLORREF colors[] = {RGB(255, 255, 0), RGB(255, 200, 55), RGB(200, 255, 55), RGB(200, 200, 0)}; + + static size_t i = 0; + const HBRUSH brush = CreateSolidBrush(colors[i]); + i = (i + 1) % (sizeof(colors) / sizeof(colors[0])); for (const QRect &rect : region) { RECT winRect;