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:
@@ -1077,11 +1077,11 @@ do_rumors(void)
|
||||
true_rumor_size, true_rumor_offset, false_rumor_count,
|
||||
false_rumor_size, false_rumor_offset, eof_offset);
|
||||
/* record the current position; true rumors will start here */
|
||||
true_rumor_offset = ftell(tfp);
|
||||
true_rumor_offset = (unsigned long) ftell(tfp);
|
||||
|
||||
false_rumor_offset = read_rumors_file(".tru", &true_rumor_count,
|
||||
&true_rumor_size, true_rumor_offset,
|
||||
MD_PAD_RUMORS);
|
||||
false_rumor_offset = (unsigned long) read_rumors_file(".tru", &true_rumor_count,
|
||||
&true_rumor_size, true_rumor_offset,
|
||||
MD_PAD_RUMORS);
|
||||
if (!false_rumor_offset)
|
||||
goto rumors_failure;
|
||||
|
||||
@@ -1241,11 +1241,21 @@ do_date(void)
|
||||
(unsigned long) clocktim);
|
||||
(void) fflush(stderr);
|
||||
}
|
||||
#if !defined(NOSTRFTIME)
|
||||
if (!strftime(cbuf, sizeof cbuf, "%c", gmtime(&clocktim)))
|
||||
cbuf[0] = '\0';
|
||||
#else
|
||||
Strcpy(cbuf, asctime(gmtime(&clocktim)));
|
||||
#endif /* NOSTRFTIME */
|
||||
}
|
||||
#else
|
||||
/* ordinary build: use current date+time */
|
||||
#if !defined(NOSTRFTIME)
|
||||
if (!strftime(cbuf, sizeof cbuf, "%c", localtime(&clocktim)))
|
||||
cbuf[0] = '\0';
|
||||
#else
|
||||
Strcpy(cbuf, ctime(&clocktim));
|
||||
#endif /* NOSTRFTIME */
|
||||
#endif /* REPRODUCIBLE_BUILD */
|
||||
|
||||
if ((c = strchr(cbuf, '\n')) != 0)
|
||||
@@ -1979,7 +1989,7 @@ do_objs(void)
|
||||
for (i = 0; !i || objects[i].oc_class != ILLOBJ_CLASS; i++) {
|
||||
SpinCursor(3);
|
||||
|
||||
objects[i].oc_name_idx = objects[i].oc_descr_idx = i; /* init */
|
||||
objects[i].oc_name_idx = objects[i].oc_descr_idx = (short) i;
|
||||
if (!(objnam = tmpdup(OBJ_NAME(objects[i]))))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user