fix #K3863 - replace 'for (int i=0;...' in core

The Makefiles and some of the hints have already been updated to
specify that C99 is required in response to #K3863.  The code was
evidently being compiled in the default mode of an old version of
gcc and that mode complained that C99 was required to specify a
declaration in the initializer clause of a
'for(initialize;test;update)statement'.  Other C99 features used
by nethack were apparently accepted as extensions in the default
conformance mode.

There's only one such declaration in the core code so replace it
with a separate declaration and ordinary 'for' loop.

win/Qt/{lots}.cpp and win/win32/{few}.c have these declarations but
the core didn't.
This commit is contained in:
PatR
2023-02-20 12:22:14 -08:00
parent 99d784795b
commit c2ec99ecf1

View File

@@ -4059,14 +4059,14 @@ RESTORE_WARNING_FORMAT_NONLITERAL
static int
wiz_display_macros(void)
{
static const char display_issues[] = "Display macro issues:";
char buf[BUFSZ];
winid win;
int test, trouble = 0, no_glyph = NO_GLYPH, max_glyph = MAX_GLYPH;
static const char *const display_issues = "Display macro issues:";
int glyph, test, trouble = 0, no_glyph = NO_GLYPH, max_glyph = MAX_GLYPH;
win = create_nhwindow(NHW_TEXT);
for (int glyph = 0; glyph < MAX_GLYPH; ++glyph) {
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
/* glyph_is_cmap / glyph_to_cmap() */
if (glyph_is_cmap(glyph)) {
test = glyph_to_cmap(glyph);