more MSYS2 warning clean-up

This commit is contained in:
nhmall
2024-12-12 22:35:38 -05:00
parent 8bb764e624
commit c7276bcf67
15 changed files with 227 additions and 156 deletions

View File

@@ -73,7 +73,7 @@ int GUILaunched = TRUE; /* We tell shared startup code in windmain.c
// Forward declarations of functions included in this code module:
extern boolean main(int, char **);
static void __cdecl mswin_moveloop(void *);
//static void __cdecl mswin_moveloop(void *);
#define MAX_CMDLINE_PARAM 255
@@ -327,7 +327,7 @@ _get_cmd_arg(TCHAR *pCmdLine)
} else {
pArgs = NULL;
}
nhUse(bQuoted);
return pRetArg;
}

View File

@@ -12,7 +12,10 @@
#include "mhdlg.h"
#include <assert.h>
int list_view_height(HWND hWnd, int count);
void get_rect_size(RECT *rect, SIZE *size);
void center_dialog(HWND dialog);
void size_dialog(HWND dialog, SIZE new_client_size);
/*---------------------------------------------------------------*/
/* data for getlin dialog */
@@ -346,6 +349,11 @@ INT_PTR CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
static void plselAdjustSelections(HWND hWnd);
static boolean plselRandomize(plsel_data_t * data);
static BOOL plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam);
void calculate_player_selector_layout(plsel_data_t * data);
void move_controls(control_t * controls, int count);
void do_player_selector_layout(plsel_data_t * data);
void plselInitDialog(struct plsel_data * data);
int plselFinalSelection(HWND hWnd);
boolean
mswin_player_selection_window(void)
@@ -874,7 +882,7 @@ plselAdjustSelections(HWND hWnd)
/* player made up his mind - get final selection here */
int
plselFinalSelection(HWND hWnd)
plselFinalSelection(HWND hWnd UNUSED)
{
int role, race, gender, alignment;
@@ -984,7 +992,7 @@ plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
struct plsel_data * data = (plsel_data_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
/* If there are no list box items, skip this message. */
if (lpdis->itemID < 0)
if (lpdis->itemID == (UINT) -1)
return FALSE;
HWND control = GetDlgItem(hWnd, (int) wParam);

View File

@@ -12,6 +12,6 @@
int mswin_getlin_window(const char *question, char *result,
size_t result_size);
int mswin_ext_cmd_window(int *selection);
boolean mswin_player_selection_window();
boolean mswin_player_selection_window(void);
#endif /* MSWINDlgWindow_h */

View File

@@ -544,6 +544,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
mswin_select_map_mode(iflags.wc_map_mode);
child = GetNHApp()->windowlist[msg_param->wid].win;
nhUse(child);
} break;
case MSNH_MSG_RANDOM_INPUT: {
@@ -753,14 +754,18 @@ mswin_layout_main_window(HWND changed_child)
}
if (IsWindow(changed_child))
SetForegroundWindow(changed_child);
nhUse(data);
}
VOID CALLBACK FuzzTimerProc( _In_ HWND hwnd,
_In_ UINT uMsg, _In_ UINT_PTR idEvent,
_In_ DWORD dwTime);
VOID CALLBACK FuzzTimerProc(
_In_ HWND hwnd,
_In_ UINT uMsg,
_In_ UINT_PTR idEvent,
_In_ DWORD dwTime
)
_In_ UINT uMsg UNUSED,
_In_ UINT_PTR idEvent UNUSED,
_In_ DWORD dwTime UNUSED)
{
INPUT input[16];
int i_pos = 0;
@@ -1114,6 +1119,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
default:
return 1;
}
nhUse(wmEvent);
return 0;
}

View File

@@ -764,6 +764,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
msg_data->buffer[index++] = '\r';
msg_data->buffer[index++] = '\n';
}
nhUse(mgch);
} break;
#ifdef ENHANCED_SYMBOLS

View File

