From: nethack.allison Date: Sun, 9 Jul 2006 16:42:21 +0000 (+0000) Subject: another pointer to long conversion (trunk only) X-Git-Tag: MOVE2GIT~951 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dafb1c089ecf2f3b1a538fa529a7834f429a8053;p=nethack another pointer to long conversion (trunk only) 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 --- diff --git a/src/botl.c b/src/botl.c index dcf9ddf0d..915a5cb86 100644 --- a/src/botl.c +++ b/src/botl.c @@ -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"); diff --git a/sys/share/uudecode.c b/sys/share/uudecode.c index b5ef43abd..8da6e714f 100644 --- a/sys/share/uudecode.c +++ b/sys/share/uudecode.c @@ -37,6 +37,10 @@ * 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) {