quiet a number of macosx warnings

This commit is contained in:
nhmall
2019-12-05 11:52:21 -05:00
parent 295e8df01b
commit a701c5870d
17 changed files with 340 additions and 614 deletions

View File

@@ -599,7 +599,7 @@ getbones()
{
int ok, i;
NHFILE *nhfp = (NHFILE *) 0;
char c, *bonesid, oldbonesid[40]; /* was [10]; more should be safer */
char c = 0, *bonesid, oldbonesid[40]; /* was [10]; more should be safer */
if (discover) /* save bones files for real games */
return 0;

View File

@@ -221,7 +221,7 @@ restore_dungeon(nhfp)
NHFILE *nhfp;
{
branch *curr, *last;
int count, i;
int count = 0, i;
mapseen *curr_ms, *last_ms;
if (nhfp->structlevel) {
@@ -808,13 +808,12 @@ init_dungeons()
const char *const dgnaligns[] = { "unaligned", "noalign", "lawful", "neutral", "chaotic", NULL};
const int dgnaligns2i[] = { D_ALIGN_NONE, D_ALIGN_NONE, D_ALIGN_LAWFUL, D_ALIGN_NEUTRAL, D_ALIGN_CHAOTIC, D_ALIGN_NONE };
lua_State *L;
register int i, cl = 0, cb = 0;
register int i, cl = 0;
register s_level *x;
struct proto_dungeon pd;
struct level_map *lev_map;
int tidx;
nhUse(cb);
(void) memset(&pd, 0, sizeof(struct proto_dungeon));
pd.n_levs = pd.n_brs = 0;
@@ -2486,7 +2485,7 @@ static mapseen *
load_mapseen(nhfp)
NHFILE *nhfp;
{
int i, branchnum, brindx;
int i, branchnum = 0, brindx;
mapseen *load;
branch *curr;

View File

@@ -1218,7 +1218,7 @@ rest_engravings(nhfp)
NHFILE *nhfp;
{
struct engr *ep;
unsigned lth;
unsigned lth = 0;
head_engr = 0;
while (1) {

View File

@@ -373,7 +373,7 @@ void
restore_light_sources(nhfp)
NHFILE *nhfp;
{
int count;
int count = 0;
light_source *ls;
/* restore elements */

View File

@@ -1602,7 +1602,7 @@ restore_waterlevel(nhfp)
NHFILE *nhfp;
{
struct bubble *b = (struct bubble *) 0, *btmp;
int i, n;
int i, n = 0;
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz))
return;

View File

@@ -575,7 +575,7 @@ const char *name;
ltyp = lua_type(L, -1);
if (ltyp == LUA_TSTRING) {
const char *const boolstr[] = { "true", "false", "yes", "no", NULL };
const int boolstr2i[] = { TRUE, FALSE, TRUE, FALSE, -1 };
/* const int boolstr2i[] = { TRUE, FALSE, TRUE, FALSE, -1 }; */
ret = luaL_checkoption(L, -1, NULL, boolstr);
nhUse(boolstr2i[0]);
@@ -908,7 +908,7 @@ const char *name;
const char *
get_lua_version()
{
size_t len;
size_t len = (size_t) 0;
const char *vs = (const char *) 0;
lua_State *L;

View File

@@ -339,7 +339,7 @@ restnames(nhfp)
NHFILE *nhfp;
{
int i, j;
unsigned int len;
unsigned int len = 0;
if (nhfp->structlevel) {
mread(nhfp->fd, (genericptr_t) g.bases, sizeof g.bases);

View File

@@ -428,7 +428,7 @@ boolean
in_out_region(x, y)
xchar x, y;
{
int i, f_indx;
int i, f_indx = 0;
/* First check if hero can do the move */
for (i = 0; i < g.n_regions; i++) {
@@ -483,7 +483,7 @@ m_in_out_region(mon, x, y)
struct monst *mon;
xchar x, y;
{
int i, f_indx;
int i, f_indx = 0;
/* First check if mon can do the move */
for (i = 0; i < g.n_regions; i++) {
@@ -752,8 +752,8 @@ NHFILE *nhfp;
boolean ghostly; /* If a bones file restore */
{
int i, j;
unsigned n;
long tmstamp;
unsigned n = 0;
long tmstamp = 0L;
char *msg_buf;
clear_regions(); /* Just for security */

View File

@@ -122,7 +122,7 @@ static void
restlevchn(nhfp)
NHFILE *nhfp;
{
int cnt;
int cnt = 0;
s_level *tmplev, *x;
g.sp_levchn = (s_level *) 0;
@@ -154,7 +154,7 @@ restdamage(nhfp, ghostly)
NHFILE *nhfp;
boolean ghostly;
{
unsigned int dmgcount;
unsigned int dmgcount = 0;
int counter;
struct damage *tmp_dam;
@@ -208,7 +208,7 @@ restobj(nhfp, otmp)
NHFILE *nhfp;
struct obj *otmp;
{
int buflen;
int buflen = 0;
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) otmp, sizeof(struct obj));
@@ -300,7 +300,7 @@ boolean ghostly, frozen;
{
register struct obj *otmp, *otmp2 = 0;
register struct obj *first = (struct obj *) 0;
int buflen;
int buflen = 0;
while (1) {
if (nhfp->structlevel)
@@ -389,7 +389,7 @@ restmon(nhfp, mtmp)
NHFILE *nhfp;
struct monst *mtmp;
{
int buflen;
int buflen = 0;
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) mtmp, sizeof(struct monst));
@@ -491,7 +491,7 @@ boolean ghostly;
{
register struct monst *mtmp, *mtmp2 = 0;
register struct monst *first = (struct monst *) 0;
int offset, buflen;
int offset, buflen = 0;
while (1) {
if (nhfp->structlevel)
@@ -633,7 +633,7 @@ unsigned int *stuckid, *steedid;
struct obj *otmp;
struct obj *bc_obj;
char timebuf[15];
unsigned long uid;
unsigned long uid = 0;
boolean defer_perm_invent;
if (nhfp->fieldlevel && nhfp->addinfo)
@@ -971,7 +971,7 @@ dorecover(nhfp)
NHFILE *nhfp;
{
unsigned int stuckid = 0, steedid = 0; /* not a register */
xchar ltmp;
xchar ltmp = 0;
int rtmp;
struct obj *otmp;
@@ -1126,7 +1126,7 @@ NHFILE *nhfp;
struct cemetery **cemeteryaddr;
{
struct cemetery *bonesinfo, **bonesaddr;
int cflag;
int cflag = 0;
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) &cflag, sizeof cflag);
@@ -1223,8 +1223,8 @@ boolean ghostly;
register struct monst *mtmp;
long elapsed;
branch *br;
int hpid;
xchar dlvl;
int hpid = 0;
xchar dlvl = 0;
int x, y;
#ifdef TOS
short tlev;
@@ -1472,7 +1472,7 @@ static void
restore_msghistory(nhfp)
NHFILE *nhfp;
{
int msgsize, msgcount = 0;
int msgsize = 0, msgcount = 0;
char msg[BUFSZ];
while (1) {

View File

@@ -89,9 +89,9 @@ const char *myparent UNUSED;
const char *myname UNUSED;
int cnt UNUSED;
{
const char *parent = "any";
/* const char *parent = "any"; */
nhUse(parent);
/* nhUse(parent); */
Sprintf(outbuf, "%llx", (unsigned long long) d_any->a_void);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -139,9 +139,11 @@ const char *myname UNUSED;
int cnt UNUSED;
{
int itmp;
#if 0
const char *parent = "aligntyp";
nhUse(parent);
#endif
itmp = (int) *d_aligntyp;
Sprintf(outbuf, "%d", (short) itmp);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -155,9 +157,11 @@ const char *myparent UNUSED;
const char *myname UNUSED;
int cnt UNUSED;
{
#if 0
const char *parent = "bitfield";
nhUse(parent);
#endif
/* for bitfields, cnt is the number of bits, not an array */
Sprintf(outbuf, "%hu", (unsigned short) *d_bitfield);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -172,9 +176,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "boolean";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
if (nhfp->fpdebug)
fprintf(nhfp->fpdebug, "(%s)\n", (*d_boolean) ? "TRUE" : "FALSE");
@@ -193,9 +199,11 @@ const char *myname UNUSED;
int cnt;
{
int i = cnt;
#if 0
const char *parent = "char";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
if (nhfp->fpdebug)
fprintf(nhfp->fpdebug, "(%s)\n", d_char ? d_char : "");
@@ -216,9 +224,11 @@ int cnt;
int i;
unsigned long tmp;
char *byteptr = (char *) d_genericptr;
#if 0
const char *parent = "genericptr";
nhUse(parent);
#endif
/*
* sbrooms is an array of pointers to mkroom.
* That array dimension is MAX_SUBROOMS.
@@ -246,9 +256,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "int";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
Sprintf(outbuf, "%d", *d_int);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -265,9 +277,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "long";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
Sprintf(outbuf, "%ld", *d_long);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -284,9 +298,11 @@ const char *myname UNUSED;
int cnt;
{
int i, itmp;
#if 0
const char *parent = "schar";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
itmp = (int) *d_schar;
Sprintf(outbuf, "%d", itmp);
@@ -304,9 +320,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "short";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
Sprintf(outbuf, "%hd", *d_short);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -323,9 +341,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "size_t";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
unsigned long ul = (unsigned long) *d_size_t;
@@ -343,9 +363,11 @@ const char *myparent UNUSED;
const char *myname UNUSED;
int cnt UNUSED;
{
#if 0
const char *parent = "time_t";
nhUse(parent);
#endif
Sprintf(outbuf, "%s", yyyymmddhhmmss(*d_time_t));
put_savefield(nhfp, outbuf, BUFSZ);
}
@@ -370,9 +392,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "uchar";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
unsigned short us = (unsigned short) *d_uchar;
@@ -391,9 +415,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "uint";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
Sprintf(outbuf, "%u", *d_uint);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -410,9 +436,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "ulong";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
Sprintf(outbuf, "%lu", *d_ulong);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -429,9 +457,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "ushort";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
Sprintf(outbuf, "%hu", *d_ushort);
put_savefield(nhfp, outbuf, BUFSZ);
@@ -448,9 +478,11 @@ const char *myname UNUSED;
int cnt;
{
int i;
#if 0
const char *parent = "xchar";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
short tmp;
@@ -472,10 +504,14 @@ const char *myname UNUSED;
int cnt;
{
int i, j, intval;
#if 0
const char *parent = "str";
#endif
char sval[QBUFSZ], *src = d_str, *dest = strbuf;
#if 0
nhUse(parent);
#endif
/* cnt is the number of characters */
for (i = 0; i < cnt; ++i) {
if ((*src < 32) || (*src == '\\') || (*src > 127)) {
@@ -527,9 +563,11 @@ int cnt UNUSED;
{
char *rstr;
long long tmp;
#if 0
const char *parent = "any";
nhUse(parent);
#endif
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = atoll(rstr);
d_any->a_void = (void *) tmp;
@@ -582,9 +620,11 @@ int cnt UNUSED;
char *rstr;
aligntyp tmp;
long long lltmp;
#if 0
const char *parent = "aligntyp";
nhUse(parent);
#endif
rstr = get_savefield(nhfp, linebuf, BUFSZ);
lltmp = atoll(rstr);
tmp = (aligntyp) lltmp;
@@ -606,9 +646,11 @@ int cnt UNUSED;
{
char *rstr;
uint8_t tmp;
#if 0
const char *parent = "bitfield";
nhUse(parent);
#endif
/* cnt is the number of bits in the bitfield, not an array dimension */
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = (uint8_t) atoi(rstr);
@@ -630,9 +672,11 @@ int cnt;
{
char *rstr;
int i;
#if 0
const char *parent = "boolean";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
#ifdef SAVEFILE_DEBUGGING
@@ -660,9 +704,11 @@ int cnt;
char *rstr;
int i;
char tmp;
#if 0
const char *parent = "char";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = (char) atoi(rstr);
@@ -687,11 +733,15 @@ int cnt;
int i;
long long lltmp;
char *rstr;
#if 0
const char *parent = "genericptr";
#endif
static const char *glorkum = "glorkum";
char *byteptr = (char *) d_genericptr;
#if 0
nhUse(parent);
#endif
/*
* sbrooms is an array of pointers to mkroom.
* That array dimension is MAX_SUBROOMS.
@@ -723,9 +773,11 @@ int cnt;
int i, tmp;
char *rstr;
long long lltmp;
#if 0
const char *parent = "int";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
lltmp = atoll(rstr);
@@ -752,9 +804,11 @@ int cnt;
long tmp;
long long lltmp;
char *rstr;
#if 0
const char *parent = "long";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
lltmp = atoll(rstr);
@@ -780,9 +834,11 @@ int cnt;
int i;
schar tmp;
char *rstr;
#if 0
const char *parent = "schar";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = (schar) atoi(rstr);
@@ -807,9 +863,11 @@ int cnt;
int i;
short tmp;
char *rstr;
#if 0
const char *parent = "short";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = (short) atoi(rstr);
@@ -834,9 +892,11 @@ int cnt;
int i;
size_t tmp;
char *rstr;
#if 0
const char *parent = "size_t";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = (size_t) atol(rstr);
@@ -861,9 +921,11 @@ int cnt UNUSED;
int i;
time_t tmp;
char *rstr;
#if 0
const char *parent = "time_t";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
tmp = time_from_yyyymmddhhmmss(rstr);
@@ -900,9 +962,11 @@ int cnt;
uchar tmp;
int i, itmp;
char *rstr;
#if 0
const char *parent = "uchar";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
itmp = atoi(rstr);
@@ -929,9 +993,11 @@ int cnt;
char *rstr;
unsigned int tmp;
long long lltmp;
#if 0
const char *parent = "uint";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
lltmp = atoll(rstr);
@@ -958,9 +1024,11 @@ int cnt;
unsigned long tmp;
long long lltmp;
char *rstr;
#if 0
const char *parent = "ulong";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
lltmp = atoll(rstr);
@@ -987,9 +1055,11 @@ int cnt;
short tmp;
long long lltmp;
char *rstr;
#if 0
const char *parent = "ushort";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
lltmp = atoll(rstr);
@@ -1015,9 +1085,11 @@ int cnt;
xchar tmp;
int i, itmp;
char *rstr;
#if 0
const char *parent = "xchar";
nhUse(parent);
#endif
for (i = 0; i < cnt; ++i) {
rstr = get_savefield(nhfp, linebuf, BUFSZ);
itmp = atoi(rstr);
@@ -1044,14 +1116,18 @@ int cnt;
{
int i, j, sval;
char n[4], *rstr;
#if 0
const char *parent = "str";
#endif
char *src, *dest;
#ifdef SAVEFILE_DEBUGGING
boolean match;
char testbuf[BUFSZ];
#endif
#if 0
nhUse(parent);
#endif
/* cnt is the length of the string */
rstr = get_savefield(nhfp, strbuf, BUFSZ * 4);
src = rstr;

View File

@@ -5203,7 +5203,7 @@ TODO: g.coder->croom needs to be updated
const int l_or_r2i[] = { LEFT, H_LEFT, CENTER, H_RIGHT, RIGHT, -1, -1 };
const char *const top_or_bot[] = { "top", "center", "bottom", "none", NULL };
const int t_or_b2i[] = { TOP, CENTER, BOTTOM, -1, -1 };
int lr, tb, keepregion = 1, x, y;
int lr, tb, keepregion = 1, x = -1, y = -1;
char *tmps, *mapdata;
int mapwid, maphei = 0;
int argc = lua_gettop(L);

View File

@@ -2383,7 +2383,7 @@ int range;
boolean ghostly; /* restoring from a ghost level */
long adjust; /* how much to adjust timeout */
{
int count;
int count = 0;
timer_element *curr;
if (range == RANGE_GLOBAL) {

View File

@@ -544,7 +544,7 @@ void
rest_worm(nhfp)
NHFILE *nhfp;
{
int i, j, count;
int i, j, count = 0;
struct wseg *curr, *temp;
for (i = 1; i < MAX_NUM_WORMS; i++) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
ReferencedContainer = "container:NetHack.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
ReferencedContainer = "container:NetHack.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
ReferencedContainer = "container:NetHack.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
ReferencedContainer = "container:NetHack.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
ReferencedContainer = "container:NetHack.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
ReferencedContainer = "container:NetHack.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"