]> granicus.if.org Git - nethack/commitdiff
another warning fix
authorPatR <rankin@nethack.org>
Tue, 29 Jan 2019 23:18:17 +0000 (15:18 -0800)
committerPatR <rankin@nethack.org>
Tue, 29 Jan 2019 23:18:17 +0000 (15:18 -0800)
Comparison between signed and unsigned.  Compiler stupidity since
the range of possible values that signed 'i' can take is limited and
never negative.

src/rnd.c

index fa8ce0e208d4d8474b64eef96c64068d4308e72e..8f92e42ab24dbab04366d1fb545d3c958bc113c4 100644 (file)
--- a/src/rnd.c
+++ b/src/rnd.c
@@ -17,16 +17,16 @@ struct rnglist_t {
     isaac64_ctx rng_state;
 };
 
-enum {CORE = 0, DISP};
+enum { CORE = 0, DISP = 1 };
 
 static struct rnglist_t rnglist[] = {
-    {rn2, FALSE, {0}},                      /* CORE */
-    {rn2_on_display_rng, FALSE, {0}},       /* DISP */
+    { rn2, FALSE, { 0 } },                      /* CORE */
+    { rn2_on_display_rng, FALSE, { 0 } },       /* DISP */
 };
 
 int
 whichrng(fn)
-int (*fn)(int);
+int FDECL((*fn), (int));
 {
     int i;
 
@@ -39,19 +39,21 @@ int (*fn)(int);
 void
 init_isaac64(seed, fn)
 unsigned long seed;
-int FDECL((*fn),(int));
+int FDECL((*fn), (int));
 {
-    unsigned char new_rng_state[sizeof(seed)];
-    int i, rngindx = whichrng(fn);
+    unsigned char new_rng_state[sizeof seed];
+    unsigned i;
+    int rngindx = whichrng(fn);
 
     if (rngindx < 0)
         panic("Bad rng function passed to init_isaac64().");
 
-    for (i=0; i<sizeof(seed); i++) {
-        new_rng_state[i]= (unsigned char)(seed & 0xFF);
+    for (i = 0; i < sizeof seed; i++) {
+        new_rng_state[i] = (unsigned char) (seed & 0xFF);
         seed >>= 8;
     }
-    isaac64_init(&rnglist[rngindx].rng_state, new_rng_state, sizeof(seed));
+    isaac64_init(&rnglist[rngindx].rng_state, new_rng_state,
+                 (int) sizeof seed);
 }
 
 static int