From b6007ac59dcb44fda5a24d4e694697d50e6cbb73 Mon Sep 17 00:00:00 2001 From: Dion Nicolaas Date: Sat, 2 May 2015 13:48:44 +0200 Subject: [PATCH] BCC is more strict about not statements before parameter declarations --- win/win32/mhdlg.c | 4 ++-- win/win32/mhmain.c | 8 ++++---- win/win32/mhmap.c | 14 +++++++------- win/win32/mhmenu.c | 8 ++++---- win/win32/mhmsgwnd.c | 10 +++++----- win/win32/mhsplash.c | 3 ++- win/win32/mswproc.c | 16 +++++++++++----- win/win32/winhack.c | 7 +++---- 8 files changed, 38 insertions(+), 32 deletions(-) diff --git a/win/win32/mhdlg.c b/win/win32/mhdlg.c index 4eb5af132..6ec6a70df 100644 --- a/win/win32/mhdlg.c +++ b/win/win32/mhdlg.c @@ -671,10 +671,10 @@ void plselAdjustLists(HWND hWnd, int changed_sel) /* player made up his mind - get final selection here */ int plselFinalSelection(HWND hWnd, int* selection) { - UNREFERENCED_PARAMETER(selection); - LRESULT ind; + UNREFERENCED_PARAMETER(selection); + /* get current selections */ if( SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) { flags.initrole = ROLE_RANDOM; diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c index 48662a03c..50a63df4c 100644 --- a/win/win32/mhmain.c +++ b/win/win32/mhmain.c @@ -757,11 +757,11 @@ void mswin_layout_main_window(HWND changed_child) LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { - UNREFERENCED_PARAMETER(lParam); - int wmId, wmEvent; PNHMainWindow data; + UNREFERENCED_PARAMETER(lParam); + data = (PNHMainWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA); wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); @@ -986,13 +986,13 @@ 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; SIZE dlg_sz; + UNREFERENCED_PARAMETER(lParam); + switch (message) { case WM_INITDIALOG: diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index c9073d03a..1f96e40d6 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -559,12 +559,12 @@ 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; + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(lParam); + /* set window data */ data = (PNHMapWindow)malloc(sizeof(NHMapWindow)); if( !data ) panic("out of memory"); @@ -745,13 +745,13 @@ 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; + UNREFERENCED_PARAMETER(lParam); + /* get window data */ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -805,13 +805,13 @@ 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; + UNREFERENCED_PARAMETER(lParam); + /* get window data */ data = (PNHMapWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA); diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index a23caa29f..b7d8aae70 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -857,8 +857,6 @@ HWND GetMenuControl(HWND hWnd) /*-----------------------------------------------------------------------------*/ BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - LPMEASUREITEMSTRUCT lpmis; TEXTMETRIC tm; HGDIOBJ saveFont; @@ -867,6 +865,8 @@ BOOL onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) RECT list_rect; int i; + UNREFERENCED_PARAMETER(wParam); + lpmis = (LPMEASUREITEMSTRUCT) lParam; data = (PNHMenuWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA); GetClientRect(GetMenuControl(hWnd), &list_rect); @@ -894,8 +894,6 @@ 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; @@ -915,6 +913,8 @@ BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) int color = NO_COLOR, attr; boolean menucolr = FALSE; + UNREFERENCED_PARAMETER(wParam); + lpdis = (LPDRAWITEMSTRUCT) lParam; /* If there are no list box items, skip this message. */ diff --git a/win/win32/mhmsgwnd.c b/win/win32/mhmsgwnd.c index 6522be6c4..2c009dada 100644 --- a/win/win32/mhmsgwnd.c +++ b/win/win32/mhmsgwnd.c @@ -378,12 +378,12 @@ 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; + UNREFERENCED_PARAMETER(lParam); + /* get window data */ data = (PNHMessageWindow)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -653,12 +653,12 @@ void onPaint(HWND hWnd) void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - PNHMessageWindow data; SIZE dummy; + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(lParam); + /* set window data */ data = (PNHMessageWindow)malloc(sizeof(NHMessageWindow)); if( !data ) panic("out of memory"); diff --git a/win/win32/mhsplash.c b/win/win32/mhsplash.c index 9ad8f5e78..f639386ed 100644 --- a/win/win32/mhsplash.c +++ b/win/win32/mhsplash.c @@ -179,9 +179,10 @@ void mswin_display_splash_window (BOOL show_ver) INT_PTR CALLBACK NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + HDC hdc; + UNREFERENCED_PARAMETER(lParam); - HDC hdc; switch (message) { case WM_INITDIALOG: diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 5cdd4bd5d..6da255b2f 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -692,6 +692,7 @@ void mswin_get_nh_event(void) MSG msg; logDebug("mswin_get_nh_event()\n"); + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)!=0 ) { if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable, &msg)) { TranslateMessage(&msg); @@ -707,6 +708,7 @@ void mswin_get_nh_event(void) void mswin_exit_nhwindows(const char *str) { logDebug("mswin_exit_nhwindows(%s)\n", str); + /* Write Window settings to the registry */ mswin_write_reg(); while (max_brush) @@ -717,6 +719,7 @@ void mswin_exit_nhwindows(const char *str) void mswin_suspend_nhwindows(const char *str) { logDebug("mswin_suspend_nhwindows(%s)\n", str); + return; } @@ -725,6 +728,7 @@ void mswin_suspend_nhwindows(const char *str) void mswin_resume_nhwindows() { logDebug("mswin_resume_nhwindows()\n"); + return; } @@ -1977,10 +1981,10 @@ char *mswin_getmsghistory(BOOLEAN_P init) void mswin_putmsghistory(const char * msg, BOOLEAN_P restoring) { - UNREFERENCED_PARAMETER(restoring); - BOOL save_sound_opt; + UNREFERENCED_PARAMETER(restoring); + if (!msg) return; /* end of message history restore */ save_sound_opt = GetNHApp()->bNoSounds; GetNHApp()->bNoSounds = TRUE; /* disable sounds while restoring message history */ @@ -2625,8 +2629,8 @@ status_init() -- core calls this to notify the window port that a status void mswin_status_init(void) { - logDebug("mswin_status_init()\n"); int i; + logDebug("mswin_status_init()\n"); for (i = 0; i < MAXBLSTATS; ++i) { _status_vals[i] = (char *)alloc(BUFSZ); *_status_vals[i] = '\0'; @@ -2652,10 +2656,11 @@ status_finish() -- called when it is time for the window port to tear down void mswin_status_finish(void) { - logDebug("mswin_status_finish()\n"); /* tear down routine */ int i; + logDebug("mswin_status_finish()\n"); + /* free alloc'd memory here */ for (i = 0; i < MAXBLSTATS; ++i) { if (_status_vals[i]) free((genericptr_t)_status_vals[i]); @@ -2772,7 +2777,6 @@ status_update(int fldindex, genericptr_t ptr, int chg, int percentage) void mswin_status_update(int idx, genericptr_t ptr, int chg, int percent) { - logDebug("mswin_status_update(%d, %p, %d, %d)\n", idx, ptr, chg, percent); long cond, *condptr = (long *)ptr; char *text = (char *)ptr; MSNHMsgUpdateStatus update_cmd_data; @@ -2780,6 +2784,8 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent) unsigned ospecial; long value = -1; + logDebug("mswin_status_update(%d, %p, %d, %d)\n", idx, ptr, chg, percent); + if (idx != BL_FLUSH) { if (!_status_activefields[idx]) return; switch(idx) { diff --git a/win/win32/winhack.c b/win/win32/winhack.c index cf81ec3a9..748b00649 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -73,10 +73,6 @@ 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]; @@ -87,6 +83,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, DWORD major, minor; boolean resuming; + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + UNREFERENCED_PARAMETER(nCmdShow); /* ensure that we don't access violate on a panic() */ windowprocs.win_raw_print = mswin_raw_print;