E int FDECL(use_container, (struct obj *,int));
E int FDECL(loot_mon, (struct monst *,int *,boolean *));
E int NDECL(dotip);
-E char *FDECL(safe_qbuf, (char *,unsigned,char *,char *,char *));
+E const char *FDECL(safe_qbuf, (const char *,unsigned,
+ const char *,const char *,const char *));
/* ### pline.c ### */
* finally using the fallback as a last resort.
* last_restort is expected to be very short.
*/
-char *
+const char *
safe_qbuf(qbuf, padlength, planA, planB, last_resort)
-char *qbuf, *planA, *planB, *last_resort;
+const char *qbuf, *planA, *planB, *last_resort;
unsigned padlength;
{
- unsigned textleft = QBUFSZ - (strlen(qbuf) + padlength);
- if (strlen(last_resort) >= textleft) {
- impossible("safe_qbuf: last_resort too large at %d characters.",
- strlen(last_resort));
- return "";
- }
- return (strlen(planA) < textleft) ? planA :
- (strlen(planB) < textleft) ? planB : last_resort;
+ /* convert size_t (or int for ancient systems) to ordinary unsigned */
+ unsigned len_qbuf = (unsigned)strlen(qbuf),
+ len_planA = (unsigned)strlen(planA),
+ len_planB = (unsigned)strlen(planB),
+ len_lastR = (unsigned)strlen(last_resort);
+ unsigned textleft = QBUFSZ - (len_qbuf + padlength);
+
+ if (len_lastR >= textleft) {
+ impossible("safe_qbuf: last_resort too large at %u characters.",
+ len_lastR);
+ return "";
+ }
+ return (len_planA < textleft) ? planA :
+ (len_planB < textleft) ? planB : last_resort;
}
/*
}
#endif
crawl_ok = FALSE;
+ x = y = 0; /* lint suppression */
/* if sleeping, wake up now so that we don't crawl out of water
while still asleep; we can't do that the same way that waking
due to combat is handled; note unmul() clears u.usleep */