]> granicus.if.org Git - nethack/commitdiff
win32_gui: gettting x64 build to work
authorAlex Kompel <barbos+nethack@gmail.com>
Tue, 14 Apr 2015 15:54:44 +0000 (08:54 -0700)
committerAlex Kompel <barbos+nethack@gmail.com>
Tue, 14 Apr 2015 15:54:44 +0000 (08:54 -0700)
13 files changed:
win/win32/mhaskyn.c
win/win32/mhdlg.c
win/win32/mhfont.c
win/win32/mhmain.c
win/win32/mhmap.c
win/win32/mhmenu.c
win/win32/mhmsgwnd.c
win/win32/mhrip.c
win/win32/mhsplash.c
win/win32/mhstatus.c
win/win32/mhtext.c
win/win32/mswproc.c
win/win32/winhack.c

index db682be2855b44e7b4efa0e12f741777da814dda..d3a9b3a6803c2ff63cbc54f403920018a639c4fa 100644 (file)
@@ -10,6 +10,9 @@
 
 int mswin_yes_no_dialog( const char *question, const char *choices, int def)
 {
+       UNREFERENCED_PARAMETER(question);
+       UNREFERENCED_PARAMETER(choices);
+       UNREFERENCED_PARAMETER(def);
        return '\032';
 }
 
index dc871aed73f4fdc47fafb9000f38caf84312c187..4eb5af1320185c902d0357cea2b9e8c76872f3b1 100644 (file)
@@ -19,7 +19,7 @@ struct getlin_data {
        size_t          result_size;
 };
 
-BOOL CALLBACK  GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK       GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
 
 int mswin_getlin_window (
        const char *question, 
@@ -27,7 +27,7 @@ int mswin_getlin_window (
        size_t result_size
 )
 {
-       int ret;
+       INT_PTR ret;
        struct getlin_data data;
 
        /* initilize dialog data */
@@ -46,10 +46,10 @@ int mswin_getlin_window (
        );
        if( ret==-1 ) panic("Cannot create getlin window");
        
-       return ret;
+       return (int)ret;
 }
     
-BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        struct getlin_data* data;
        RECT   main_rt, dlg_rt;
@@ -69,7 +69,7 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        case WM_INITDIALOG:
                data = (struct getlin_data*)lParam;
                SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf)));
-               SetWindowLong(hWnd, GWL_USERDATA, lParam);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 
                /* center dialog in the main window */
                GetWindowRect(hWnd, &dlg_rt);
@@ -143,7 +143,7 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
         { 
                        /* OK button was pressed */
                        case IDOK:
-                     data = (struct getlin_data*)GetWindowLong(hWnd, GWL_USERDATA);
+                     data = (struct getlin_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
                          SendDlgItemMessage(hWnd, IDC_GETLIN_EDIT, WM_GETTEXT, (WPARAM)sizeof(wbuf), (LPARAM)wbuf );
                          NH_W2A(wbuf, data->result, data->result_size);
 
@@ -167,11 +167,11 @@ struct extcmd_data {
        int*            selection;
 };
 
-BOOL CALLBACK  ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK       ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
 
 int mswin_ext_cmd_window (int* selection)
 {
-       int ret;
+       INT_PTR ret;
        struct extcmd_data data;
        
        /* init dialog data */
@@ -188,23 +188,22 @@ int mswin_ext_cmd_window (int* selection)
                        (LPARAM)&data
        );
        if( ret==-1 ) panic("Cannot create extcmd window");
-       return ret;
+       return (int)ret;
 }
     
-BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        struct extcmd_data* data;
        RECT   main_rt, dlg_rt;
        SIZE   dlg_sz;
        int    i;
-       const char *ptr;
        TCHAR wbuf[255];
 
        switch (message) 
        {
        case WM_INITDIALOG:
                data = (struct extcmd_data*)lParam;
-               SetWindowLong(hWnd, GWL_USERDATA, lParam);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 
                /* center dialog in the main window */
                GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
@@ -224,8 +223,8 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                                        TRUE );
 
                /* fill combobox with extended commands */
-               for(i=0; (ptr=extcmdlist[i].ef_txt); i++) {
-                       SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(ptr, wbuf, sizeof(wbuf)) );
+               for(i=0; extcmdlist[i].ef_txt; i++) {
+                       SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(extcmdlist[i].ef_txt, wbuf, sizeof(wbuf)) );
                }
 
                /* set focus to the list control */
