From 70c95cdeafc071ae2ec689a25e5cc2426aca3b30 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Tue, 10 Sep 2024 02:26:24 +0200 Subject: [PATCH] libgraphics: fix warnings - fix variable shadowing warnings - fix variable assignment in the condition expression warnings - fix my_error_mgr structure variables order to preserve space. Signed-off-by: Vitalii Koshura --- api/graphics2_win.cpp | 10 +++++----- api/gutil.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/graphics2_win.cpp b/api/graphics2_win.cpp index 63f29898e8..4cb1af4a3c 100644 --- a/api/graphics2_win.cpp +++ b/api/graphics2_win.cpp @@ -71,7 +71,7 @@ void boinc_close_window_and_quit(const char* p) { } } -void SetupPixelFormat(HDC win_dc) { +void SetupPixelFormat(HDC dc) { int nPixelFormat; char buf[256]; @@ -98,11 +98,11 @@ void SetupPixelFormat(HDC win_dc) { // chooses the best pixel format // - nPixelFormat = ChoosePixelFormat(win_dc, &pfd); + nPixelFormat = ChoosePixelFormat(dc, &pfd); // set pixel format to device context. // - if (!SetPixelFormat(win_dc, nPixelFormat, &pfd)) { + if (!SetPixelFormat(dc, nPixelFormat, &pfd)) { fprintf(stderr, "%s ERROR: Couldn't set pixel format for device context (0x%x).\n", boinc_msg_prefix(buf, sizeof(buf)), GetLastError() @@ -468,14 +468,14 @@ void boinc_set_windows_icon(const char* icon16, const char* icon48) { LONGLONG ic; HWND hWnd = FindWindow("BOINC_app",NULL); - if (ic = (LONGLONG)LoadIcon(instance, icon48)) { + if ((ic = (LONGLONG)LoadIcon(instance, icon48)) != 0) { #ifdef _WIN64 SetClassLongPtr(hWnd, GCLP_HICON, (LONG_PTR)ic); #else SetClassLongPtr(hWnd, GCLP_HICON, (LONG)ic); #endif } - if (ic = (LONGLONG)LoadImage(instance, icon16, IMAGE_ICON, 16, 16, 0)) { + if ((ic = (LONGLONG)LoadImage(instance, icon16, IMAGE_ICON, 16, 16, 0)) != 0) { #ifdef _WIN64 SetClassLongPtr(hWnd, GCLP_HICONSM, (LONG_PTR)ic); #else diff --git a/api/gutil.cpp b/api/gutil.cpp index 6cd12099a5..ad4a5d8e8a 100644 --- a/api/gutil.cpp +++ b/api/gutil.cpp @@ -626,8 +626,8 @@ void DecodeJPG(jpeg_decompress_struct* cinfo, tImageJPG *pImageData) { } struct my_error_mgr { - struct jpeg_error_mgr pub; jmp_buf setjmp_buffer; + struct jpeg_error_mgr pub; }; typedef struct my_error_mgr * my_error_ptr;