https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ab8d7f254802f20aab4e1f...
commit ab8d7f254802f20aab4e1f85e5370b032e109e06 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Wed Apr 21 18:29:11 2021 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Wed May 5 17:24:11 2021 +0200
[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); ^~~~~~~ --- dll/cpl/sysdm/general.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dll/cpl/sysdm/general.c b/dll/cpl/sysdm/general.c index 746c8235b16..c23010e6e3f 100644 --- a/dll/cpl/sysdm/general.c +++ b/dll/cpl/sysdm/general.c @@ -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;