@@ -236,12 +235,12 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        break;
 
        case WM_COMMAND:
-        data = (struct extcmd_data*)GetWindowLong(hWnd, GWL_USERDATA);
+        data = (struct extcmd_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
                switch (LOWORD(wParam)) 
         { 
                  /* OK button ws clicked */
           case IDOK:
-                         *data->selection = SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
+                         *data->selection = (int)SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
                          if( *data->selection==LB_ERR )
                                  *data->selection = -1;
                          /* Fall through. */
@@ -263,7 +262,7 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                                         lParam 
                                           Handle to the list box
                                        */
-                                  *data->selection = SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
+                                  *data->selection = (int)SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
                                   if( *data->selection==LB_ERR )
                                           *data->selection = -1;
                                   EndDialog(hWnd, IDOK); 
@@ -281,14 +280,14 @@ struct plsel_data {
        int*    selection;
 };
 
-BOOL CALLBACK  PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK       PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
 static void            plselInitDialog(HWND hWnd);
 static void                    plselAdjustLists(HWND hWnd, int changed_opt);
 static int                     plselFinalSelection(HWND hWnd, int* selection);
 
 int mswin_player_selection_window ( int* selection )
 {
-       int ret;
+       INT_PTR ret;
        struct plsel_data data;
 
        /* init dialog data */
@@ -305,10 +304,10 @@ int mswin_player_selection_window ( int* selection )
        );
        if( ret==-1 ) panic("Cannot create getlin window");
        
-       return ret;
+       return (int)ret;
 }
 
-BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        struct plsel_data* data;
        RECT   main_rt, dlg_rt;
@@ -318,7 +317,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
        {
        case WM_INITDIALOG:
                data = (struct plsel_data*)lParam;
-               SetWindowLong(hWnd, GWL_USERDATA, lParam);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 
                /* center dialog in the main window */
                GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
@@ -348,7 +347,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
        break;
 
        case WM_COMMAND:
-        data = (struct plsel_data*)GetWindowLong(hWnd, GWL_USERDATA);
+        data = (struct plsel_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
                switch (LOWORD(wParam)) { 
 
                /* OK button was clicked */
@@ -442,7 +441,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
 
 void setComboBoxValue(HWND hWnd, int combo_box, int value)
 {
-       int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
+       int index_max = (int)SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
        int index;
        int value_to_set = LB_ERR;
        for (index = 0; index < index_max; index++) {
@@ -531,7 +530,7 @@ void  plselAdjustLists(HWND hWnd, int changed_sel)
        HWND control_role, control_race, control_gender, control_align;
        int  initrole, initrace, initgend, initalign;
        int i;
-       int ind;
+       LRESULT ind;
        int valid_opt;
        TCHAR wbuf[255];
 
@@ -543,16 +542,16 @@ void  plselAdjustLists(HWND hWnd, int changed_sel)
 
        /* get current selections */    
        ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
-       initrole = (ind==LB_ERR)? flags.initrole : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
+       initrole = (ind==LB_ERR)? flags.initrole : (int)SendMessage(control_role, CB_GETITEMDATA, ind, 0);
 
        ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
-       initrace = (ind==LB_ERR)? flags.initrace : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
+       initrace = (ind==LB_ERR)? flags.initrace : (int)SendMessage(control_race, CB_GETITEMDATA, ind, 0);
 
        ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
-       initgend = (ind==LB_ERR)? flags.initgend : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
+       initgend = (ind==LB_ERR)? flags.initgend : (int)SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
 
        ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
-       initalign = (ind==LB_ERR)? flags.initalign : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
+       initalign = (ind==LB_ERR)? flags.initalign : (int)SendMessage(control_align, CB_GETITEMDATA, ind, 0);
 
        /* intialize roles list */
        if( changed_sel==-1 ) {
@@ -672,35 +671,37 @@ void  plselAdjustLists(HWND hWnd, int changed_sel)
 /* player made up his mind - get final selection here */ 
 int    plselFinalSelection(HWND hWnd, int* selection)
 {
-       int ind;
+       UNREFERENCED_PARAMETER(selection);
+
+       LRESULT ind;
 
        /* get current selections */
        if( SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
                flags.initrole = ROLE_RANDOM;
        } else {
                ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETCURSEL, 0, 0);
-               flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
+               flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
        }
 
        if( SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
                flags.initrace = ROLE_RANDOM;
        } else {
                ind = SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETCURSEL, 0, 0);
-               flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
+               flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
        }
 
        if( SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
                flags.initgend = ROLE_RANDOM;
        } else {
                ind = SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETCURSEL, 0, 0);
-               flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
+               flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
        }
 
        if( SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
                flags.initalign = ROLE_RANDOM;
        } else {
                ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETCURSEL, 0, 0);
-               flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
+               flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
        }
        
 
index cfbec944e73dbbce70850ae8584653a3f4398ada..7cebb921b1ebba8a7c9b6934c2b5ca1cfe8ba7dc 100644 (file)
@@ -25,7 +25,6 @@ static void __cdecl font_table_cleanup(void);
 void mswin_init_splashfonts(HWND hWnd)
 {
        HDC hdc = GetDC(hWnd);
-       HFONT fnt = NULL;
        LOGFONT lgfnt;
        ZeroMemory( &lgfnt, sizeof(lgfnt) );
        lgfnt.lfHeight          = -80;   // height of font
index 4373d58aa5d9c9d386c7df21cd20b8fa25ac32af..bf13b22da10f9ce008692eb067a197a4522083e4 100644 (file)
@@ -188,7 +188,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
                        if( !data ) panic("out of memory");
                        ZeroMemory(data, sizeof(NHMainWindow));
                        data->mapAcsiiModeSave = MAP_MODE_ASCII12x16;
-                       SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+                       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 
                        /* update menu items */
                        CheckMenuItem(
@@ -214,7 +214,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
 
         case WM_KEYDOWN: 
                {
-                       data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+                       data = (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
                        /* translate arrow keys into nethack commands */
             switch (wParam) 
@@ -525,8 +525,8 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
                           WM_QUIT somehow */  
 
                        /* clean up */
-                       free( (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA) );
-                       SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+                       free( (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA) );
+                       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
 
                        // PostQuitMessage(0);
                        exit(1); 
@@ -540,6 +540,10 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
 
 void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(hWnd);
+       UNREFERENCED_PARAMETER(wParam);
+       UNREFERENCED_PARAMETER(lParam);
+
        switch(wParam) {
 
        /* new window was just added */
@@ -585,7 +589,7 @@ void mswin_layout_main_window(HWND changed_child)
 
        if( GetNHApp()->bAutoLayout ) {
                GetClientRect(GetNHApp()->hMainWnd, &client_rt);
-               data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
+               data = (PNHMainWindow)GetWindowLongPtr(GetNHApp()->hMainWnd, GWLP_USERDATA);
 
                /* get sizes of child windows */
                wnd_status = mswin_hwnd_from_winid(WIN_STATUS);
@@ -752,10 +756,12 @@ void mswin_layout_main_window(HWND changed_child)
 
 LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(lParam);
+
        int wmId, wmEvent;
        PNHMainWindow  data;
 
-       data = (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        wmId    = LOWORD(wParam); 
        wmEvent = HIWORD(wParam); 
 
@@ -972,6 +978,8 @@ LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 // Mesage handler for about box.
 LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(lParam);
+
        char buf[BUFSZ];
        TCHAR wbuf[BUFSZ];
        RECT   main_rt, dlg_rt;
@@ -1040,7 +1048,7 @@ void mswin_select_map_mode(int mode)
        winid map_id;
 
        map_id = WIN_MAP;
-       data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
+       data = (PNHMainWindow)GetWindowLongPtr(GetNHApp()->hMainWnd, GWLP_USERDATA);
 
        /* override for Rogue level */
     if( Is_rogue_level(&u.uz) && !IS_MAP_ASCII(mode) ) return;
index 69c612c268a2a19a4af3bdcf426892117a93a0ab..c9073d03aa32c479a377e9ce88a682cf955c215a 100644 (file)
@@ -106,7 +106,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
        wnd_size.cy = client_rt.bottom - client_rt.top;
        
        /* set new screen tile size */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        data->xScrTile = 
                max(1, (data->bFitToScreenMode? wnd_size.cx : lpsz->cx) / COLNO);
        data->yScrTile = 
@@ -200,7 +200,7 @@ int mswin_map_mode(HWND hWnd, int mode)
        int oldMode;
        SIZE mapSize;
 
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        if( mode == data->mapMode ) return mode;
        
        oldMode = data->mapMode;
@@ -335,7 +335,7 @@ LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
 {
        PNHMapWindow data;
        
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_CREATE:
@@ -414,7 +414,7 @@ LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
        case WM_DESTROY:
                if( data->hMapFont ) DeleteObject(data->hMapFont);
                free(data);
-               SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
                break;
 
        default:
@@ -429,7 +429,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
        PNHMapWindow data;
        RECT rt;
 
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch(wParam) {
        case MSNH_MSG_PRINT_GLYPH: 
        {
@@ -559,6 +559,9 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 /* on WM_CREATE */
 void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(wParam);
+       UNREFERENCED_PARAMETER(lParam);
+
        PNHMapWindow data;
        int i,j;
 
@@ -577,7 +580,7 @@ void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
        data->xScrTile = GetNHApp()->mapTile_X;
        data->yScrTile = GetNHApp()->mapTile_Y;
 
-       SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 }
 
 /* on WM_PAINT */
@@ -592,7 +595,7 @@ void onPaint(HWND hWnd)
        int i, j;
 
        /* get window data */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        hDC = BeginPaint(hWnd, &ps);
 
@@ -742,13 +745,15 @@ void onPaint(HWND hWnd)
 /* on WM_VSCROLL */
 void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(lParam);
+
        PNHMapWindow data;
        SCROLLINFO si;
        int yNewPos;
        int yDelta;
  
        /* get window data */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
     switch(LOWORD (wParam)) 
     { 
@@ -800,13 +805,15 @@ void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
 /* on WM_HSCROLL */
 void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(lParam);
+
        PNHMapWindow data;
        SCROLLINFO si;
        int xNewPos;
        int xDelta;
  
        /* get window data */
-       data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        
     switch(LOWORD (wParam)) 
     { 
index c39b746563f21455a8dbb84d8aedba7bedc802d1..5665b09a60d41632a5210007662dc202bd892793 100644 (file)
@@ -75,7 +75,7 @@ static WNDPROC editControlWndProc = NULL;
 #define NHMENU_IS_SELECTED(item) ((item).count!=0)
 #define NHMENU_HAS_GLYPH(item)         ((item).glyph!=NO_GLYPH) 
 
-BOOL   CALLBACK        MenuWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR        CALLBACK        MenuWndProc(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK       NHMenuListWndProc(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK       NHMenuTextWndProc(HWND, UINT, WPARAM, LPARAM);
 static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
@@ -144,7 +144,7 @@ int mswin_menu_window_select_menu (HWND hWnd, int how, MENU_ITEM_P ** _selected,
        *_selected = NULL;
        ret_val = -1;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        /* force activate for certain menu types */
        if( data->type == MENU_TYPE_MENU &&
@@ -247,7 +247,7 @@ int mswin_menu_window_select_menu (HWND hWnd, int how, MENU_ITEM_P ** _selected,
        return ret_val;
 }
 /*-----------------------------------------------------------------------------*/   
-BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        PNHMenuWindow data;
        HWND control;
@@ -255,7 +255,7 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     TCHAR title[MAX_LOADSTRING];
 
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_INITDIALOG:
@@ -269,7 +269,7 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                data->bmpCheckedCount = LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL_COUNT));
                data->bmpNotChecked = LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
                data->is_active = FALSE;
-               SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 
                /* set font for the text cotrol */
                control = GetDlgItem(hWnd, IDC_MENU_TEXT);
@@ -278,8 +278,8 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                ReleaseDC(control, hdc);
 
                /* subclass edit control */
-               editControlWndProc = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
-               SetWindowLong(control, GWL_WNDPROC, (LONG)NHMenuTextWndProc);
+               editControlWndProc = (WNDPROC)GetWindowLongPtr(control, GWLP_WNDPROC);
+               SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)NHMenuTextWndProc);
 
         /* Even though the dialog has no caption, you can still set the title 
            which shows on Alt-Tab */
@@ -491,7 +491,7 @@ BOOL CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                                if( data->text.text ) free(data->text.text);
                        }
                        free(data);
-                       SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+                       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
                }
                return TRUE;
        }
@@ -502,7 +502,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        PNHMenuWindow data;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch( wParam ) {
        case MSNH_MSG_PUTSTR: 
        {
@@ -660,7 +660,7 @@ void LayoutMenu(HWND hWnd)
        POINT pt_elem, pt_ok, pt_cancel;
        SIZE  sz_elem, sz_ok, sz_cancel;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        menu_ok = GetDlgItem(hWnd, IDOK);
        menu_cancel = GetDlgItem(hWnd, IDCANCEL);
 
@@ -730,7 +730,7 @@ void SetMenuType(HWND hWnd, int type)
        PNHMenuWindow data;
        HWND list, text;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        data->type = type;
        
@@ -765,7 +765,7 @@ void SetMenuListType(HWND hWnd, int how)
        LVCOLUMN lvcol;
        LRESULT fnt;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        if( data->type != MENU_TYPE_MENU ) return;
 
        data->how = how;
@@ -808,8 +808,8 @@ void SetMenuListType(HWND hWnd, int how)
        if( !control ) panic( "cannot create menu control" );
        
        /* install the hook for the control window procedure */
-       wndProcListViewOrig = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
-       SetWindowLong(control, GWL_WNDPROC, (LONG)NHMenuListWndProc);
+       wndProcListViewOrig = (WNDPROC)GetWindowLongPtr(control, GWLP_WNDPROC);
+       SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)NHMenuListWndProc);
 
        /* set control colors */
        ListView_SetBkColor(control, 
@@ -842,7 +842,7 @@ void SetMenuListType(HWND hWnd, int how)
                lvitem.state = data->menu.items[i].presel? LVIS_SELECTED : 0;
                lvitem.pszText = NH_A2W(buf, wbuf, BUFSZ);
                lvitem.lParam = (LPARAM)&data->menu.items[i];
-               nItem = SendMessage(control, LB_ADDSTRING, (WPARAM)0, (LPARAM) buf); 
+               nItem = (int)SendMessage(control, LB_ADDSTRING, (WPARAM)0, (LPARAM) buf); 
                if( ListView_InsertItem(control, &lvitem)==-1 ) {
                        panic("cannot insert menu item");
                }
@@ -854,7 +854,7 @@ HWND GetMenuControl(HWND hWnd)
 {
        PNHMenuWindow data;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        if(data->type==MENU_TYPE_TEXT) {
                return GetDlgItem(hWnd, IDC_MENU_TEXT);
@@ -865,6 +865,8 @@ HWND GetMenuControl(HWND hWnd)
 /*-----------------------------------------------------------------------------*/
 BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+    UNREFERENCED_PARAMETER(wParam);
+
     LPMEASUREITEMSTRUCT lpmis; 
     TEXTMETRIC tm;
        HGDIOBJ saveFont;
@@ -874,7 +876,7 @@ BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
        int i;
 
     lpmis = (LPMEASUREITEMSTRUCT) lParam; 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        GetClientRect(GetMenuControl(hWnd), &list_rect);
 
        hdc = GetDC(GetMenuControl(hWnd));
@@ -900,6 +902,8 @@ BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
 /*-----------------------------------------------------------------------------*/
 BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(wParam);
+
        LPDRAWITEMSTRUCT lpdis;
        PNHMenuItem item;
        PNHMenuWindow data;
@@ -924,7 +928,7 @@ BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
     /* If there are no list box items, skip this message. */
     if (lpdis->itemID == -1) return FALSE;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
     item = &data->menu.items[lpdis->itemID];
 
@@ -1128,7 +1132,7 @@ BOOL onListChar(HWND hWnd, HWND hwndList, WORD ch)
        int curIndex, topIndex, pageSize;
        boolean is_accelerator = FALSE;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        switch( ch ) {
        case MENU_FIRST_PAGE:
@@ -1445,7 +1449,7 @@ void mswin_menu_window_size (HWND hWnd, LPSIZE sz)
        RECT rt, wrt;
        int extra_cx;
 
-       data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        if(data) {
                control = GetMenuControl(hWnd);
 
index a718db959bcdaa8721d1f6e07bbf280b8f49004f..6522be6c490af29c3c59398e2525be6c3ef8a571 100644 (file)
@@ -161,9 +161,9 @@ LRESULT CALLBACK NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
        case WM_DESTROY: 
        {
                PNHMessageWindow data;
-               data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+               data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
                free(data);
-               SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
        }       break;
 
     case WM_SIZE: 
@@ -174,7 +174,7 @@ LRESULT CALLBACK NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
                PNHMessageWindow data;
                RECT    rt;
        
-               data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+               data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
  
         xNewSize = LOWORD(lParam); 
         yNewSize = HIWORD(lParam); 
@@ -239,7 +239,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        PNHMessageWindow data;
        
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch( wParam ) {
        case MSNH_MSG_PUTSTR: 
        {
@@ -273,7 +273,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 
                                        /* get the input */
                                        while (!okkey) {
-                                       char c = mswin_nhgetch();
+                                       int c = mswin_nhgetch();
 
                                        switch (c)
                                        {
@@ -378,12 +378,14 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 
 void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(lParam);
+
        PNHMessageWindow data;
        SCROLLINFO si; 
        int yInc;
  
        /* get window data */
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        
        ZeroMemory(&si, sizeof(si));
        si.cbSize = sizeof(si);
@@ -460,7 +462,7 @@ void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
        int xInc;
  
        /* get window data */
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        
        ZeroMemory(&si, sizeof(si));
        si.cbSize = sizeof(si);
@@ -564,14 +566,13 @@ void onPaint(HWND hWnd)
        TCHAR wbuf[MAXWINDOWTEXT+2];
        size_t wlen;
        COLORREF OldBg, OldFg;
-    int do_more = 0;
 
        hdc = BeginPaint(hWnd, &ps);
 
        OldBg = SetBkColor(hdc, message_bg_brush ? message_bg_color : (COLORREF)GetSysColor(DEFAULT_COLOR_BG_MSG));
     OldFg = setMsgTextColor(hdc, 0);
 
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        GetClientRect(hWnd, &client_rt);
 
@@ -652,6 +653,9 @@ void onPaint(HWND hWnd)
 
 void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(wParam);
+       UNREFERENCED_PARAMETER(lParam);
+
        PNHMessageWindow data;
        SIZE    dummy;
 
@@ -660,7 +664,7 @@ void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
        if( !data ) panic("out of memory");
        ZeroMemory(data, sizeof(NHMessageWindow));
        data->max_text = MAXWINDOWTEXT;
-       SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
+       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
 
        /* re-calculate window size (+ font size) */
        mswin_message_window_size(hWnd, &dummy);
@@ -674,7 +678,7 @@ void mswin_message_window_size (HWND hWnd, LPSIZE sz)
        PNHMessageWindow data;
        RECT rt, client_rt;
 
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        if( !data ) return;
 
        /* -- Calculate the font size -- */
@@ -715,7 +719,7 @@ BOOL can_append_text(HWND hWnd, int attr, const char* text )
        RECT draw_rt;
        BOOL retval = FALSE;
 
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        /* cannot append if lines_not_seen is 0 (beginning of the new turn */
        if( data->lines_not_seen==0 ) return FALSE;
@@ -760,13 +764,11 @@ BOOL more_prompt_check(HWND hWnd)
        HDC hdc;
        HGDIOBJ saveFont;
        RECT client_rt, draw_rt;
-       BOOL retval = FALSE;
-       int visible_lines = 0;
        int i;
        int remaining_height;
        char tmptext[MAXWINDOWTEXT+1];
 
-       data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        if( data->lines_not_seen==0 ) return FALSE;  /* don't bother checking - nothig to "more" */
        if( data->lines_not_seen>=MSG_LINES ) return TRUE; /* history size exceeded - always more */
index 38dd0a52019b6d52f573c19f50d181845a2f0c30..990b3fed3881cb8d0dcc944501b5e6206d2b45a3 100644 (file)
@@ -28,7 +28,7 @@ typedef struct mswin_nethack_text_window {
        TCHAR*  rip_text;
 } NHRIPWindow, *PNHRIPWindow;
 
-BOOL CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
 static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 
 HWND mswin_init_RIP_window () {
@@ -47,7 +47,7 @@ HWND mswin_init_RIP_window () {
        if( !data ) panic("out of memory");
 
        ZeroMemory(data, sizeof(NHRIPWindow));
-       SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+       SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)data);
        return ret;
 }
 
@@ -63,7 +63,7 @@ void mswin_display_RIP_window (HWND hWnd)
        HDC hdc;
        HFONT OldFont;
 
-       data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHRIPWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
 
        GetNHApp()->hPopupWnd = hWnd;
        mapWnd = mswin_hwnd_from_winid(WIN_MAP);
@@ -118,12 +118,12 @@ void mswin_display_RIP_window (HWND hWnd)
        GetNHApp()->hPopupWnd = NULL;
 }
 
-BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        HDC hdc;
        PNHRIPWindow data;
 
-       data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHRIPWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch (message)
        {
        case WM_INITDIALOG:
@@ -218,7 +218,7 @@ BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
                        if( data->rip_text ) free(data->rip_text);
                        if (data->rip_bmp != NULL) DeleteObject(data->rip_bmp);
                        free(data);
-                       SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+                       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
                }
        break;
 
@@ -230,7 +230,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        PNHRIPWindow data;
        static int InRipText = 1;
-       data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHRIPWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch( wParam ) {
                case MSNH_MSG_PUTSTR: {
                        PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
index 76345dd64aef098e73b6b32782e893733dac96f0..9ad8f5e78f272fdd0cd17a8a6058d5d21058570b 100644 (file)
@@ -16,7 +16,7 @@
 
 PNHWinApp GetNHApp(void);
 
-BOOL CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
 
 #define SPLASH_WIDTH           440
 #define SPLASH_HEIGHT  322
@@ -177,8 +177,10 @@ void mswin_display_splash_window (BOOL show_ver)
        mswin_destroy_splashfonts();
 }
 
-BOOL CALLBACK NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
+       UNREFERENCED_PARAMETER(lParam);
+
        HDC hdc;
        switch (message)
        {
index 6cbf99e15100e55a5825a73ee5425026df85570b..05a4c57e8d16f37e9375bf4b7e0cd5bef3daf64c 100644 (file)
@@ -64,7 +64,7 @@ HWND mswin_init_status_window () {
        if( !data ) panic("out of memory");
 
        ZeroMemory(data, sizeof(NHStatusWindow));
-       SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+       SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)data);
        return ret;
 }
 
@@ -96,7 +96,7 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
        HDC hdc;
        PNHStatusWindow data;
        
-       data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHStatusWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_MSNH_COMMAND: {
@@ -174,7 +174,7 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
 
        case WM_DESTROY:
                free(data);
-               SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+               SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
                break;
 
        case WM_SETFOCUS:
@@ -198,7 +198,7 @@ void mswin_status_window_size (HWND hWnd, LPSIZE sz)
  
        GetClientRect(hWnd, &rt);
 
-       data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHStatusWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        if(data) {
                hdc = GetDC(hWnd);
                saveFont = SelectObject(hdc, mswin_get_font(NHW_STATUS, ATR_NONE, hdc, FALSE));
index 03b01132dd983a37a7c65686d761a82d4037a76b..ab4853834bee9e718cc81a98166dfd3e926cfafb 100644 (file)
@@ -19,7 +19,7 @@ static WNDPROC  editControlWndProc = 0;
 #define DEFAULT_COLOR_BG_TEXT  COLOR_WINDOW
 #define DEFAULT_COLOR_FG_TEXT  COLOR_WINDOWTEXT
 
-BOOL   CALLBACK        NHTextWndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR        CALLBACK        NHTextWndProc(HWND, UINT, WPARAM, LPARAM);
 LRESULT CALLBACK       NHEditHookWndProc(HWND, UINT, WPARAM, LPARAM);
 static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 static void LayoutText(HWND hwnd);
@@ -64,7 +64,7 @@ HWND mswin_init_text_window () {
        data = (PNHTextWindow)malloc(sizeof(NHTextWindow));
        if( !data ) panic("out of memory");
        ZeroMemory(data, sizeof(NHTextWindow));
-       SetWindowLong(ret, GWL_USERDATA, (LONG)data);
+       SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)data);
        return ret;
 }
 
@@ -72,7 +72,7 @@ void mswin_display_text_window (HWND hWnd)
 {
        PNHTextWindow data;
        
-       data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHTextWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        if( data && data->window_text ) {
                HWND control;
                control = GetDlgItem(hWnd, IDC_TEXT_CONTROL);
@@ -84,14 +84,14 @@ void mswin_display_text_window (HWND hWnd)
        mswin_popup_destroy(hWnd);
 }
     
-BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        HWND control;
        HDC hdc;
        PNHTextWindow data;
     TCHAR title[MAX_LOADSTRING];
        
-       data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHTextWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch (message) 
        {
        case WM_INITDIALOG:
@@ -106,8 +106,8 @@ BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                ReleaseDC(control, hdc);
 
                /* subclass edit control */
-               editControlWndProc = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
-               SetWindowLong(control, GWL_WNDPROC, (LONG)NHEditHookWndProc);
+               editControlWndProc = (WNDPROC)GetWindowLongPtr(control, GWLP_WNDPROC);
+               SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)NHEditHookWndProc);
 
                SetFocus(control);
 
@@ -180,7 +180,7 @@ BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
                if( data ) {
                        if( data->window_text ) free(data->window_text);
                        free(data);
-                       SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
+                       SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)0);
                }
        break;
 
@@ -192,7 +192,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
        PNHTextWindow data;
        
-       data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
+       data = (PNHTextWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA);
        switch( wParam ) {
        case MSNH_MSG_PUTSTR: {
                PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
index 16a2d9db726c7ee160dbc9830b871d52830d125e..998158a68b0db8bddb846834105bf6976b53a9ff 100644 (file)
@@ -157,6 +157,9 @@ init_nhwindows(int* argcp, char** argv)
 */
 void mswin_init_nhwindows(int* argc, char** argv)
 {
+       UNREFERENCED_PARAMETER(argc);
+       UNREFERENCED_PARAMETER(argv);
+
        logDebug("mswin_init_nhwindows()\n");
 
 #ifdef _DEBUG
@@ -985,7 +988,7 @@ void mswin_putstr_ex(winid wid, int attr, const char *text, int app)
                         ZeroMemory(&data, sizeof(data));
                         data.attr = attr;
                         data.text = text;
-                        data.append = app;
+                        data.append = !!app;
                         SendMessage( 
                                 GetNHApp()->windowlist[wid].win, 
                                 WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data );
@@ -1969,6 +1972,8 @@ char *mswin_getmsghistory(BOOLEAN_P init)
 
 void mswin_putmsghistory(const char * msg, BOOLEAN_P restoring)
 {
+       UNREFERENCED_PARAMETER(restoring);
+
        BOOL save_sound_opt;
 
        if (!msg) return;       /* end of message history restore */
index dd0f6c14a9f8bf5d24b061e5ada434a29cb0e9c5..c8498f08f298d2a5eebf29215334e9771dd1929f 100644 (file)
@@ -74,6 +74,10 @@ int APIENTRY WinMain(HINSTANCE hInstance,
                      LPSTR     lpCmdLine,
                      int       nCmdShow)
 {
+       UNREFERENCED_PARAMETER(hPrevInstance);
+       UNREFERENCED_PARAMETER(lpCmdLine);
+       UNREFERENCED_PARAMETER(nCmdShow);
+
        INITCOMMONCONTROLSEX InitCtrls;
        int argc;
        char* argv[MAX_CMDLINE_PARAM];