Some easy loss-of-precision fixes.
This commit is contained in:
+1
-1
@@ -690,7 +690,7 @@ boolean
|
|||||||
bones_include_name(const char *name)
|
bones_include_name(const char *name)
|
||||||
{
|
{
|
||||||
struct cemetery *bp;
|
struct cemetery *bp;
|
||||||
int len;
|
size_t len;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
|
|
||||||
/* prepare buffer by appending terminal hyphen to name, to avoid partial
|
/* prepare buffer by appending terminal hyphen to name, to avoid partial
|
||||||
|
|||||||
+8
-6
@@ -111,7 +111,7 @@ do_statusline2(void)
|
|||||||
time (in moves), varying number of status conditions */
|
time (in moves), varying number of status conditions */
|
||||||
dloc[QBUFSZ], hlth[QBUFSZ], expr[QBUFSZ], tmmv[QBUFSZ], cond[QBUFSZ];
|
dloc[QBUFSZ], hlth[QBUFSZ], expr[QBUFSZ], tmmv[QBUFSZ], cond[QBUFSZ];
|
||||||
register char *nb;
|
register char *nb;
|
||||||
unsigned dln, dx, hln, xln, tln, cln;
|
size_t dln, dx, hln, xln, tln, cln;
|
||||||
int hp, hpmax, cap;
|
int hp, hpmax, cap;
|
||||||
long money;
|
long money;
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ do_statusline2(void)
|
|||||||
} else {
|
} else {
|
||||||
if (dln + 1 + hln + 1 + xln + 1 + tln + 1 + cln + 1 > MAXCO) {
|
if (dln + 1 + hln + 1 + xln + 1 + tln + 1 + cln + 1 > MAXCO) {
|
||||||
panic("bot2: second status line exceeds MAXCO (%u > %d)",
|
panic("bot2: second status line exceeds MAXCO (%u > %d)",
|
||||||
(dln + 1 + hln + 1 + xln + 1 + tln + 1 + cln + 1), MAXCO);
|
(unsigned)(dln + 1 + hln + 1 + xln + 1 + tln + 1 + cln + 1), MAXCO);
|
||||||
} else if ((dln - dx) + 1 + hln + 1 + xln + 1 + cln <= COLNO) {
|
} else if ((dln - dx) + 1 + hln + 1 + xln + 1 + cln <= COLNO) {
|
||||||
Snprintf(newbot2, sizeof(newbot2), "%s %s %s %s %s", dloc, hlth,
|
Snprintf(newbot2, sizeof(newbot2), "%s %s %s %s %s", dloc, hlth,
|
||||||
expr, cond, tmmv);
|
expr, cond, tmmv);
|
||||||
@@ -391,14 +391,15 @@ title_to_mon(const char *str, int *rank_indx, int *title_length)
|
|||||||
void
|
void
|
||||||
max_rank_sz(void)
|
max_rank_sz(void)
|
||||||
{
|
{
|
||||||
register int i, r, maxr = 0;
|
register int i;
|
||||||
|
size_t r, maxr = 0;
|
||||||
for (i = 0; i < 9; i++) {
|
for (i = 0; i < 9; i++) {
|
||||||
if (g.urole.rank[i].m && (r = strlen(g.urole.rank[i].m)) > maxr)
|
if (g.urole.rank[i].m && (r = strlen(g.urole.rank[i].m)) > maxr)
|
||||||
maxr = r;
|
maxr = r;
|
||||||
if (g.urole.rank[i].f && (r = strlen(g.urole.rank[i].f)) > maxr)
|
if (g.urole.rank[i].f && (r = strlen(g.urole.rank[i].f)) > maxr)
|
||||||
maxr = r;
|
maxr = r;
|
||||||
}
|
}
|
||||||
g.mrank_sz = maxr;
|
g.mrank_sz = (int) maxr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2929,7 +2930,8 @@ hlattr2attrname(int attrib, char *buf, int bufsz)
|
|||||||
{
|
{
|
||||||
if (attrib && buf) {
|
if (attrib && buf) {
|
||||||
char attbuf[BUFSZ];
|
char attbuf[BUFSZ];
|
||||||
int k, first = 0;
|
int first = 0;
|
||||||
|
size_t k;
|
||||||
|
|
||||||
attbuf[0] = '\0';
|
attbuf[0] = '\0';
|
||||||
if (attrib == HL_NONE) {
|
if (attrib == HL_NONE) {
|
||||||
@@ -2949,7 +2951,7 @@ hlattr2attrname(int attrib, char *buf, int bufsz)
|
|||||||
Strcat(attbuf, first++ ? "+dim" : "dim");
|
Strcat(attbuf, first++ ? "+dim" : "dim");
|
||||||
|
|
||||||
k = strlen(attbuf);
|
k = strlen(attbuf);
|
||||||
if (k < (bufsz - 1))
|
if (k < (size_t)(bufsz - 1))
|
||||||
Strcpy(buf, attbuf);
|
Strcpy(buf, attbuf);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ NH_panictrace_libc(void)
|
|||||||
{
|
{
|
||||||
#ifdef PANICTRACE_LIBC
|
#ifdef PANICTRACE_LIBC
|
||||||
void *bt[20];
|
void *bt[20];
|
||||||
size_t count, x;
|
int count, x;
|
||||||
char **info, buf[BUFSZ];
|
char **info, buf[BUFSZ];
|
||||||
|
|
||||||
raw_print(" Generating more information you may report:\n");
|
raw_print(" Generating more information you may report:\n");
|
||||||
|
|||||||
+1
-1
@@ -535,7 +535,7 @@ doengrave(void)
|
|||||||
const char *everb; /* Present tense of engraving type */
|
const char *everb; /* Present tense of engraving type */
|
||||||
const char *eloc; /* Where the engraving is (ie dust/floor/...) */
|
const char *eloc; /* Where the engraving is (ie dust/floor/...) */
|
||||||
char *sp; /* Place holder for space count of engr text */
|
char *sp; /* Place holder for space count of engr text */
|
||||||
int len; /* # of nonspace chars of new engraving text */
|
size_t len; /* # of nonspace chars of new engraving text */
|
||||||
struct engr *oep = engr_at(u.ux, u.uy);
|
struct engr *oep = engr_at(u.ux, u.uy);
|
||||||
/* The current engraving */
|
/* The current engraving */
|
||||||
struct obj *otmp; /* Object selected with which to engrave */
|
struct obj *otmp; /* Object selected with which to engrave */
|
||||||
|
|||||||
+1
-1
@@ -3622,7 +3622,7 @@ stackobj(struct obj *obj)
|
|||||||
boolean
|
boolean
|
||||||
mergable(register struct obj *otmp, register struct obj *obj)
|
mergable(register struct obj *otmp, register struct obj *obj)
|
||||||
{
|
{
|
||||||
int objnamelth = 0, otmpnamelth = 0;
|
size_t objnamelth = 0, otmpnamelth = 0;
|
||||||
|
|
||||||
/* fail if already the same object, if different types, if either is
|
/* fail if already the same object, if different types, if either is
|
||||||
explicitly marked to prevent merge, or if not mergable in general */
|
explicitly marked to prevent merge, or if not mergable in general */
|
||||||
|
|||||||
+4
-3
@@ -736,7 +736,8 @@ name_to_monplus(
|
|||||||
register int mntmp = NON_PM;
|
register int mntmp = NON_PM;
|
||||||
register char *s, *str, *term;
|
register char *s, *str, *term;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
int len, slen, mgend, matchgend = -1;
|
int len, mgend, matchgend = -1;
|
||||||
|
size_t slen;
|
||||||
boolean exact_match = FALSE;
|
boolean exact_match = FALSE;
|
||||||
|
|
||||||
if (remainder_p)
|
if (remainder_p)
|
||||||
@@ -866,13 +867,13 @@ name_to_monplus(
|
|||||||
|
|
||||||
m_i_len = (int) strlen(mons[i].pmnames[mgend]);
|
m_i_len = (int) strlen(mons[i].pmnames[mgend]);
|
||||||
if (m_i_len > len && !strncmpi(mons[i].pmnames[mgend], str, m_i_len)) {
|
if (m_i_len > len && !strncmpi(mons[i].pmnames[mgend], str, m_i_len)) {
|
||||||
if (m_i_len == slen) {
|
if (m_i_len == (int) slen) {
|
||||||
mntmp = i;
|
mntmp = i;
|
||||||
len = m_i_len;
|
len = m_i_len;
|
||||||
matchgend = mgend;
|
matchgend = mgend;
|
||||||
exact_match = TRUE;
|
exact_match = TRUE;
|
||||||
break; /* exact match */
|
break; /* exact match */
|
||||||
} else if (slen > m_i_len
|
} else if ((int) slen > m_i_len
|
||||||
&& (str[m_i_len] == ' '
|
&& (str[m_i_len] == ' '
|
||||||
|| !strcmpi(&str[m_i_len], "s")
|
|| !strcmpi(&str[m_i_len], "s")
|
||||||
|| !strncmpi(&str[m_i_len], "s ", 2)
|
|| !strncmpi(&str[m_i_len], "s ", 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user