From 83746d7236e3109b1c5009262cf2b232583ffbba Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 2 Apr 2016 14:10:27 +0100 Subject: [PATCH] 64-bit cleanness: use INT_PTR/UINT_PTR where appropriate. These integer types are correct for the id/handle parameter to AppendMenu / InsertMenu / DeleteMenu, and also for the return type of dialog box procedures. --- windows/windlg.c | 20 ++++++++++---------- windows/window.c | 9 +++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/windows/windlg.c b/windows/windlg.c index 7da9441d..17327866 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -67,8 +67,8 @@ void force_normal(HWND hwnd) recurse = 0; } -static int CALLBACK LogProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK LogProc(HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam) { int i; @@ -162,8 +162,8 @@ static int CALLBACK LogProc(HWND hwnd, UINT msg, return 0; } -static int CALLBACK LicenceProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: @@ -189,8 +189,8 @@ static int CALLBACK LicenceProc(HWND hwnd, UINT msg, return 0; } -static int CALLBACK AboutProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam) { char *str; @@ -291,8 +291,8 @@ static void SaneEndDialog(HWND hwnd, int ret) /* * Null dialog procedure. */ -static int CALLBACK NullDlgProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK NullDlgProc(HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam) { return 0; } @@ -375,8 +375,8 @@ static void create_controls(HWND hwnd, char *path) * (Being a dialog procedure, in general it returns 0 if the default * dialog processing should be performed, and 1 if it should not.) */ -static int CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam) { HWND hw, treeview; struct treeview_faff tvfaff; diff --git a/windows/window.c b/windows/window.c index d8119e0d..b1530dbc 100644 --- a/windows/window.c +++ b/windows/window.c @@ -827,7 +827,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session..."); AppendMenu(m, MF_ENABLED, IDM_DUPSESS, "&Duplicate Session"); - AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) savedsess_menu, + AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT_PTR) savedsess_menu, "Sa&ved Sessions"); AppendMenu(m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings..."); AppendMenu(m, MF_SEPARATOR, 0, 0); @@ -1054,7 +1054,7 @@ void update_specials_menu(void *frontend) saved_menu = new_menu; /* XXX lame stacking */ new_menu = CreatePopupMenu(); AppendMenu(saved_menu, MF_POPUP | MF_ENABLED, - (UINT) new_menu, specials[i].name); + (UINT_PTR) new_menu, specials[i].name); break; case TS_EXITMENU: nesting--; @@ -1079,13 +1079,14 @@ void update_specials_menu(void *frontend) for (j = 0; j < lenof(popup_menus); j++) { if (specials_menu) { /* XXX does this free up all submenus? */ - DeleteMenu(popup_menus[j].menu, (UINT)specials_menu, MF_BYCOMMAND); + DeleteMenu(popup_menus[j].menu, (UINT_PTR)specials_menu, + MF_BYCOMMAND); DeleteMenu(popup_menus[j].menu, IDM_SPECIALSEP, MF_BYCOMMAND); } if (new_menu) { InsertMenu(popup_menus[j].menu, IDM_SHOWLOG, MF_BYCOMMAND | MF_POPUP | MF_ENABLED, - (UINT) new_menu, "S&pecial Command"); + (UINT_PTR) new_menu, "S&pecial Command"); InsertMenu(popup_menus[j].menu, IDM_SHOWLOG, MF_BYCOMMAND | MF_SEPARATOR, IDM_SPECIALSEP, 0); }