From c3f23963440613da7074d0338c25c72f02cbd45c Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin Date: Sat, 29 Aug 2026 21:53:21 +0200 Subject: [PATCH] Fix pointer type warnings and pointer truncation in WinUi.c - Cast `&t` to `LPCPROPSHEETPAGEW` in `CreatePropertySheetPageW` to fix incompatible pointer type error. - Use `SendMessageW` instead of custom `SendMsg` for `WM_GETFONT` to avoid truncating the `LRESULT` down to a 32-bit `UINT` before casting to `HFONT`, which previously triggered a `-Wint-to-pointer-cast` warning on 64-bit builds. - Cast `&srcData` and `&data` (type `UCHAR**`) to `void**` in `CreateDIBSection` calls to resolve incompatible pointer type errors. --- src/Cedar/WinUi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Cedar/WinUi.c b/src/Cedar/WinUi.c index 8b1de535..c266f90b 100644 --- a/src/Cedar/WinUi.c +++ b/src/Cedar/WinUi.c @@ -964,7 +964,7 @@ void *CreateWizardPageInstance(WIZARD *w, WIZARD_PAGE *p) t.lParam = (LPARAM)p->DialogParam; - return CreatePropertySheetPageW(&t); + return CreatePropertySheetPageW((LPCPROPSHEETPAGEW)&t); } // Create a new wizard @@ -2368,7 +2368,7 @@ void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, *need_resize = true; // Get the font of the current window - hDlgFont = (HFONT)SendMsg(hWnd, 0, WM_GETFONT, 0, 0); + hDlgFont = (HFONT)SendMessageW(hWnd, WM_GETFONT, 0, 0); // Get the width and height of the font of the current window CalcFontSize(hDlgFont, &dlgfont_x, &dlgfont_y); @@ -2677,7 +2677,7 @@ HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_ // Copy once the transfer source Zero(&bi, sizeof(bi)); Copy(&bi.bmiHeader, &h, sizeof(BITMAPINFOHEADER)); - srcHbitMap = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, &srcData, NULL, 0); + srcHbitMap = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, (void **)&srcData, NULL, 0); hOld = SelectObject(hMemDC, srcHbitMap); @@ -2695,7 +2695,7 @@ HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_ Zero(&bi, sizeof(bi)); Copy(&bi.bmiHeader, &h, sizeof(BITMAPINFOHEADER)); - ret = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, &data, NULL, 0); + ret = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, (void **)&data, NULL, 0); if(srcData != NULL && data != NULL) {