some coordxy and other conversion warnings
When dist2() got changed to use coordxy parameters, a macro that uses it in its definition was overlooked and it had (int) casts in it. That caused a warning about possible data loss when the int then got converted to coordxy for the dist2() call. Give online2() coordxy parameters instead of int, like its bretheren. Avoid a couple of implicit conversion warnings where ints were being assigned to smaller uchar or ints being assigned to smaller short. A couple of signed vs unsigned warnings on some rumor processing. Avoid some signed vs unsigned warnings in mdlib/makedefs where a signed int param eventually got used in an external call that took size_t. Eliminate all of it by just having the outer NetHack routine also take a size_t. Lastly, insert some default C99 alternative time-related code in mdlib/makedefs since asctime() and ctime() are being flagged as deprecated in the upcoming C23 standard and will now start to trigger warnings for anyone using a C23-compliant compiler.
This commit is contained in:
12
src/mdlib.c
12
src/mdlib.c
@@ -55,8 +55,8 @@ static boolean date_via_env = FALSE;
|
||||
|
||||
extern unsigned long md_ignored_features(void);
|
||||
char *mdlib_version_string(char *, const char *);
|
||||
char *version_id_string(char *, int, const char *);
|
||||
char *bannerc_string(char *, int, const char *);
|
||||
char *version_id_string(char *, size_t, const char *);
|
||||
char *bannerc_string(char *, size_t, const char *);
|
||||
int case_insensitive_comp(const char *, const char *);
|
||||
|
||||
static void make_version(void);
|
||||
@@ -300,7 +300,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
|
||||
#endif /* MAKEDEFS_C */
|
||||
|
||||
char *
|
||||
version_id_string(char *outbuf, int bufsz, const char *build_date)
|
||||
version_id_string(char *outbuf, size_t bufsz, const char *build_date)
|
||||
{
|
||||
char subbuf[64], versbuf[64];
|
||||
char statusbuf[64];
|
||||
@@ -333,7 +333,7 @@ version_id_string(char *outbuf, int bufsz, const char *build_date)
|
||||
/* still within #if MAKDEFS_C || FOR_RUNTIME */
|
||||
|
||||
char *
|
||||
bannerc_string(char *outbuf, int bufsz, const char *build_date)
|
||||
bannerc_string(char *outbuf, size_t bufsz, const char *build_date)
|
||||
{
|
||||
char subbuf[64], versbuf[64];
|
||||
|
||||
@@ -814,10 +814,10 @@ case_insensitive_comp(const char *s1, const char *s2)
|
||||
for (;; s1++, s2++) {
|
||||
u1 = (uchar) *s1;
|
||||
if (isupper(u1))
|
||||
u1 = tolower(u1);
|
||||
u1 = (uchar) tolower(u1);
|
||||
u2 = (uchar) *s2;
|
||||
if (isupper(u2))
|
||||
u2 = tolower(u2);
|
||||
u2 = (uchar) tolower(u2);
|
||||
if (u1 == '\0' || u1 != u2)
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user