@@ -923,7 +923,7 @@ SetMenuListType(HWND hWnd, int how)
for (i = 0; i < data->menui.menu.size; i++) {
LVITEM lvitem;
ZeroMemory(&lvitem, sizeof(lvitem));
sprintf(buf, "%c - %s", max(data->menui.menu.items[i].accelerator, ' '),
Snprintf(buf, sizeof buf, "%c - %s", max(data->menui.menu.items[i].accelerator, ' '),
data->menui.menu.items[i].str);
lvitem.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT;
@@ -940,6 +940,7 @@ SetMenuListType(HWND hWnd, int how)
}
if (data->is_active)
SetFocus(control);
nhUse(nItem);
}
/*-----------------------------------------------------------------------------*/
HWND
@@ -1036,7 +1037,7 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
lpdis = (LPDRAWITEMSTRUCT) lParam;
/* If there are no list box items, skip this message. */
if (lpdis->itemID == -1)
if (lpdis->itemID == (UINT) -1)
return FALSE;
data = (PNHMenuWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);

View File

@@ -481,8 +481,8 @@ onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
// of the scroll box, and update the window. UpdateWindow
// sends the WM_PAINT message.
if (yInc = max(MSG_VISIBLE_LINES - data->yPos,
min(yInc, data->yMax - data->yPos))) {
if ((yInc = max(MSG_VISIBLE_LINES - data->yPos,
min(yInc, data->yMax - data->yPos)))) {
data->yPos += yInc;
/* ScrollWindowEx(hWnd, 0, -data->yChar * yInc,
(CONST RECT *) NULL, (CONST RECT *) NULL,

View File

@@ -297,6 +297,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
break;
}
nhUse(InRipText);
}
void

View File

@@ -259,6 +259,7 @@ NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
DrawText(hdc, VersionString, strlen(VersionString), &rt,
DT_LEFT | DT_NOPREFIX);
EndPaint(hWnd, &ps);
nhUse(OldFont);
} break;
case WM_COMMAND:

View File

@@ -19,7 +19,6 @@
extern COLORREF nhcolor_to_RGB(int c); /* from mhmap */
typedef struct back_buffer {
HWND hWnd;
HDC hdc;
@@ -29,6 +28,11 @@ typedef struct back_buffer {
int height;
} back_buffer_t;
void back_buffer_free(back_buffer_t * back_buffer);
void back_buffer_allocate(back_buffer_t * back_buffer, int width, int height);
void back_buffer_size(back_buffer_t * back_buffer, int width, int height);
void back_buffer_init(back_buffer_t * back_buffer, HWND hWnd, int width, int height);
void back_buffer_free(back_buffer_t * back_buffer)
{
if (back_buffer->bm != NULL) {
@@ -274,7 +278,7 @@ StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
static LRESULT
onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
onWMPaint(HWND hWnd, WPARAM wParam UNUSED, LPARAM lParam UNUSED)
{
SIZE sz;
WCHAR wbuf[BUFSZ];

View File

@@ -17,7 +17,9 @@ static const int fieldorder2[] = { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX
BL_ENE, BL_ENEMAX, BL_AC, BL_XP,
BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, -1 };
#ifdef MSWPROC_C
static const int *fieldorders[] = { fieldorder1, fieldorder2, NULL };
#endif
static const int fieldcounts[NHSW_LINES] = { SIZE(fieldorder1) - 1, SIZE(fieldorder2) - 1};
#define MSWIN_MAX_LINE1_STRINGS (SIZE(fieldorder1) - 1)

View File

@@ -7,6 +7,7 @@
* code in the mswin port and the rest of the nethack game engine.
*/
#define MSWPROC_C
#include "hack.h"
#include "color.h"
#include "dlb.h"
@@ -28,6 +29,7 @@
#include "mhmain.h"
#include "mhfont.h"
#include "resource.h"
#undef MSWPROC_C
#define LLEN 128
@@ -371,14 +373,15 @@ prompt_for_player_selection(void)
/* tty_putsym(BASE_WINDOW, (int)strlen(prompt)+1, echoline,
* pick4u); */
/* tty_putstr(BASE_WINDOW, 0, ""); */
} else
} else {
/* Otherwise it's hard to tell where to echo, and things are
* wrapping a bit messily anyway, so (try to) make sure the next
* question shows up well and doesn't get wrapped at the
* bottom of the window.
*/
/* tty_clear_nhwindow(BASE_WINDOW) */;
/* tty_clear_nhwindow(BASE_WINDOW) */
;
}
if (pick4u != 'y' && pick4u != 'n') {
give_up: /* Quit */
if (selected)
@@ -450,7 +453,7 @@ prompt_for_player_selection(void)
any.a_int = i + 1; /* must be non-zero */
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick a role for your %s", plbuf);
Snprintf(pbuf, sizeof pbuf, "Pick a role for your %s", plbuf);
end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected);
destroy_nhwindow(win);
@@ -524,7 +527,7 @@ prompt_for_player_selection(void)
any.a_int = i + 1; /* must be non-zero */
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the race of your %s", plbuf);
Snprintf(pbuf, sizeof pbuf, "Pick the race of your %s", plbuf);
end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected);
destroy_nhwindow(win);
@@ -599,7 +602,7 @@ prompt_for_player_selection(void)
any.a_int = i + 1; /* must be non-zero */
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the gender of your %s", plbuf);
Snprintf(pbuf, sizeof pbuf, "Pick the gender of your %s", plbuf);
end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected);
destroy_nhwindow(win);
@@ -673,7 +676,7 @@ prompt_for_player_selection(void)
any.a_int = i + 1; /* must be non-zero */
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
ATR_NONE, clr, "Quit", MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
Snprintf(pbuf, sizeof pbuf, "Pick the alignment of your %s", plbuf);
end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected);
destroy_nhwindow(win);
@@ -1260,7 +1263,7 @@ mswin_update_inventory(int arg)
win_request_info *
mswin_ctrl_nhwindow(
winid window,
winid window UNUSED,
int request,
win_request_info *wri)
{
@@ -1365,10 +1368,12 @@ mswin_print_glyph(winid wid, coordxy x, coordxy y,
* mswin_raw_print_accumulate() accumulate the given text into
* raw_print_strbuf.
*/
void mswin_raw_print_accumulate(const char * str, boolean bold);
void
mswin_raw_print_accumulate(const char * str, boolean bold)
{
bold; // ignored for now
nhUse(bold); // ignored for now
if (raw_print_strbuf.str != NULL) strbuf_append(&raw_print_strbuf, "\n");
strbuf_append(&raw_print_strbuf, str);
@@ -1704,7 +1709,7 @@ mswin_yn_function(const char *question, const char *choices, char def)
res_ch[1] = '\x0';
mswin_putstr_ex(WIN_MESSAGE, ATR_BOLD, res_ch, 1);
}
nhUse(yn_esc_map);
return ch;
}
@@ -1916,7 +1921,7 @@ char *
mswin_get_color_string(void)
{
logDebug("mswin_get_color_string()\n");
return ("");
return (char *) "";
}
/*
@@ -2557,7 +2562,7 @@ mswin_write_reg(void)
if (RegOpenKeyEx(HKEY_CURRENT_USER, keystring, 0, KEY_WRITE, &key)
!= ERROR_SUCCESS) {
RegCreateKeyEx(HKEY_CURRENT_USER, keystring, 0, "",
RegCreateKeyEx(HKEY_CURRENT_USER, keystring, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
&key, &disposition);
}
@@ -2694,7 +2699,7 @@ static color_table_value color_table[] = {
};
typedef struct ctbv {
char *colorstring;
const char *colorstring;
int syscolorvalue;
} color_table_brush_value;
@@ -2729,7 +2734,7 @@ mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
color_table_value *ctv_ptr = color_table;
color_table_brush_value *ctbv_ptr = color_table_brush;
int red_value, blue_value, green_value;
static char *hexadecimals = "0123456789abcdef";
static const char *hexadecimals = "0123456789abcdef";
if (colorstring == NULL)
return;
@@ -2880,36 +2885,36 @@ static mswin_status_string _condition_strings[CONDITION_COUNT];
static mswin_status_field _status_fields[MAXBLSTATS];
static mswin_condition_field _condition_fields[CONDITION_COUNT] = {
{ BL_MASK_BAREH, "Bare" },
{ BL_MASK_BLIND, "Blind" },
{ BL_MASK_BUSY, "Busy" },
{ BL_MASK_CONF, "Conf" },
{ BL_MASK_DEAF, "Deaf" },
{ BL_MASK_ELF_IRON, "Iron" },
{ BL_MASK_FLY, "Fly" },
{ BL_MASK_FOODPOIS, "FoodPois" },
{ BL_MASK_GLOWHANDS, "Glow" },
{ BL_MASK_GRAB, "Grab" },
{ BL_MASK_HALLU, "Hallu" },
{ BL_MASK_HELD, "Held" },
{ BL_MASK_ICY, "Icy" },
{ BL_MASK_INLAVA, "Lava" },
{ BL_MASK_LEV, "Lev" },
{ BL_MASK_PARLYZ, "Parlyz" },
{ BL_MASK_RIDE, "Ride" },
{ BL_MASK_SLEEPING, "Zzz" },
{ BL_MASK_SLIME, "Slime" },
{ BL_MASK_SLIPPERY, "Slip" },
{ BL_MASK_STONE, "Stone" },
{ BL_MASK_STRNGL, "Strngl" },
{ BL_MASK_STUN, "Stun" },
{ BL_MASK_SUBMERGED, "Sub" },
{ BL_MASK_TERMILL, "TermIll" },
{ BL_MASK_TETHERED, "Teth" },
{ BL_MASK_TRAPPED, "Trap" },
{ BL_MASK_UNCONSC, "Out" },
{ BL_MASK_WOUNDEDL, "Legs" },
{ BL_MASK_HOLDING, "Uhold" },
{ BL_MASK_BAREH, "Bare", 0},
{ BL_MASK_BLIND, "Blind", 0 },
{ BL_MASK_BUSY, "Busy", 0 },
{ BL_MASK_CONF, "Conf", 0 },
{ BL_MASK_DEAF, "Deaf", 0 },
{ BL_MASK_ELF_IRON, "Iron", 0 },
{ BL_MASK_FLY, "Fly", 0 },
{ BL_MASK_FOODPOIS, "FoodPois", 0 },
{ BL_MASK_GLOWHANDS, "Glow", 0 },
{ BL_MASK_GRAB, "Grab", 0 },
{ BL_MASK_HALLU, "Hallu", 0 },
{ BL_MASK_HELD, "Held", 0 },
{ BL_MASK_ICY, "Icy", 0 },
{ BL_MASK_INLAVA, "Lava", 0 },
{ BL_MASK_LEV, "Lev", 0 },
{ BL_MASK_PARLYZ, "Parlyz", 0 },
{ BL_MASK_RIDE, "Ride", 0 },
{ BL_MASK_SLEEPING, "Zzz", 0 },
{ BL_MASK_SLIME, "Slime", 0 },
{ BL_MASK_SLIPPERY, "Slip", 0 },
{ BL_MASK_STONE, "Stone", 0 },
{ BL_MASK_STRNGL, "Strngl", 0 },
{ BL_MASK_STUN, "Stun", 0 },
{ BL_MASK_SUBMERGED, "Sub", 0 },
{ BL_MASK_TERMILL, "TermIll", 0 },
{ BL_MASK_TETHERED, "Teth", 0 },
{ BL_MASK_TRAPPED, "Trap", 0 },
{ BL_MASK_UNCONSC, "Out", 0 },
{ BL_MASK_WOUNDEDL, "Legs", 0 },
{ BL_MASK_HOLDING, "Uhold", 0 },
};
extern winid WIN_STATUS;

View File

@@ -142,12 +142,9 @@ typedef struct mswin_nhwindow_app {
LPTRANSPARENTBLT lpfnTransparentBlt; /* transparent blt function */
} NHWinApp, *PNHWinApp;
#define E extern
E PNHWinApp GetNHApp(void);
E struct window_procs mswin_procs;
#undef E
extern PNHWinApp GetNHApp(void);
extern struct window_procs mswin_procs;
extern void free_winmain_stuff(void);
/* Some prototypes */
void mswin_init_nhwindows(int *argc, char **argv);
@@ -179,7 +176,7 @@ void mswin_print_glyph(winid wid, coordxy x, coordxy y,
const glyph_info *glyph, const glyph_info *bkglyph);
void mswin_raw_print(const char *str);
void mswin_raw_print_bold(const char *str);
void mswin_raw_print_flush();
void mswin_raw_print_flush(void);
int mswin_nhgetch(void);
int mswin_nh_poskey(coordxy *x, coordxy *y, int *mod);
void mswin_nhbell(void);
@@ -224,6 +221,8 @@ void mswin_get_window_placement(int type, LPRECT rt);
void mswin_update_window_placement(int type, LPRECT rt);
void mswin_apply_window_style(HWND hwnd);
//boolean mswin_player_selection_window(void);
int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type);
extern HBRUSH menu_bg_brush;