safe_qbuf arguments

Pat's compiler triggered a warning because safe_qbuf
is declared as `char *' but might return `last_resort'
which is `const char *'.
This commit is contained in:
nethack.allison
2003-05-10 16:21:12 +00:00
parent f32ad24709
commit 0f7508090d
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1481,7 +1481,7 @@ E int NDECL(doloot);
E int FDECL(use_container, (struct obj *,int)); E int FDECL(use_container, (struct obj *,int));
E int FDECL(loot_mon, (struct monst *,int *,boolean *)); E int FDECL(loot_mon, (struct monst *,int *,boolean *));
E int NDECL(dotip); E int NDECL(dotip);
E char *FDECL(safe_qbuf, (char *,unsigned,char *,char *,const char *)); E char *FDECL(safe_qbuf, (char *,unsigned,char *,char *,char *));
/* ### pline.c ### */ /* ### pline.c ### */
+3 -4
View File
@@ -540,7 +540,7 @@ menu_pickup:
char qbuf[BUFSZ]; char qbuf[BUFSZ];
Sprintf(qbuf, "Pick up %s?", Sprintf(qbuf, "Pick up %s?",
safe_qbuf("", sizeof("Pick up ?"), doname(obj), safe_qbuf("", sizeof("Pick up ?"), doname(obj),
an(simple_typename(obj->otyp)), something)); an(simple_typename(obj->otyp)), "something"));
switch ((obj->quan < 2L) ? ynaq(qbuf) : ynNaq(qbuf)) { switch ((obj->quan < 2L) ? ynaq(qbuf) : ynNaq(qbuf)) {
case 'q': goto end_query; /* out 2 levels */ case 'q': goto end_query; /* out 2 levels */
case 'n': continue; case 'n': continue;
@@ -1132,7 +1132,7 @@ boolean telekinesis;
moderateloadmsg); moderateloadmsg);
Sprintf(eos(qbuf), " %s. Continue?", Sprintf(eos(qbuf), " %s. Continue?",
safe_qbuf(qbuf, sizeof(" . Continue?"), safe_qbuf(qbuf, sizeof(" . Continue?"),
doname(obj), an(simple_typename(obj->otyp)), something)); doname(obj), an(simple_typename(obj->otyp)), "something"));
obj->quan = savequan; obj->quan = savequan;
switch (ynq(qbuf)) { switch (ynq(qbuf)) {
case 'q': result = -1; break; case 'q': result = -1; break;
@@ -1156,8 +1156,7 @@ boolean telekinesis;
*/ */
char * char *
safe_qbuf(qbuf, padlength, planA, planB, last_resort) safe_qbuf(qbuf, padlength, planA, planB, last_resort)
char *qbuf, *planA, *planB; char *qbuf, *planA, *planB, *last_resort;
const char *last_resort;
unsigned padlength; unsigned padlength;
{ {
unsigned textleft = QBUFSZ - (strlen(qbuf) + padlength); unsigned textleft = QBUFSZ - (strlen(qbuf) + padlength);