chiark / gitweb /
Fix an int->pointer cast warning in windows.c.
authorSimon Tatham <anakin@pobox.com>
Sun, 1 Oct 2017 13:50:58 +0000 (14:50 +0100)
committerSimon Tatham <anakin@pobox.com>
Sun, 1 Oct 2017 14:18:14 +0000 (15:18 +0100)
If I increase clang-cl's warning pickiness, it starts objecting to my
cast to HMENU from a (potentially, in 64 bits) smaller integer type.

Actually I don't think there's a problem there - all the integer ids I
cast to HMENU are nice small numbers and a widening cast is just fine.
But I can suppress the warning by using INT_PTR instead of int in the
prototype for mkctrl, so it's easiest just to do that.

windows.c

index ffd0f75894611260a7abdcf86e8c670334cb73a0..df1db4fd211b3158a81903080b7de6b0c313c44c 100644 (file)
--- a/windows.c
+++ b/windows.c
@@ -2140,7 +2140,7 @@ static char *frontend_set_config(frontend *fe, int which, config_item *cfg)
 /* Control coordinates should be specified in dialog units. */
 HWND mkctrl(frontend *fe, int x1, int x2, int y1, int y2,
            LPCTSTR wclass, int wstyle,
-           int exstyle, const char *wtext, int wid)
+           int exstyle, const char *wtext, INT_PTR wid)
 {
     RECT rc;
     TCHAR wwtext[256];
@@ -2349,7 +2349,7 @@ static int CALLBACK ConfigDlgProc(HWND hwnd, UINT msg,
 #ifndef _WIN32_WCE
 HWND mkctrl(frontend *fe, int x1, int x2, int y1, int y2,
            char *wclass, int wstyle,
-           int exstyle, const char *wtext, int wid)
+           int exstyle, const char *wtext, INT_PTR wid)
 {
     HWND ret;
     ret = CreateWindowEx(exstyle, wclass, wtext,