]> granicus.if.org Git - nethack/commitdiff
another pointer to long conversion (trunk only)
authornethack.allison <nethack.allison>
Sun, 9 Jul 2006 16:42:21 +0000 (16:42 +0000)
committernethack.allison <nethack.allison>
Sun, 9 Jul 2006 16:42:21 +0000 (16:42 +0000)
botl.c conversions. All the ports seem to be using genl_status_update(),
rather than a window port specific version, so botl.c was the only place
this had to be adjusted.

Also a uudecode cast for the result of strlen, since it isn't using
config.h

src/botl.c
sys/share/uudecode.c

index dcf9ddf0d8427f759634b591c723edbdb13e0763..915a5cb8654b3cda07bcb68dc4c9da09f60d9b33 100644 (file)
@@ -410,8 +410,8 @@ init_blstats()
                /* ensure initial field values set on blstats[1][i] too */
                blstats[1][i] = blstats[0][i];
 
-               blstats[0][i].a.a_ulong = 0UL;
-               blstats[1][i].a.a_ulong = 0UL;
+               blstats[0][i].a = zeroany;
+               blstats[1][i].a = zeroany;
                if (blstats[0][i].valwidth) {
                    blstats[0][i].val = (char *)alloc(blstats[0][i].valwidth);
                    blstats[1][i].val = (char *)alloc(blstats[0][i].valwidth);
@@ -815,8 +815,8 @@ bot()
                                status_update(i, (genericptr_t)curr->val, chg, pc);
                        } else {
                                status_update(i,
-                                   /* send actual mask, not a pointer to it */
-                                   (genericptr_t) curr->a.a_ulong, chg, 0);
+                                   /* send pointer to mask */
+                                   (genericptr_t) &curr->a.a_ulong, chg, 0);
                        }
                        updated = TRUE;
                }
@@ -1197,30 +1197,30 @@ status_hilite_menu()
                tmpwin = create_nhwindow(NHW_MENU);
                start_menu(tmpwin);
                if (i == BL_CONDITION) {
-                       any.a_void = 0;
+                       any = zeroany;
                        any.a_int = BL_TH_CONDITION + 1;
                        add_menu(tmpwin, NO_GLYPH, &any, 'c', 0,
                                ATR_NONE, "Condition bitmask threshold.",
                                MENU_UNSELECTED);
                }
-               any.a_void = 0;
+               any = zeroany;
                any.a_int = BL_TH_NONE + 1;
                add_menu(tmpwin, NO_GLYPH, &any, 'n', 0,
                        ATR_NONE,"None", MENU_UNSELECTED);
                if (i != BL_CONDITION) {
                        if (blstats[0][i].idxmax > 0) {
-                               any.a_void = 0;
+                               any = zeroany;
                                any.a_int = BL_TH_VAL_PERCENTAGE + 1;
                                add_menu(tmpwin, NO_GLYPH, &any, 'p', 0,
                                        ATR_NONE, "Percentage threshold.",
                                        MENU_UNSELECTED);
                        }
-                       any.a_void = 0;
+                       any = zeroany;
                        any.a_int = BL_TH_UPDOWN + 1;
                        add_menu(tmpwin, NO_GLYPH, &any, 'u', 0,
                                ATR_NONE, "UpDown threshold.",
                                MENU_UNSELECTED);
-                       any.a_void = 0;
+                       any = zeroany;
                        any.a_int = BL_TH_VAL_ABSOLUTE + 1;
                        add_menu(tmpwin, NO_GLYPH, &any, 'v', 0,
                                ATR_NONE,"Value threshold.",
@@ -1275,7 +1275,7 @@ status_hilite_menu()
                    start_menu(tmpwin);
                    for (k = -3; k < CLR_MAX; ++k) {
 /*                     if (k == -1) continue; */
-                       any.a_void = 0;
+                       any = zeroany;
                        any.a_int = (k >= 0) ? k + 1 : k;
                        if (k > 0) add_menu(tmpwin, NO_GLYPH, &any, 0, 0,
                                                ATR_NONE, c_obj_colors[k],
@@ -1389,7 +1389,7 @@ int idx, chg, percent;
 genericptr_t ptr;
 {
        char newbot1[MAXCO], newbot2[MAXCO];
-       long cond;
+       long cond, *condptr = (long *)ptr;
        register int i;
        char *text = (char *)ptr;
        int fieldorder1[] = {
@@ -1406,7 +1406,7 @@ genericptr_t ptr;
            if (!activefields[idx]) return;
            switch(idx) {
                case BL_CONDITION:
-                       cond = (long)ptr;
+                       cond = *condptr;
                        *vals[idx] = '\0';
                        if (cond & BL_MASK_BLIND) Strcat(vals[idx], " Blind");
                        if (cond & BL_MASK_CONF) Strcat(vals[idx], " Conf");
index b5ef43abd5f75e89053b7e72e897302be5d00b71..8da6e714fc50055873c240b0d8147e2994eda755 100644 (file)
  * appear to be stripping trailing blanks.
  *
  * Modified 28 February 2002 for use on WIN32 systems with Microsoft C.
+ *
+ * Modified 08 July 2006 to cast strlen() result to int to suppress a
+ * warning on platforms where size_t > sizeof(int).
+ *
  */
 
 #ifndef lint
@@ -192,7 +196,7 @@ FILE *out;
 
                /* Calculate expected # of chars and pad if necessary */
                expected = ((n+2)/3)<<2;
-               for (i = strlen(buf)-1; i <= expected; i++) buf[i] = ' ';
+               for (i = (int)strlen(buf)-1; i <= expected; i++) buf[i] = ' ';
 
                bp = &buf[1];
                while (n > 0) {