From 9219d5339bbabf2d698a0f6f057689fe44a9def1 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Thu, 3 Sep 2026 02:39:25 +0200 Subject: [PATCH] Intrusiveness minimizing changes to suppress warnings for build inside NuttX tree Signed-off-by: Pavel Pisa --- src/images/tools/convbmp.c | 13 +++++++------ src/include/mwconfig.nuttx | 2 ++ src/include/nano-X.h | 4 ++++ src/mwin/wingdi.c | 5 +++-- src/mwin/winlib/combobox.c | 2 +- src/mwin/winres.c | 11 ++++++----- src/mwin/winsbar.c | 6 +++--- src/mwin/winuser.c | 20 ++++++++++---------- src/nanox/client.c | 1 + src/nanox/serv.h | 4 ++++ 10 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/images/tools/convbmp.c b/src/images/tools/convbmp.c index 0b75e12b..021119b4 100644 --- a/src/images/tools/convbmp.c +++ b/src/images/tools/convbmp.c @@ -376,16 +376,16 @@ UCHAR *p = (UCHAR *)&l; for(i = cy-1; i>= 0; i--) { /* turn image rightside up*/ - unsigned char *p = imagebits + i*pitch; + unsigned char *p1 = imagebits + i*pitch; if(compression == BI_RLE8) { - if(!DecodeRLE8(p, fp)) + if(!DecodeRLE8(p1, fp)) break; } else if(compression == BI_RLE4) { - if(!DecodeRLE4(p, fp)) + if(!DecodeRLE4(p1, fp)) break; } else { - if(fread(p, 1, pitch, fp) != (size_t)pitch) { + if(fread(p1, 1, pitch, fp) != (size_t)pitch) { free(imagebits); fprintf(stderr, "Error fread\n"); return -1; @@ -401,9 +401,9 @@ UCHAR *p = (UCHAR *)&l; /* then output each line in order*/ for (i=0; istyle == BS_NULL) diff --git a/src/mwin/winlib/combobox.c b/src/mwin/winlib/combobox.c index bf50b125..27532328 100644 --- a/src/mwin/winlib/combobox.c +++ b/src/mwin/winlib/combobox.c @@ -347,7 +347,7 @@ DefComboboxProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) lp->bExtended = TRUE; lp->hFont = 0; lp->hWndParent = lpcs->hwndParent; - lp->nID = (UINT) lpcs->hMenu; //OK: Not pointer, control id always passed as UINT. + lp->nID = (UINT)(UINT_PTR) lpcs->hMenu; //OK: Not pointer, control id always passed as UINT. dwStyle = GetWindowLong(hWnd, GWL_STYLE); dwStyle &= ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME); diff --git a/src/mwin/winres.c b/src/mwin/winres.c index 6e967891..b9011afb 100644 --- a/src/mwin/winres.c +++ b/src/mwin/winres.c @@ -64,7 +64,8 @@ mwAddResource(HRSRC hRes) static int mwResCompare(LPCTSTR res1, LPCTSTR res2) { - if ((HIWORD(res1) == 0xFFFF) || (HIWORD(res2) == 0xFFFF)) // OK: Not pointer. Checks high word of resource DWORD. + // OK: Not pointer. Checks high word of resource DWORD. + if ((HIWORD((UINT_PTR)res1) == 0xFFFF) || (HIWORD((UINT_PTR)res2) == 0xFFFF)) return (res1 != res2); // FIXME: resource string names not handled properly here @@ -258,14 +259,14 @@ mwIsSameType(FILE * f, LPCTSTR id, BOOL * pEof) return !(*pEof); } // Resource may be specified in text or integer - if (HIWORD(id) == 0xFFFF) { + if (HIWORD((UINT_PTR)id) == 0xFFFF) { w = resReadWord(f, pEof); if (w != 0xFFFF) return FALSE; w = resReadWord(f, pEof); if (*pEof) return FALSE; - if (w == LOWORD((DWORD) id)) + if (w == LOWORD((UINT_PTR) id)) return TRUE; } else { LPCTSTR p = id; @@ -538,8 +539,8 @@ resDialogTemplate(BYTE *dest, LPCSTR caption, DWORD style, DWORD dwExtendedStyle dialog->cdit = (WORD)cdit; extra = (WORD *)(((BYTE *)dialog) + FIXSZ_MWDLGTEMPLATE); - *extra++ = (WORD)menu; // OK: No string menus yet, menu id always passed as WORD. - *extra++ = (WORD)classname; // OK: No string classes yet, class id always passed as WORD. + *extra++ = (WORD)(UINT_PTR)menu; // OK: No string menus yet, menu id always passed as WORD. + *extra++ = (WORD)(UINT_PTR)classname; // OK: No string classes yet, class id always passed as WORD. if (caption) while (*caption) *extra++ = (WORD)*caption++; diff --git a/src/mwin/winsbar.c b/src/mwin/winsbar.c index 4d8135b5..727a662a 100644 --- a/src/mwin/winsbar.c +++ b/src/mwin/winsbar.c @@ -797,14 +797,14 @@ ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow) { RECT rcWin, rcClient; - + memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT)); rcClient.left = 0; rcClient.top = 0; rcClient.right = pWin->clirect.right - pWin->clirect.left; rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top; - - /* fix: no WM_SIZECHANGED */ + (void)rcClient; + /* fix: no WM_SIZECHANGED */ //SendMessage(hWnd, WM_SIZECHANGED, (WPARAM)&rcWin, (LPARAM)&rcClient); } diff --git a/src/mwin/winuser.c b/src/mwin/winuser.c index 1bd7a334..ecdda68c 100644 --- a/src/mwin/winuser.c +++ b/src/mwin/winuser.c @@ -489,7 +489,7 @@ CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, wp->cursor = pwp->cursor; wp->cursor->usecount++; wp->unmapcount = pwp->unmapcount + 1; - wp->id = (int)hMenu; // OK: Not pointer. Menu id always passed as int. + wp->id = (int)(UINT_PTR)hMenu; // OK: Not pointer. Menu id always passed as int. wp->gotPaintMsg = PAINT_PAINTED; titLen = 0; @@ -1300,8 +1300,8 @@ GetClassLong(HWND hwnd, int nIndex) case GCL_CBWNDEXTRA: return (DWORD)hwnd->pClass->cbWndExtra; case GCL_HBRBACKGROUND: - assert(sizeof(LONG_PTR) <= 32); // 64bit must use GetClassLongPtr - return (DWORD)hwnd->pClass->hbrBackground; // OK: Pointer size checked above and is 32 bit. + assert(sizeof(LONG_PTR) <= sizeof(DWORD)); // 64bit must use GetClassLongPtr + return (DWORD)(LONG_PTR)hwnd->pClass->hbrBackground; // OK: Pointer size checked above and is 32 bit. case GCL_HCURSOR: case GCL_HICON: case GCL_HMODULE: @@ -1391,7 +1391,7 @@ SetWindowLongPtr(HWND hwnd, int nIndex, LONG_PTR lNewLong) hwnd->lpfnWndProc = (WNDPROC)lNewLong; break; case GWL_WNDPROCBRIDGE: - hwnd->lpfnWndProcBridge = (WNDPROC)lNewLong; + hwnd->lpfnWndProcBridge = (WNDPROC)(UINT_PTR)lNewLong; break; case GWL_HINSTANCE: hwnd->hInstance = (HINSTANCE)lNewLong; @@ -1514,7 +1514,7 @@ SetProp(HWND hWnd, LPCSTR lpString, HANDLE hData) return FALSE; /* check if 16 bit atom passed instead of pointer*/ if (PTR_IS_ATOM(lpString)) - pProp->Atom = LOWORD((DWORD)lpString); // OK: Not pointer. Atom passed in low 16 bits. + pProp->Atom = LOWORD((DWORD)(UINT_PTR)lpString); // OK: Not pointer. Atom passed in low 16 bits. else pProp->Atom = GlobalAddAtom(lpString); pProp->hData = hData; @@ -1532,7 +1532,7 @@ GetProp(HWND hWnd, LPCSTR lpString) /* check if 16 bit atom passed instead of pointer*/ if (PTR_IS_ATOM(lpString)) - Atom = LOWORD((DWORD)lpString); // OK: Not pointer. Atom passed in low 16 bits. + Atom = LOWORD((DWORD)(UINT_PTR)lpString); // OK: Not pointer. Atom passed in low 16 bits. else Atom = GlobalFindAtom(lpString); @@ -1554,7 +1554,7 @@ RemoveProp(HWND hWnd, LPCSTR lpString) /* check if 16 bit atom passed instead of pointer*/ if (PTR_IS_ATOM(lpString)) - Atom = LOWORD((DWORD)lpString); // OK: Not pointer. Atom passed in low 16 bits. + Atom = LOWORD((DWORD)(UINT_PTR)lpString); // OK: Not pointer. Atom passed in low 16 bits. else Atom = GlobalFindAtom(lpString); @@ -1656,11 +1656,11 @@ SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT hidden = hwnd->unmapcount || (fuFlags & SWP_NOREDRAW); if(bZorder) { - switch((int)hwndInsertAfter) { // OK: intentional HWND to int cast - case (int)(HWND)HWND_TOP: // OK: intentional HWND to int cast + switch((int)(UINT_PTR)hwndInsertAfter) { // OK: intentional HWND to int cast + case (int)(UINT_PTR)(HWND)HWND_TOP: // OK: intentional HWND to int cast MwRaiseWindow(hwnd); break; - case (int)(HWND)HWND_BOTTOM: // OK: intentional HWND to int cast + case (int)(UINT_PTR)(HWND)HWND_BOTTOM: // OK: intentional HWND to int cast MwLowerWindow(hwnd); break; default: diff --git a/src/nanox/client.c b/src/nanox/client.c index 03ea9382..de5d02a7 100644 --- a/src/nanox/client.c +++ b/src/nanox/client.c @@ -4498,6 +4498,7 @@ GrQueryPointer(GR_WINDOW_ID *mwin, GR_COORD *x, GR_COORD *y, GR_BUTTON *bmask) LOCK(&nxGlobalLock); req = AllocReq(QueryPointer); + (void)req; TypedReadBlock(mwin, sizeof(*mwin), GrNumQueryPointer); ReadBlock(x, sizeof(*x)); ReadBlock(y, sizeof(*y)); diff --git a/src/nanox/serv.h b/src/nanox/serv.h index 260b87d7..4a9efee5 100644 --- a/src/nanox/serv.h +++ b/src/nanox/serv.h @@ -33,6 +33,7 @@ #define GrCloseWindow SVR_GrCloseWindow #define GrCopyArea SVR_GrCopyArea #define GrCopyGC SVR_GrCopyGC +#undef GrCreateFont #define GrCreateFont SVR_GrCreateFont #define GrCreateFontEx SVR_GrCreateFontEx #define GrCreateTimer SVR_GrCreateTimer @@ -47,6 +48,7 @@ #define GrDrawImageFromBuffer SVR_GrDrawImageFromBuffer #define GrDrawImageFromFile SVR_GrDrawImageFromFile #define GrDrawImagePartToFit SVR_GrDrawImagePartToFit +#undef GrDrawImageToFit #define GrDrawImageToFit SVR_GrDrawImageToFit #define GrEllipse SVR_GrEllipse #define GrEmptyRegion SVR_GrEmptyRegion @@ -86,6 +88,7 @@ #define GrNewCursor SVR_GrNewCursor #define GrNewGC SVR_GrNewGC #define GrNewInputWindow SVR_GrNewInputWindow +#undef GrNewPixmap #define GrNewPixmap SVR_GrNewPixmap #define GrNewPixmapEx SVR_GrNewPixmapEx #define GrNewPolygonRegion SVR_GrNewPolygonRegion @@ -114,6 +117,7 @@ #define GrSetFocus SVR_GrSetFocus #define GrSetFontAttr SVR_GrSetFontAttr #define GrSetFontRotation SVR_GrSetFontRotation +#undef GrSetFontSize #define GrSetFontSize SVR_GrSetFontSize #define GrSetFontSizeEx SVR_GrSetFontSizeEx #define GrSetGCBackground SVR_GrSetGCBackground