clear up a few gcc warnings

This commit is contained in:
nhmall
2022-12-05 23:19:38 -05:00
parent afef4bc781
commit 215808abd1
10 changed files with 165 additions and 95 deletions
+6
View File
@@ -2571,6 +2571,12 @@ extern int add_sound_mapping(const char *);
extern void play_sound_for_message(const char *); extern void play_sound_for_message(const char *);
extern void maybe_play_sound(const char *); extern void maybe_play_sound(const char *);
extern void release_sound_mappings(void); extern void release_sound_mappings(void);
#if defined(WIN32) || defined(QT_GRAPHICS)
extern void play_usersound(const char *, int);
#endif
#if defined(TTY_SOUND_ESCCODES)
extern void play_usersound_via_idx(int, int);
#endif
#endif /* USER SOUNDS */ #endif /* USER SOUNDS */
/* ### sp_lev.c ### */ /* ### sp_lev.c ### */
+2
View File
@@ -108,6 +108,8 @@ extern void interject(int);
#endif #endif
#ifdef strcasecmp #ifdef strcasecmp
#undef strcasecmp #undef strcasecmp
/* https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ */
#define __USE_MINGW_ANSI_STDIO 1
#endif #endif
/* extern int getlock(void); */ /* extern int getlock(void); */
#endif #endif
-7
View File
@@ -1400,13 +1400,6 @@ tiphat(void)
#ifdef USER_SOUNDS #ifdef USER_SOUNDS
#if defined(WIN32) || defined(QT_GRAPHICS)
extern void play_usersound(const char *, int);
#endif
#if defined(TTY_SOUND_ESCCODES)
extern void play_usersound_via_idx(int, int);
#endif
typedef struct audio_mapping_rec { typedef struct audio_mapping_rec {
struct nhregex *regex; struct nhregex *regex;
char *filename; char *filename;
+30 -4
View File
@@ -59,6 +59,13 @@ INTERNET_AVAILABLE = N
GIT_AVAILABLE = N GIT_AVAILABLE = N
#
#---------------------------------------------------------------
# Do you want to turn on the same gcc warnings as on Unix builds?
#
GCC_EXTRA_WARNINGS = N
# #
#=============================================== #===============================================
#======= End of Modification Section =========== #======= End of Modification Section ===========
@@ -289,6 +296,20 @@ else
DLBFLG = DLBFLG =
endif endif
ifeq "$(GCC_EXTRA_WARNINGS)" "Y"
#
# These match the warnings enabled on the linux.370 and macOS.370 hints builds
#
CFLAGSXTRA = -Wall -Wextra -Wno-missing-field-initializers -Wreturn-type \
-Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -pedantic \
-Wmissing-declarations -Wformat-nonliteral -Wunreachable-code \
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int \
-Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes
CPPFLAGSXTRA = -Wall -Wextra -Wno-missing-field-initializers -Wreturn-type \
-Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -pedantic \
-Wmissing-declarations -Wformat-nonliteral -Wunreachable-code
endif
COMMONDEF = -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 COMMONDEF = -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
DLLDEF = $(COMMONDEF) -D_WINDOWS -D_USRDLL -D_WINDLL DLLDEF = $(COMMONDEF) -D_WINDOWS -D_USRDLL -D_WINDLL
CONSOLEDEF = $(COMMONDEF) -D_CONSOLE CONSOLEDEF = $(COMMONDEF) -D_CONSOLE
@@ -727,7 +748,8 @@ COREOBJS = $(addsuffix .o, allmain alloc apply artifact attrib ball bones botl c
teleport timeout topten track trap u_init uhitm utf8map vault version vision \ teleport timeout topten track trap u_init uhitm utf8map vault version vision \
weapon were wield windmain windows windsys wizard worm worn write zap) weapon were wield windmain windows windsys wizard worm worn write zap)
CFLAGSW = $(CFLAGS) $(COMMONDEF) $(DLBFLG) -DTILES -D_WINDOWS -DMSWIN_GRAPHICS -DSAFEPROCS -DNOTTYGRAPHICS CFLAGSW = $(CFLAGS) $(CFLAGSXTRA) $(COMMONDEF) $(DLBFLG) -DTILES -D_WINDOWS -DMSWIN_GRAPHICS -DSAFEPROCS -DNOTTYGRAPHICS
CPPFLAGSW = $(CFLAGS) $(CPPFLAGSXTRA) $(COMMONDEF) $(DLBFLG) -DTILES -D_WINDOWS -DMSWIN_GRAPHICS -DSAFEPROCS -DNOTTYGRAPHICS
ONHW = $(O)nethackw ONHW = $(O)nethackw
NHWONLY = $(addsuffix .o, mhaskyn mhdlg mhfont mhinput mhmain mhmap mhmenu \ NHWONLY = $(addsuffix .o, mhaskyn mhdlg mhfont mhinput mhmain mhmap mhmenu \
@@ -759,7 +781,10 @@ $(ONHW)/date.o: $(SRC)/date.c $(NHWOBJS) | $(ONHW)
$(cc) $(CFLAGSW) $(GITHASH) $(GITBRANCH) $< -o$@ $(cc) $(CFLAGSW) $(GITHASH) $(GITBRANCH) $< -o$@
$(ONHW)/cppregex.o: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONHW) $(ONHW)/cppregex.o: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONHW)
$(cc) $(CFLAGSW) $< -o$@ $(cc) $(CPPFLAGSW) $< -o$@
$(ONH)/cppregex.o: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONH)
$(cc) $(CPPFLAGSNH) $< -o$@
$(ONHW)/%.o: $(SSYS)/%.c $(NHLUAH) | $(ONHW) $(ONHW)/%.o: $(SSYS)/%.c $(NHLUAH) | $(ONHW)
$(cc) $(CFLAGSW) $< -o$@ $(cc) $(CFLAGSW) $< -o$@
@@ -792,7 +817,8 @@ CLEAN_FILE += $(NHWTARGETS) $(NHWOBJS) $(NHWRES) $(BMPS)
#========================================== #==========================================
# nethack # nethack
#========================================== #==========================================
CFLAGSNH = $(CFLAGSU) -DNO_TILE_C -DSAFEPROCS -D_LIB -DWIN32CON CFLAGSNH = $(CFLAGSU) $(CFLAGSXTRA) -DNO_TILE_C -DSAFEPROCS -D_LIB -DWIN32CON
CPPFLAGSNH = $(CFLAGSU) $(CPPFLAGSXTRA) -DNO_TILE_C -DSAFEPROCS -D_LIB -DWIN32CON
ONH = $(O)nethack ONH = $(O)nethack
@@ -827,7 +853,7 @@ $(ONH)/date.o: $(SRC)/date.c $(NHOBJS) $(NHRES) | $(ONH)
$(cc) $(CFLAGSNH) $(GITHASH) $(GITBRANCH) $< -o$@ $(cc) $(CFLAGSNH) $(GITHASH) $(GITBRANCH) $< -o$@
$(ONH)/cppregex.o: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONH) $(ONH)/cppregex.o: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONH)
$(cc) $(CFLAGSNH) $< -o$@ $(cc) $(CPPFLAGSNH) $< -o$@
$(ONH)/%.o: $(SSYS)/%.c $(NHLUAH) | $(ONH) $(ONH)/%.o: $(SSYS)/%.c $(NHLUAH) | $(ONH)
$(cc) $(CFLAGSNH) $< -o$@ $(cc) $(CFLAGSNH) $< -o$@
+2 -2
View File
@@ -61,7 +61,7 @@ $(ONHW)/%.d: $(SRC)/%.c $(NHLUAH) | $(ONHW)
$(cce) $(CFLAGSW) $< -o$@ $(cce) $(CFLAGSW) $< -o$@
$(ONHW)/cppregex.d: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONHW) $(ONHW)/cppregex.d: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONHW)
$(cce) $(CFLAGSW) $< -o$@ $(cce) $(CPPFLAGSW) $< -o$@
$(ONHW)/%.d: $(SSYS)/%.c $(NHLUAH) | $(ONHW) $(ONHW)/%.d: $(SSYS)/%.c $(NHLUAH) | $(ONHW)
$(cce) $(CFLAGSW) $< -o$@ $(cce) $(CFLAGSW) $< -o$@
@@ -79,7 +79,7 @@ $(ONH)/%.d: $(SRC)/%.c $(NHLUAH) | $(ONH)
$(cce) $(CFLAGSNH) $< -o$@ $(cce) $(CFLAGSNH) $< -o$@
$(ONH)/cppregex.d: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONH) $(ONH)/cppregex.d: $(SSYS)/cppregex.cpp $(NHLUAH) | $(ONH)
$(cce) $(CFLAGSNH) $< -o$@ $(cce) $(CPPFLAGSNH) $< -o$@
$(ONH)/%.d: $(SSYS)/%.c $(NHLUAH) | $(ONH) $(ONH)/%.d: $(SSYS)/%.c $(NHLUAH) | $(ONH)
$(cce) $(CFLAGSNH) $< -o$@ $(cce) $(CFLAGSNH) $< -o$@
+1 -1
View File
@@ -17,7 +17,7 @@
#ifdef USER_SOUNDS #ifdef USER_SOUNDS
void void
play_usersound(const char* filename, int volume) play_usersound(const char* filename, int volume UNUSED)
{ {
/* pline("play_usersound: %s (%d).", filename, volume); */ /* pline("play_usersound: %s (%d).", filename, volume); */
(void) sndPlaySound(filename, SND_ASYNC | SND_NODEFAULT); (void) sndPlaySound(filename, SND_ASYNC | SND_NODEFAULT);
+1 -1
View File
@@ -15,7 +15,7 @@ typedef struct {
int left; // in desktop coordinate pixel space int left; // in desktop coordinate pixel space
} MonitorInfo; } MonitorInfo;
void win10_init(); void win10_init(void);
int win10_monitor_dpi(HWND hWnd); int win10_monitor_dpi(HWND hWnd);
double win10_monitor_scale(HWND hWnd); double win10_monitor_scale(HWND hWnd);
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo); void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo);
+34 -10
View File
@@ -100,6 +100,28 @@ static struct stat hbuf;
extern char orgdir[]; extern char orgdir[];
int get_known_folder_path(const KNOWNFOLDERID * folder_id,
char * path, size_t path_size);
void create_directory(const char * path);
int build_known_folder_path(const KNOWNFOLDERID * folder_id,
char * path, size_t path_size, boolean versioned);
void build_environment_path(const char * env_str, const char * folder,
char * path, size_t path_size);
boolean folder_file_exists(const char * folder, const char * file_name);
boolean test_portable_config(const char *executable_path,
char *portable_device_path, size_t portable_device_path_size);
void set_default_prefix_locations(const char *programPath);
void copy_sysconf_content(void);
void copy_config_content(void);
void copy_hack_content(void);
#ifdef PORT_HELP
void port_help(void);
#endif
void windows_raw_print(const char* str);
DISABLE_WARNING_UNREACHABLE_CODE DISABLE_WARNING_UNREACHABLE_CODE
int int
@@ -125,7 +147,8 @@ get_known_folder_path(
// silently handle this problem // silently handle this problem
return FALSE; return FALSE;
} else if (err != 0) { } else if (err != 0) {
error("Failed folder (%u) path string conversion, unexpected err = %d", folder_id->Data1, err); error("Failed folder (%lu) path string conversion, unexpected err = %d",
folder_id->Data1, err);
return FALSE; return FALSE;
} }
@@ -156,7 +179,7 @@ build_known_folder_path(
strcat(path, "\\NetHack\\"); strcat(path, "\\NetHack\\");
create_directory(path); create_directory(path);
if (versioned) { if (versioned) {
Sprintf(eos(path), "%d.%d\\", Sprintf(eos(path), "%d.%d\\",
VERSION_MAJOR, VERSION_MINOR); VERSION_MAJOR, VERSION_MINOR);
create_directory(path); create_directory(path);
} }
@@ -226,7 +249,7 @@ test_portable_config(
*/ */
*portable_device_path = '\0'; *portable_device_path = '\0';
lth = sizeof tmppath - strlen(sysconf); lth = sizeof tmppath - strlen(sysconf);
(void) strncpy(tmppath, executable_path, lth - 1); (void) strncpy(tmppath, executable_path, lth - 1);
tmppath[lth - 1] = '\0'; tmppath[lth - 1] = '\0';
(void) strcat(tmppath, sysconf); (void) strcat(tmppath, sysconf);
@@ -260,14 +283,14 @@ const char *get_portable_device(void)
} }
void void
set_default_prefix_locations(const char *programPath) set_default_prefix_locations(const char *programPath UNUSED)
{ {
static char executable_path[MAX_PATH]; static char executable_path[MAX_PATH];
static char profile_path[MAX_PATH]; static char profile_path[MAX_PATH];
static char versioned_profile_path[MAX_PATH]; static char versioned_profile_path[MAX_PATH];
static char versioned_user_data_path[MAX_PATH]; static char versioned_user_data_path[MAX_PATH];
static char versioned_global_data_path[MAX_PATH]; static char versioned_global_data_path[MAX_PATH];
static char versioninfo[20]; /* static char versioninfo[20] UNUSED; */
strcpy(executable_path, get_executable_path()); strcpy(executable_path, get_executable_path());
append_slash(executable_path); append_slash(executable_path);
@@ -594,7 +617,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
load_symset("RogueEpyx", ROGUESET); load_symset("RogueEpyx", ROGUESET);
} }
/* Has the callback for the symset been invoked? Config file processing to /* Has the callback for the symset been invoked? Config file processing to
load a symset runs too early to accomplish that because load a symset runs too early to accomplish that because
the various *graphics_mode_callback pointers don't get set until the various *graphics_mode_callback pointers don't get set until
term_start_screen, unfortunately */ term_start_screen, unfortunately */
#if defined(TERMLIB) || defined(CURSES_GRAPHICS) #if defined(TERMLIB) || defined(CURSES_GRAPHICS)
@@ -1005,7 +1028,7 @@ fakeconsole(void)
} }
has_fakeconsole = TRUE; has_fakeconsole = TRUE;
} }
/* Obtain handles for the standard Console I/O devices */ /* Obtain handles for the standard Console I/O devices */
hConIn = GetStdHandle(STD_INPUT_HANDLE); hConIn = GetStdHandle(STD_INPUT_HANDLE);
hConOut = GetStdHandle(STD_OUTPUT_HANDLE); hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -1135,14 +1158,15 @@ windows_nhbell(void)
/*ARGSUSED*/ /*ARGSUSED*/
int int
windows_nh_poskey(int *x, int *y, int *mod) windows_nh_poskey(int *x UNUSED, int *y UNUSED, int *mod UNUSED)
{ {
return '\033'; return '\033';
} }
/*ARGSUSED*/ /*ARGSUSED*/
char char
windows_yn_function(const char* query, const char* resp, char def) windows_yn_function(const char* query UNUSED, const char* resp UNUSED,
char def UNUSED)
{ {
return '\033'; return '\033';
} }
@@ -1329,7 +1353,7 @@ file_exists(const char* path)
RESTORE_WARNING_UNREACHABLE_CODE RESTORE_WARNING_UNREACHABLE_CODE
/* /*
file_newer returns TRUE if the file at a_path is newer then the file file_newer returns TRUE if the file at a_path is newer then the file
at b_path. If a_path does not exist, it returns FALSE. If b_path at b_path. If a_path does not exist, it returns FALSE. If b_path
does not exist, it returns TRUE. does not exist, it returns TRUE.
+42 -24
View File
@@ -4,7 +4,7 @@
/* /*
* WIN32 system functions. * WIN32 system functions.
* *
* Included in both console-based and window-based clients on the windows platform. * Included in both console-based and window-based clients on the windows platform.
* *
* Initial Creation: Michael Allison - January 31/93 * Initial Creation: Michael Allison - January 31/93
@@ -49,14 +49,22 @@ extern boolean getreturn_enabled;
int redirect_stdout; int redirect_stdout;
#ifdef WIN32CON #ifdef WIN32CON
typedef HWND(WINAPI *GETCONSOLEWINDOW)(); typedef HWND(WINAPI *GETCONSOLEWINDOW)(void);
#ifdef WIN32CON
static HWND GetConsoleHandle(void); static HWND GetConsoleHandle(void);
static HWND GetConsoleHwnd(void); static HWND GetConsoleHwnd(void);
#endif
#if !defined(TTY_GRAPHICS) #if !defined(TTY_GRAPHICS)
extern void backsp(void); extern void backsp(void);
#endif #endif
int windows_console_custom_nhgetch(void); int windows_console_custom_nhgetch(void);
extern void safe_routines(void); extern void safe_routines(void);
int windows_early_options(const char *window_opt);
unsigned long sys_random_seed(void);
#if 0
static int max_filename(void);
#endif
/* The function pointer nt_kbhit contains a kbhit() equivalent /* The function pointer nt_kbhit contains a kbhit() equivalent
* which varies depending on which window port is active. * which varies depending on which window port is active.
@@ -66,7 +74,7 @@ extern void safe_routines(void);
*/ */
int def_kbhit(void); int def_kbhit(void);
int (*nt_kbhit)() = def_kbhit; int (*nt_kbhit)(void) = def_kbhit;
#endif /* WIN32CON */ #endif /* WIN32CON */
#ifndef WIN32CON #ifndef WIN32CON
@@ -157,6 +165,7 @@ chdrive(char* str)
} }
} }
#if 0
static int static int
max_filename(void) max_filename(void)
{ {
@@ -170,6 +179,7 @@ max_filename(void)
else else
return 0; return 0;
} }
#endif
int int
def_kbhit(void) def_kbhit(void)
@@ -208,6 +218,8 @@ extern void mswin_raw_print_flush(void);
extern void mswin_raw_print(const char *); extern void mswin_raw_print(const char *);
#endif #endif
DISABLE_WARNING_FORMAT_NONLITERAL
/* fatal error */ /* fatal error */
/*VARARGS1*/ /*VARARGS1*/
void error void error
@@ -237,6 +249,8 @@ VA_DECL(const char *, s)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
RESTORE_WARNING_FORMAT_NONLITERAL
void void
Delay(int ms) Delay(int ms)
{ {
@@ -317,7 +331,7 @@ void
interject(int interjection_type) interject(int interjection_type)
{ {
if (interjection_type >= 0 && interjection_type < INTERJECTION_TYPES) if (interjection_type >= 0 && interjection_type < INTERJECTION_TYPES)
msmsg(interjection_buf[interjection_type]); msmsg("%s", interjection_buf[interjection_type]);
} }
#ifdef RUNTIME_PASTEBUF_SUPPORT #ifdef RUNTIME_PASTEBUF_SUPPORT
@@ -328,22 +342,23 @@ void port_insert_pastebuf(char *buf)
* to accomplish this. * to accomplish this.
*/ */
HGLOBAL hglbCopy; HGLOBAL hglbCopy;
WCHAR *w, w2[2]; WCHAR *w, w2[2];
int cc, rc, abytes; /* int cc; */
int rc, abytes;
LPWSTR lpwstrCopy; LPWSTR lpwstrCopy;
HANDLE hresult; HANDLE hresult;
if (!buf) if (!buf)
return; return;
cc = strlen(buf); /* cc = strlen(buf); */
/* last arg=0 means "tell me the size of the buffer that I need" */ /* last arg=0 means "tell me the size of the buffer that I need" */
rc = MultiByteToWideChar(GetConsoleOutputCP(), 0, buf, -1, w2, 0); rc = MultiByteToWideChar(GetConsoleOutputCP(), 0, buf, -1, w2, 0);
if (!rc) return; if (!rc) return;
abytes = rc * sizeof(WCHAR); abytes = rc * sizeof(WCHAR);
w = (WCHAR *)alloc(abytes); w = (WCHAR *)alloc(abytes);
/* Housekeeping need: +free(w) */ /* Housekeeping need: +free(w) */
rc = MultiByteToWideChar(GetConsoleOutputCP(), 0, buf, -1, w, rc); rc = MultiByteToWideChar(GetConsoleOutputCP(), 0, buf, -1, w, rc);
@@ -357,18 +372,18 @@ void port_insert_pastebuf(char *buf)
} }
/* Housekeeping need: +CloseClipboard(), free(w) */ /* Housekeeping need: +CloseClipboard(), free(w) */
EmptyClipboard(); EmptyClipboard();
/* allocate global mem obj to hold the text */ /* allocate global mem obj to hold the text */
hglbCopy = GlobalAlloc(GMEM_MOVEABLE, abytes); hglbCopy = GlobalAlloc(GMEM_MOVEABLE, abytes);
if (hglbCopy == NULL) { if (hglbCopy == NULL) {
CloseClipboard(); CloseClipboard();
free(w); free(w);
return; return;
} }
/* Housekeeping need: +GlobalFree(hglbCopy), CloseClipboard(), free(w) */ /* Housekeeping need: +GlobalFree(hglbCopy), CloseClipboard(), free(w) */
lpwstrCopy = (LPWSTR)GlobalLock(hglbCopy); lpwstrCopy = (LPWSTR)GlobalLock(hglbCopy);
/* Housekeeping need: +GlobalUnlock(hglbCopy), GlobalFree(hglbCopy), /* Housekeeping need: +GlobalUnlock(hglbCopy), GlobalFree(hglbCopy),
CloseClipboard(), free(w) */ CloseClipboard(), free(w) */
@@ -384,8 +399,8 @@ void port_insert_pastebuf(char *buf)
GlobalFree(hglbCopy); /* only needed if clipboard didn't accept data */ GlobalFree(hglbCopy); /* only needed if clipboard didn't accept data */
} }
/* Housekeeping need: CloseClipboard(), free(w) */ /* Housekeeping need: CloseClipboard(), free(w) */
CloseClipboard(); CloseClipboard();
free(w); free(w);
return; return;
} }
@@ -566,8 +581,10 @@ WCHAR *
winos_ascii_to_wide_str(const unsigned char * src, WCHAR * dst, size_t dstLength) winos_ascii_to_wide_str(const unsigned char * src, WCHAR * dst, size_t dstLength)
{ {
size_t i = 0; size_t i = 0;
while(i < dstLength - 1 && src[i] != 0) while(i < dstLength - 1 && src[i] != 0) {
dst[i++] = cp437[src[i]]; dst[i] = cp437[src[i]];
i++;
}
dst[i] = 0; dst[i] = 0;
return dst; return dst;
} }
@@ -644,7 +661,8 @@ windows_early_options(const char *window_opt)
return 1; return 1;
} else { } else {
raw_printf( raw_printf(
"-%swindows:cursorblink is the only supported option.\n"); "-%s windows:cursorblink is the only supported option.\n",
window_opt);
} }
return 0; return 0;
} }
@@ -690,10 +708,10 @@ sys_random_seed(void)
status = BCryptOpenAlgorithmProvider(&hRa, BCRYPT_RNG_ALGORITHM, status = BCryptOpenAlgorithmProvider(&hRa, BCRYPT_RNG_ALGORITHM,
(LPCWSTR) 0, 0); (LPCWSTR) 0, 0);
if (hRa && status == STATUS_SUCCESS) { if (hRa && status == (NTSTATUS) STATUS_SUCCESS) {
status = BCryptGenRandom(hRa, (PUCHAR) &ourseed, status = BCryptGenRandom(hRa, (PUCHAR) &ourseed,
(ULONG) sizeof ourseed, 0); (ULONG) sizeof ourseed, 0);
if (status == STATUS_SUCCESS) { if (status == (NTSTATUS) STATUS_SUCCESS) {
BCryptCloseAlgorithmProvider(hRa,0); BCryptCloseAlgorithmProvider(hRa,0);
has_strong_rngseed = TRUE; has_strong_rngseed = TRUE;
Plan_B = FALSE; Plan_B = FALSE;
@@ -726,7 +744,7 @@ nt_assert_failed(const char *expression, const char *filepath, int line)
if (IsDebuggerPresent()) { if (IsDebuggerPresent()) {
char message[BUFSIZ]; char message[BUFSIZ];
snprintf(message, sizeof(message), snprintf(message, sizeof(message),
"nhassert(%s) failed in file '%s' at line %d", "nhassert(%s) failed in file '%s' at line %d",
expression, filename, line); expression, filename, line);
OutputDebugStringA(message); OutputDebugStringA(message);
+47 -46
View File
@@ -145,7 +145,7 @@ safe_get_nh_event(void)
} }
void void
safe_suspend_nhwindows(const char *str) safe_suspend_nhwindows(const char *str UNUSED)
{ {
return; return;
} }
@@ -157,44 +157,44 @@ safe_resume_nhwindows(void)
} }
void void
safe_exit_nhwindows(const char *str) safe_exit_nhwindows(const char *str UNUSED)
{ {
return; return;
} }
winid winid
safe_create_nhwindow(int type) safe_create_nhwindow(int type UNUSED)
{ {
return WIN_ERR; return WIN_ERR;
} }
void void
safe_clear_nhwindow(winid window) safe_clear_nhwindow(winid window UNUSED)
{ {
return; return;
} }
/*ARGSUSED*/ /*ARGSUSED*/
void void
safe_display_nhwindow(winid window,boolean blocking) safe_display_nhwindow(winid window UNUSED, boolean blocking UNUSED)
{ {
return; return;
} }
void void
safe_dismiss_nhwindow(winid window) safe_dismiss_nhwindow(winid window UNUSED)
{ {
return; return;
} }
void void
safe_destroy_nhwindow(winid window) safe_destroy_nhwindow(winid window UNUSED)
{ {
return; return;
} }
void void
safe_curs(winid window, int x, int y) safe_curs(winid window UNUSED, int x UNUSED, int y UNUSED)
{ {
return; return;
} }
@@ -206,19 +206,19 @@ safe_putstr(winid window, int attr, const char *str)
} }
void void
safe_putmixed(winid window, int attr, const char *str) safe_putmixed(winid window UNUSED, int attr UNUSED, const char *str UNUSED)
{ {
return; return;
} }
void void
safe_display_file(const char * fname, boolean complain) safe_display_file(const char * fname UNUSED, boolean complain UNUSED)
{ {
return; return;
} }
void void
safe_start_menu(winid window, unsigned long mbehavior) safe_start_menu(winid window UNUSED, unsigned long mbehavior UNUSED)
{ {
return; return;
} }
@@ -230,15 +230,15 @@ safe_start_menu(winid window, unsigned long mbehavior)
*/ */
void void
safe_add_menu( safe_add_menu(
winid window, /* window to use, must be of type NHW_MENU */ winid window UNUSED, /* window to use, must be of type NHW_MENU */
const glyph_info *glyphinfo UNUSED, /* glyph plus glyph info */ const glyph_info *glyphinfo UNUSED, /* glyph plus glyph info */
const anything *identifier, /* what to return if selected */ const anything *identifier UNUSED, /* what to return if selected */
char ch, /* keyboard accelerator (0 = pick our own) */ char ch UNUSED, /* keyboard accelerator (0 = pick our own) */
char gch, /* group accelerator (0 = no group) */ char gch UNUSED, /* group accelerator (0 = no group) */
int attr, /* attribute for string (like safe_putstr()) */ int attr UNUSED, /* attribute for string (like safe_putstr()) */
int clr, /* colour for string */ int clr UNUSED, /* colour for string */
const char *str, /* menu string */ const char *str UNUSED, /* menu string */
unsigned int itemflags) /* itemflags such as marked as selected */ unsigned int itemflags UNUSED) /* itemflags such as marked as selected */
{ {
return; return;
} }
@@ -248,17 +248,17 @@ safe_add_menu(
*/ */
void void
safe_end_menu( safe_end_menu(
winid window, /* menu to use */ winid window UNUSED, /* menu to use */
const char *prompt) /* prompt to for menu */ const char *prompt UNUSED) /* prompt to for menu */
{ {
return; return;
} }
int int
safe_select_menu( safe_select_menu(
winid window, winid window UNUSED,
int how, int how UNUSED,
menu_item **menu_list) menu_item **menu_list UNUSED)
{ {
return 0; return 0;
} }
@@ -266,9 +266,9 @@ safe_select_menu(
/* special hack for treating top line --More-- as a one item menu */ /* special hack for treating top line --More-- as a one item menu */
char char
safe_message_menu( safe_message_menu(
char let, char let UNUSED,
int how, int how UNUSED,
const char *mesg) const char *mesg UNUSED)
{ {
return '\033'; return '\033';
} }
@@ -285,7 +285,7 @@ safe_wait_synch(void)
#ifdef CLIPPING #ifdef CLIPPING
void void
safe_cliparound(int x, int y) safe_cliparound(int x UNUSED, int y UNUSED)
{ {
} }
#endif /* CLIPPING */ #endif /* CLIPPING */
@@ -307,13 +307,13 @@ safe_print_glyph(
} }
void void
safe_raw_print(const char *str) safe_raw_print(const char *str UNUSED)
{ {
return; return;
} }
void void
safe_raw_print_bold(const char *str) safe_raw_print_bold(const char *str UNUSED)
{ {
return; return;
} }
@@ -331,20 +331,20 @@ safe_nhgetch(void)
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
int int
safe_nh_poskey(coordxy *x, coordxy *y, int *mod) safe_nh_poskey(coordxy *x UNUSED, coordxy *y UNUSED, int *mod UNUSED)
{ {
return '\033'; return '\033';
} }
void void
win_safe_init(int dir) win_safe_init(int dir UNUSED)
{ {
return; return;
} }
#ifdef POSITIONBAR #ifdef POSITIONBAR
void void
safe_update_positionbar(char *posbar) safe_update_positionbar(char *posbar UNUSED)
{ {
return; return;
} }
@@ -379,7 +379,8 @@ safe_doprev_message(void)
} }
char char
safe_yn_function(const char * query, const char* resp, char def) safe_yn_function(const char *query UNUSED,
const char *resp UNUSED, char def UNUSED)
{ {
return '\033'; return '\033';
} }
@@ -422,7 +423,7 @@ safe_end_screen(void)
} }
void void
safe_outrip(winid tmpwin, int how, time_t when) safe_outrip(winid tmpwin UNUSED, int how UNUSED, time_t when UNUSED)
{ {
return; return;
} }
@@ -442,8 +443,8 @@ safe_getmsghistory(boolean init UNUSED)
void void
safe_putmsghistory( safe_putmsghistory(
const char *msg, const char *msg UNUSED,
boolean is_restoring) boolean is_restoring UNUSED)
{ {
} }
@@ -454,18 +455,18 @@ safe_status_finish(void)
void void
safe_status_enablefield( safe_status_enablefield(
int fieldidx, int fieldidx UNUSED,
const char *nm, const char *nm UNUSED,
const char *fmt, const char *fmt UNUSED,
boolean enable) boolean enable UNUSED)
{ {
} }
/* call once for each field, then call with BL_FLUSH to output the result */ /* call once for each field, then call with BL_FLUSH to output the result */
void void
safe_status_update( safe_status_update(
int idx, int idx UNUSED,
genericptr_t ptr, genericptr_t ptr UNUSED,
int chg UNUSED, int chg UNUSED,
int percent UNUSED, int percent UNUSED,
int color UNUSED, int color UNUSED,
@@ -481,9 +482,9 @@ safe_update_inventory(int arg UNUSED)
win_request_info * win_request_info *
safe_ctrl_nhwindow( safe_ctrl_nhwindow(
winid window, winid window UNUSED,
int request, int request UNUSED,
win_request_info *wri) win_request_info *wri UNUSED)
{ {
return (win_request_info *) 0; return (win_request_info *) 0;
} }