[SYSDM] Fix uninitialized variables warnings detected by Clang. (#3619)

CORE-17545

Addendum to commit d635ce0c.

dll/cpl/sysdm/general.c:156:25: warning: variable 'hCreditsDC' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                    if (hDC == NULL)
                        ^~~~~~~~~~~
dll/cpl/sysdm/general.c:216:25: note: uninitialized use occurs here
                    if (hCreditsDC != NULL) DeleteDC(hCreditsDC);
                        ^~~~~~~~~~

and the same for hLogoDC:

dll/cpl/sysdm/general.c:215:25: note: uninitialized use occurs here
                    if (hLogoDC != NULL) DeleteDC(hLogoDC);
                        ^~~~~~~
This commit is contained in:
Hermès Bélusca-Maïto 2021-04-21 18:29:11 +02:00
parent cba0d64645
commit ab8d7f2548
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -148,19 +148,21 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{
if (timerid == 0)
{
HDC hCreditsDC, hLogoDC;
HDC hDC = GetDC(NULL);
HDC hDC;
HDC hCreditsDC = NULL, hLogoDC = NULL;
HFONT hFont = NULL;
NONCLIENTMETRICS ncm;
RECT rcCredits;
TCHAR szCredits[2048];
INT iDevsHeight;
hDC = GetDC(NULL);
if (hDC == NULL)
goto Cleanup;
top = 0;
offset = 0;
hCreditsDC = CreateCompatibleDC(hDC);
hLogoDC = CreateCompatibleDC(hCreditsDC);
@ -183,7 +185,6 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
iDevsHeight = rcCredits.bottom - rcCredits.top;
hCreditsBitmap = CreateBitmap(pImgInfo->cxSource, (2 * pImgInfo->cySource) + iDevsHeight + 1, pImgInfo->iPlanes, pImgInfo->iBits, NULL);
if (!hCreditsBitmap)
goto Cleanup;