summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-18 19:38:46 +0000
committerjsm <jsm@NetBSD.org>1999-09-18 19:38:46 +0000
commit623e5e8eddc42ee4e3cff7c418dc2d3d4e96193f (patch)
tree75e04a7aee754535f179cbf6b43570d46e5e75e7
parentfa213838b361bf110cedaa5fd78622fe38c911e2 (diff)
downloadbsdgames-darwin-623e5e8eddc42ee4e3cff7c418dc2d3d4e96193f.tar.gz
bsdgames-darwin-623e5e8eddc42ee4e3cff7c418dc2d3d4e96193f.tar.zst
bsdgames-darwin-623e5e8eddc42ee4e3cff7c418dc2d3d4e96193f.zip
Fix -Wsign-compare warnings.
-rw-r--r--battlestar/com1.c6
-rw-r--r--battlestar/com4.c6
-rw-r--r--boggle/boggle/bog.c6
-rw-r--r--cribbage/io.c6
-rw-r--r--fortune/fortune/fortune.c12
-rw-r--r--fortune/strfile/strfile.c8
-rw-r--r--fortune/unstr/unstr.c6
-rw-r--r--gomoku/pickmove.c8
-rw-r--r--mille/comp.c6
-rw-r--r--phantasia/interplayer.c4
-rw-r--r--pig/pig.c6
-rw-r--r--robots/extern.c6
-rw-r--r--robots/robots.h6
-rw-r--r--robots/score.c9
-rw-r--r--rogue/save.c8
-rw-r--r--tetris/scores.c4
-rw-r--r--trek/main.c7
17 files changed, 58 insertions, 56 deletions
diff --git a/battlestar/com1.c b/battlestar/com1.c
index 4ddebc57..5111236a 100644
--- a/battlestar/com1.c
+++ b/battlestar/com1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com1.c,v 1.8 1999/07/14 17:42:13 hubertf Exp $ */
+/* $NetBSD: com1.c,v 1.9 1999/09/18 19:38:46 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com1.c,v 1.8 1999/07/14 17:42:13 hubertf Exp $");
+__RCSID("$NetBSD: com1.c,v 1.9 1999/09/18 19:38:46 jsm Exp $");
#endif
#endif /* not lint */
@@ -76,7 +76,7 @@ convert(tothis) /* Converts day to night and vice versa. */
* are added */
{ /* at dusk, and subtracted at dawn. */
const struct objs *p;
- int i, j;
+ unsigned int i, j;
if (tothis == TONIGHT) {
for (i = 1; i <= NUMOFROOMS; i++)
diff --git a/battlestar/com4.c b/battlestar/com4.c
index bbc41e49..addce416 100644
--- a/battlestar/com4.c
+++ b/battlestar/com4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com4.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $ */
+/* $NetBSD: com4.c,v 1.8 1999/09/18 19:38:46 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com4.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $");
+__RCSID("$NetBSD: com4.c,v 1.8 1999/09/18 19:38:46 jsm Exp $");
#endif
#endif /* not lint */
@@ -194,7 +194,7 @@ int
throw(name)
const char *name;
{
- int n;
+ unsigned int n;
int deposit = 0;
int first, value;
diff --git a/boggle/boggle/bog.c b/boggle/boggle/bog.c
index b4abde3b..125415a7 100644
--- a/boggle/boggle/bog.c
+++ b/boggle/boggle/bog.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bog.c,v 1.13 1999/09/17 17:07:11 jsm Exp $ */
+/* $NetBSD: bog.c,v 1.14 1999/09/18 19:38:48 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#if 0
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: bog.c,v 1.13 1999/09/17 17:07:11 jsm Exp $");
+__RCSID("$NetBSD: bog.c,v 1.14 1999/09/18 19:38:48 jsm Exp $");
#endif
#endif /* not lint */
@@ -340,7 +340,7 @@ playgame()
showstr(buf, 1);
continue;
}
- if (strlen(buf) < minlength) {
+ if (strlen(buf) < (size_t)minlength) {
badword();
continue;
}
diff --git a/cribbage/io.c b/cribbage/io.c
index 201e2db3..ef0740bf 100644
--- a/cribbage/io.c
+++ b/cribbage/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.12 1999/09/08 21:45:26 jsm Exp $ */
+/* $NetBSD: io.c,v 1.13 1999/09/18 19:38:48 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: io.c,v 1.12 1999/09/08 21:45:26 jsm Exp $");
+__RCSID("$NetBSD: io.c,v 1.13 1999/09/18 19:38:48 jsm Exp $");
#endif
#endif /* not lint */
@@ -498,7 +498,7 @@ do_wait()
{
static const char prompt[] = {'-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0'};
- if (Mpos + sizeof prompt < MSG_X)
+ if ((int)(Mpos + sizeof prompt) < MSG_X)
wmove(Msgwin, Lineno > 0 ? Lineno - 1 : MSG_Y - 1, Mpos);
else {
mvwaddch(Msgwin, Lineno, 0, ' ');
diff --git a/fortune/fortune/fortune.c b/fortune/fortune/fortune.c
index 272c84cb..0becbb17 100644
--- a/fortune/fortune/fortune.c
+++ b/fortune/fortune/fortune.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fortune.c,v 1.19 1999/09/09 17:30:19 jsm Exp $ */
+/* $NetBSD: fortune.c,v 1.20 1999/09/18 19:38:49 jsm Exp $ */
/*-
* Copyright (c) 1986, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 1993\n\
#if 0
static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: fortune.c,v 1.19 1999/09/09 17:30:19 jsm Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.20 1999/09/18 19:38:49 jsm Exp $");
#endif
#endif /* not lint */
@@ -970,7 +970,7 @@ get_fort()
choice = random() % Noprob_tbl.str_numstr;
DPRINTF(1, (stderr, "choice = %d (of %d) \n", choice,
Noprob_tbl.str_numstr));
- while (choice >= fp->tbl.str_numstr) {
+ while ((u_int32_t)choice >= fp->tbl.str_numstr) {
choice -= fp->tbl.str_numstr;
fp = fp->next;
DPRINTF(1, (stderr,
@@ -1022,7 +1022,7 @@ pick_child(parent)
choice = random() % parent->tbl.str_numstr;
DPRINTF(1, (stderr, " choice = %d (of %d)\n",
choice, parent->tbl.str_numstr));
- for (fp = parent->child; choice >= fp->tbl.str_numstr;
+ for (fp = parent->child; (u_int32_t)choice >= fp->tbl.str_numstr;
fp = fp->next) {
choice -= fp->tbl.str_numstr;
DPRINTF(1, (stderr, "\tskip %s, %d (choice = %d)\n",
@@ -1113,7 +1113,7 @@ get_pos(fp)
fp->pos = random() % fp->tbl.str_numstr;
#endif /* OK_TO_WRITE_DISK */
}
- if (++(fp->pos) >= fp->tbl.str_numstr)
+ if ((u_int64_t)++(fp->pos) >= fp->tbl.str_numstr)
fp->pos -= fp->tbl.str_numstr;
DPRINTF(1, (stderr, "pos for %s is %qd\n", fp->name, fp->pos));
}
@@ -1298,7 +1298,7 @@ maxlen_in_list(list)
}
else {
get_tbl(fp);
- if (fp->tbl.str_longlen > maxlen)
+ if (fp->tbl.str_longlen > (u_int32_t)maxlen)
maxlen = fp->tbl.str_longlen;
}
}
diff --git a/fortune/strfile/strfile.c b/fortune/strfile/strfile.c
index 5c8954e1..f8ff4a2f 100644
--- a/fortune/strfile/strfile.c
+++ b/fortune/strfile/strfile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strfile.c,v 1.13 1999/09/10 00:18:21 jsm Exp $ */
+/* $NetBSD: strfile.c,v 1.14 1999/09/18 19:38:50 jsm Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: strfile.c,v 1.13 1999/09/10 00:18:21 jsm Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.14 1999/09/18 19:38:50 jsm Exp $");
#endif
#endif /* not lint */
@@ -198,9 +198,9 @@ main(ac, av)
if (!length)
continue;
add_offset(outf, pos);
- if (Tbl.str_longlen < length)
+ if ((off_t)Tbl.str_longlen < length)
Tbl.str_longlen = length;
- if (Tbl.str_shortlen > length)
+ if ((off_t)Tbl.str_shortlen > length)
Tbl.str_shortlen = length;
first = Oflag;
}
diff --git a/fortune/unstr/unstr.c b/fortune/unstr/unstr.c
index b851c40f..fcd327e9 100644
--- a/fortune/unstr/unstr.c
+++ b/fortune/unstr/unstr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: unstr.c,v 1.6 1999/09/08 21:57:17 jsm Exp $ */
+/* $NetBSD: unstr.c,v 1.7 1999/09/18 19:38:50 jsm Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: unstr.c,v 1.6 1999/09/08 21:57:17 jsm Exp $");
+__RCSID("$NetBSD: unstr.c,v 1.7 1999/09/18 19:38:50 jsm Exp $");
#endif
#endif /* not lint */
@@ -133,7 +133,7 @@ void
order_unstr(tbl)
STRFILE *tbl;
{
- int i;
+ unsigned int i;
char *sp;
off_t pos;
char buf[BUFSIZ];
diff --git a/gomoku/pickmove.c b/gomoku/pickmove.c
index 526043dd..09454d7d 100644
--- a/gomoku/pickmove.c
+++ b/gomoku/pickmove.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pickmove.c,v 1.8 1999/09/09 17:27:58 jsm Exp $ */
+/* $NetBSD: pickmove.c,v 1.9 1999/09/18 19:38:51 jsm Exp $ */
/*
* Copyright (c) 1994
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: pickmove.c,v 1.8 1999/09/09 17:27:58 jsm Exp $");
+__RCSID("$NetBSD: pickmove.c,v 1.9 1999/09/18 19:38:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -323,7 +323,7 @@ scanframes(color)
if (nforce == 0)
memcpy(forcemap, tmpmap, sizeof(tmpmap));
else {
- for (i = 0; i < MAPSZ; i++)
+ for (i = 0; (unsigned int)i < MAPSZ; i++)
forcemap[i] &= tmpmap[i];
}
}
@@ -1038,7 +1038,7 @@ updatecombo(cbp, color)
if (nforce == 0)
memcpy(forcemap, tmpmap, sizeof(tmpmap));
else {
- for (i = 0; i < MAPSZ; i++)
+ for (i = 0; (unsigned int)i < MAPSZ; i++)
forcemap[i] &= tmpmap[i];
}
nforce++;
diff --git a/mille/comp.c b/mille/comp.c
index 02be40f7..531fffd9 100644
--- a/mille/comp.c
+++ b/mille/comp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: comp.c,v 1.6 1999/09/08 21:17:50 jsm Exp $ */
+/* $NetBSD: comp.c,v 1.7 1999/09/18 19:38:52 jsm Exp $ */
/*
* Copyright (c) 1982, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: comp.c,v 1.6 1999/09/08 21:17:50 jsm Exp $");
+__RCSID("$NetBSD: comp.c,v 1.7 1999/09/18 19:38:52 jsm Exp $");
#endif
#endif /* not lint */
@@ -194,7 +194,7 @@ redoit:
diff = End - pp->mileage;
/* avoid getting too close */
if (Topcard > Deck && cango && diff <= 100
- && diff / Value[card] > count[card]
+ && (int)diff / Value[card] > count[card]
&& (card == C_25 || diff % 50 == 0)) {
if (card == C_50 && diff - 50 == 25
&& count[C_25] > 0)
diff --git a/phantasia/interplayer.c b/phantasia/interplayer.c
index 3f215463..993c1621 100644
--- a/phantasia/interplayer.c
+++ b/phantasia/interplayer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: interplayer.c,v 1.5 1999/09/08 21:57:19 jsm Exp $ */
+/* $NetBSD: interplayer.c,v 1.6 1999/09/18 19:38:52 jsm Exp $ */
/*
* interplayer.c - player to player routines for Phantasia
@@ -685,7 +685,7 @@ dotampered()
break;
case '3': /* create energy void */
- if ((loc = allocvoid()) > 20L * SZ_VOIDSTRUCT)
+ if ((loc = allocvoid()) > 20L * (long)SZ_VOIDSTRUCT)
/* can only have 20 void active at once */
mvaddstr(5, 0, "Sorry, void creation limit reached.\n");
else {
diff --git a/pig/pig.c b/pig/pig.c
index 028fe59b..a779ebf0 100644
--- a/pig/pig.c
+++ b/pig/pig.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pig.c,v 1.7 1998/09/13 15:27:29 hubertf Exp $ */
+/* $NetBSD: pig.c,v 1.8 1999/09/18 19:38:53 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)pig.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: pig.c,v 1.7 1998/09/13 15:27:29 hubertf Exp $");
+__RCSID("$NetBSD: pig.c,v 1.8 1999/09/18 19:38:53 jsm Exp $");
#endif
#endif /* not lint */
@@ -80,7 +80,7 @@ main(argc, argv)
for (len = 0; (ch = getchar()) != EOF;) {
if (isalpha(ch)) {
- if (len >= sizeof(buf))
+ if ((size_t)len >= sizeof(buf))
errx(1, "ate too much!");
buf[len++] = ch;
continue;
diff --git a/robots/extern.c b/robots/extern.c
index 395c021b..77d90047 100644
--- a/robots/extern.c
+++ b/robots/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.6 1999/09/08 21:17:57 jsm Exp $ */
+/* $NetBSD: extern.c,v 1.7 1999/09/18 19:38:53 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: extern.c,v 1.6 1999/09/08 21:17:57 jsm Exp $");
+__RCSID("$NetBSD: extern.c,v 1.7 1999/09/18 19:38:53 jsm Exp $");
#endif
#endif /* not lint */
@@ -73,7 +73,7 @@ int Num_robots; /* Number of robots left */
int Num_scrap; /* Number of scrap heaps */
int Num_scores; /* Number of scores posted */
int Num_games; /* Number of games to play */
-int Score; /* Current score */
+u_int32_t Score; /* Current score */
int Start_level = 1; /* Level on which to start */
int Wait_bonus; /* bonus for waiting */
diff --git a/robots/robots.h b/robots/robots.h
index eb93806a..c826133e 100644
--- a/robots/robots.h
+++ b/robots/robots.h
@@ -1,4 +1,4 @@
-/* $NetBSD: robots.h,v 1.12 1999/09/12 09:02:22 jsm Exp $ */
+/* $NetBSD: robots.h,v 1.13 1999/09/18 19:38:54 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -109,9 +109,11 @@ extern bool Pattern_roll, Stand_still;
extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], Run_ch;
extern const char *Next_move, *Move_list;
-extern int Count, Level, Num_robots, Num_scrap, Num_scores, Score,
+extern int Count, Level, Num_robots, Num_scrap, Num_scores,
Start_level, Wait_bonus, Num_games;
+extern u_int32_t Score;
+
extern COORD Max, Min, My_pos, Robots[], Scrap[];
extern jmp_buf End_move;
diff --git a/robots/score.c b/robots/score.c
index ee0b5b18..092b9fdc 100644
--- a/robots/score.c
+++ b/robots/score.c
@@ -1,4 +1,4 @@
-/* $NetBSD: score.c,v 1.10 1999/09/12 09:02:22 jsm Exp $ */
+/* $NetBSD: score.c,v 1.11 1999/09/18 19:38:54 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: score.c,v 1.10 1999/09/12 09:02:22 jsm Exp $");
+__RCSID("$NetBSD: score.c,v 1.11 1999/09/18 19:38:54 jsm Exp $");
#endif
#endif /* not lint */
@@ -121,7 +121,7 @@ score(score_wfd)
{
int inf = score_wfd;
SCORE *scp;
- int uid;
+ u_int32_t uid;
bool done_show = FALSE;
Newscore = FALSE;
@@ -134,8 +134,7 @@ score(score_wfd)
if (Top[MAXSCORES-1].s_score <= Score) {
numscores = 0;
for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- if (scp->s_score < 0 ||
- (scp->s_uid == uid && ++numscores == max_uid)) {
+ if ((scp->s_uid == uid && ++numscores == max_uid)) {
if (scp->s_score > Score)
break;
scp->s_score = Score;
diff --git a/rogue/save.c b/rogue/save.c
index d306d924..8c38a4d4 100644
--- a/rogue/save.c
+++ b/rogue/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.6 1999/09/13 17:19:55 jsm Exp $ */
+/* $NetBSD: save.c,v 1.7 1999/09/18 19:38:54 jsm Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.6 1999/09/13 17:19:55 jsm Exp $");
+__RCSID("$NetBSD: save.c,v 1.7 1999/09/18 19:38:54 jsm Exp $");
#endif
#endif /* not lint */
@@ -375,7 +375,7 @@ r_read(fp, buf, n)
char *buf;
int n;
{
- if (fread(buf, sizeof(char), n, fp) != n) {
+ if (fread(buf, sizeof(char), n, fp) != (size_t)n) {
clean_up("read() failed, don't know why");
}
}
@@ -387,7 +387,7 @@ r_write(fp, buf, n)
int n;
{
if (!write_failed) {
- if (fwrite(buf, sizeof(char), n, fp) != n) {
+ if (fwrite(buf, sizeof(char), n, fp) != (size_t)n) {
message("write() failed, don't know why", 0);
sound_bell();
write_failed = 1;
diff --git a/tetris/scores.c b/tetris/scores.c
index 94342fe3..0d03ae38 100644
--- a/tetris/scores.c
+++ b/tetris/scores.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scores.c,v 1.7 1999/09/17 20:44:51 jsm Exp $ */
+/* $NetBSD: scores.c,v 1.8 1999/09/18 19:38:55 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -202,7 +202,7 @@ savescore(level)
*/
nscores = checkscores(scores, nscores);
rewind(sf);
- if (fwrite(scores, sizeof(*sp), nscores, sf) != nscores ||
+ if (fwrite(scores, sizeof(*sp), nscores, sf) != (size_t)nscores ||
fflush(sf) == EOF)
warnx("error writing %s: %s -- %s\n",
_PATH_SCOREFILE, strerror(errno),
diff --git a/trek/main.c b/trek/main.c
index 5461bcce..eb9f54bc 100644
--- a/trek/main.c
+++ b/trek/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.7 1999/09/12 09:02:24 jsm Exp $ */
+/* $NetBSD: main.c,v 1.8 1999/09/18 19:38:56 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.7 1999/09/12 09:02:24 jsm Exp $");
+__RCSID("$NetBSD: main.c,v 1.8 1999/09/18 19:38:56 jsm Exp $");
#endif
#endif /* not lint */
@@ -54,12 +54,13 @@ __RCSID("$NetBSD: main.c,v 1.7 1999/09/12 09:02:24 jsm Exp $");
#include <unistd.h>
#include <err.h>
#include <time.h>
+#include <sys/types.h>
#include "trek.h"
#include "getpar.h"
# define PRIO 00 /* default priority */
-int Mother = 51 + (51 << 8);
+uid_t Mother = 51 + (51 << 8);
/*
** #### ##### # #### ##### #### ##### # #