Fix compiler warnings in macos build.

This commit is contained in:
Bart House
2018-11-23 12:27:55 -08:00
parent cff9fb441a
commit 0d59f1a22b
8 changed files with 47 additions and 46 deletions

View File

@@ -366,7 +366,8 @@ struct savefile_info {
/* Supply nhassert macro if not supplied by port */
#ifndef nhassert
#define nhassert(expression) ((void)0)
#define nhassert(e) ((void)0)
#endif
#endif /* GLOBAL_H */

View File

@@ -414,6 +414,6 @@ instance_globals_init()
sfcap = default_sfinfo;
sfrestinfo = default_sfinfo;
sfsaveinfo = default_sfinfo;
};
}
/*decl.c*/

View File

@@ -1156,10 +1156,10 @@ int x,y;
int tx = u.tx;
int ty = u.ty;
boolean ret;
int g = glyph_at(x,y);
int glyph = glyph_at(x,y);
if (x == u.ux && y == u.uy)
return TRUE;
if (isok(x,y) && glyph_is_cmap(g) && S_stone == glyph_to_cmap(g)
if (isok(x,y) && glyph_is_cmap(glyph) && S_stone == glyph_to_cmap(glyph)
&& !levl[x][y].seenv)
return FALSE;
u.tx = x;

View File

@@ -1008,33 +1008,33 @@ char *buf;
int k;
time_t timeresult = (time_t) 0;
struct tm t, *lt;
char *g, *p, y[5], mo[3], md[3], h[3], mi[3], s[3];
char *d, *p, y[5], mo[3], md[3], h[3], mi[3], s[3];
if (buf && strlen(buf) == 14) {
g = buf;
d = buf;
p = y; /* year */
for (k = 0; k < 4; ++k)
*p++ = *g++;
*p++ = *d++;
*p = '\0';
p = mo; /* month */
for (k = 0; k < 2; ++k)
*p++ = *g++;
*p++ = *d++;
*p = '\0';
p = md; /* day */
for (k = 0; k < 2; ++k)
*p++ = *g++;
*p++ = *d++;
*p = '\0';
p = h; /* hour */
for (k = 0; k < 2; ++k)
*p++ = *g++;
*p++ = *d++;
*p = '\0';
p = mi; /* minutes */
for (k = 0; k < 2; ++k)
*p++ = *g++;
*p++ = *d++;
*p = '\0';
p = s; /* seconds */
for (k = 0; k < 2; ++k)
*p++ = *g++;
*p++ = *d++;
*p = '\0';
lt = getlt();
if (lt) {

View File

@@ -3359,21 +3359,21 @@ retry:
} else if (!strcmpi(bp, "looking glass")) {
; /* avoid false hit on "* glass" */
} else if (!BSTRCMPI(bp, p - 6, " glass") || !strcmpi(bp, "glass")) {
register char *g = bp;
register char *s = bp;
/* treat "broken glass" as a non-existent item; since "broken" is
also a chest/box prefix it might have been stripped off above */
if (broken || strstri(g, "broken"))
if (broken || strstri(s, "broken"))
return (struct obj *) 0;
if (!strncmpi(g, "worthless ", 10))
g += 10;
if (!strncmpi(g, "piece of ", 9))
g += 9;
if (!strncmpi(g, "colored ", 8))
g += 8;
else if (!strncmpi(g, "coloured ", 9))
g += 9;
if (!strcmpi(g, "glass")) { /* choose random color */
if (!strncmpi(s, "worthless ", 10))
s += 10;
if (!strncmpi(s, "piece of ", 9))
s += 9;
if (!strncmpi(s, "colored ", 8))
s += 8;
else if (!strncmpi(s, "coloured ", 9))
s += 9;
if (!strcmpi(s, "glass")) { /* choose random color */
/* 9 different kinds */
typ = LAST_GEM + rnd(9);
if (objects[typ].oc_class == GEM_CLASS)
@@ -3384,7 +3384,7 @@ retry:
char tbuf[BUFSZ];
Strcpy(tbuf, "worthless piece of ");
Strcat(tbuf, g); /* assume it starts with the color */
Strcat(tbuf, s); /* assume it starts with the color */
Strcpy(bp, tbuf);
}
}

View File

@@ -282,7 +282,7 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
which; /* 'h'|'H'|'i'|'I'|'j'|'J' */
{
const char *pnoun;
int g;
int godgend;
char lwhich = lowc(which); /* H,I,J -> h,i,j */
/*
@@ -298,13 +298,13 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
: (lwhich == 'i') ? "them"
: (lwhich == 'j') ? "their" : "?";
} else {
g = (who == 'd') ? quest_status.godgend
godgend = (who == 'd') ? quest_status.godgend
: (who == 'l') ? quest_status.ldrgend
: (who == 'n') ? quest_status.nemgend
: 2; /* default to neuter */
pnoun = (lwhich == 'h') ? genders[g].he
: (lwhich == 'i') ? genders[g].him
: (lwhich == 'j') ? genders[g].his : "?";
pnoun = (lwhich == 'h') ? genders[godgend].he
: (lwhich == 'i') ? genders[godgend].him
: (lwhich == 'j') ? genders[godgend].his : "?";
}
Strcpy(cvt_buf, pnoun);
/* capitalize for H,I,J */

View File

@@ -769,7 +769,7 @@ const struct Align aligns[] = {
static struct {
boolean roles[SIZE(roles)];
short mask;
} rfilter = UNDEFINED_VALUES;
} rfilter = { UNDEFINED_VALUES, UNDEFINED_VALUE};
STATIC_DCL int NDECL(randrole_filtered);
STATIC_DCL char *FDECL(promptsep, (char *, int));
@@ -1757,11 +1757,11 @@ winid where;
not_yet[] = " not yet specified",
rand_choice[] = " random";
char buf[BUFSZ];
int r, c, g, a, allowmask;
int r, c, gend, a, allowmask;
r = flags.initrole;
c = flags.initrace;
g = flags.initgend;
gend = flags.initgend;
a = flags.initalign;
if (r >= 0) {
allowmask = roles[r].allow;
@@ -1770,9 +1770,9 @@ winid where;
else if (c >= 0 && !(allowmask & ROLE_RACEMASK & races[c].allow))
c = ROLE_RANDOM;
if ((allowmask & ROLE_GENDMASK) == ROLE_MALE)
g = 0; /* role forces male (hypothetical) */
gend = 0; /* role forces male (hypothetical) */
else if ((allowmask & ROLE_GENDMASK) == ROLE_FEMALE)
g = 1; /* role forces female (valkyrie) */
gend = 1; /* role forces female (valkyrie) */
if ((allowmask & ROLE_ALIGNMASK) == AM_LAWFUL)
a = 0; /* aligns[lawful] */
else if ((allowmask & ROLE_ALIGNMASK) == AM_NEUTRAL)
@@ -1804,10 +1804,10 @@ winid where;
: roles[r].name.m);
if (r >= 0 && roles[r].name.f) {
/* distinct female name [caveman/cavewoman, priest/priestess] */
if (g == 1)
if (gend == 1)
/* female specified; replace male role name with female one */
Sprintf(index(buf, ':'), ": %s", roles[r].name.f);
else if (g < 0)
else if (gend < 0)
/* gender unspecified; append slash and female role name */
Sprintf(eos(buf), "/%s", roles[r].name.f);
}
@@ -1820,11 +1820,11 @@ winid where;
: races[c].noun);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "gender:");
Strcat(buf, (which == RS_GENDER) ? choosing : (g == ROLE_NONE)
Strcat(buf, (which == RS_GENDER) ? choosing : (gend == ROLE_NONE)
? not_yet
: (g == ROLE_RANDOM)
: (gend == ROLE_RANDOM)
? rand_choice
: genders[g].adj);
: genders[gend].adj);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "alignment:");
Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
@@ -1852,7 +1852,7 @@ boolean preselect;
anything any;
char buf[BUFSZ];
const char *what = 0, *constrainer = 0, *forcedvalue = 0;
int f = 0, r, c, g, a, i, allowmask;
int f = 0, r, c, gend, a, i, allowmask;
r = flags.initrole;
c = flags.initrace;
@@ -1894,16 +1894,16 @@ boolean preselect;
case RS_GENDER:
what = "gender";
f = flags.initgend;
g = ROLE_NONE;
gend = ROLE_NONE;
if (r >= 0) {
allowmask = roles[r].allow & ROLE_GENDMASK;
if (allowmask == ROLE_MALE)
g = 0; /* genders[male] */
gend = 0; /* genders[male] */
else if (allowmask == ROLE_FEMALE)
g = 1; /* genders[female] */
if (g >= 0) {
gend = 1; /* genders[female] */
if (gend >= 0) {
constrainer = "role";
forcedvalue = genders[g].adj;
forcedvalue = genders[gend].adj;
} else if (f >= 0
&& (allowmask & ~rfilter.mask) == genders[f].allow) {
/* if there is only one gender choice available due to user

View File

@@ -810,6 +810,7 @@
3186A3B121A4B0FD0052BF02 /* bitmfile.h */,
3186A36E21A4B0FA0052BF02 /* botl.h */,
3186A38721A4B0FB0052BF02 /* color.h */,
31B8A30A21A20D730055BD01 /* config.h */,
3186A3C621A4B0FE0052BF02 /* config1.h */,
3186A37121A4B0FA0052BF02 /* context.h */,
3186A3C521A4B0FE0052BF02 /* coord.h */,
@@ -901,7 +902,6 @@
3186A36D21A4B0F90052BF02 /* xwindowp.h */,
3186A3BF21A4B0FD0052BF02 /* you.h */,
3186A3A721A4B0FD0052BF02 /* youprop.h */,
31B8A30A21A20D730055BD01 /* config.h */,
);
name = include;
sourceTree = "<group>";