warning fixups

Non-const string literals.
This commit is contained in:
PatR
2018-11-25 14:31:20 -08:00
parent 457d3a0d26
commit 5226de8c74
5 changed files with 20 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1542798602 2018/11/21 11:10:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.650 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1543185068 2018/11/25 22:31:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.663 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -431,7 +431,8 @@ E struct obj *FDECL(realloc_obj,
(struct obj *, int, genericptr_t, int, const char *));
E char *FDECL(coyotename, (struct monst *, char *));
E char *FDECL(rndorcname, (char *));
E struct monst *FDECL(christen_orc, (struct monst *, char *, char *));
E struct monst *FDECL(christen_orc, (struct monst *, const char *,
const char *));
E const char *FDECL(noveltitle, (int *));
E const char *FDECL(lookup_novel, (const char *, int *));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_name.c $NHDT-Date: 1537477563 2018/09/20 21:06:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.132 $ */
/* NetHack 3.6 do_name.c $NHDT-Date: 1543185069 2018/11/25 22:31:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.136 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2090,19 +2090,21 @@ char *s;
struct monst *
christen_orc(mtmp, gang, other)
struct monst *mtmp;
char *gang, *other;
const char *gang, *other;
{
int sz = 0;
char buf[BUFSZ], buf2[BUFSZ], *orcname;
orcname = rndorcname(buf2);
sz = (int) ((gang ? strlen(gang) : other ? strlen(other) : 0)
+ strlen(orcname) + sizeof " of " - sizeof "");
+ strlen(orcname) + sizeof " of " - sizeof "");
if (sz < BUFSZ) {
char gbuf[BUFSZ];
boolean nameit = FALSE;
if (gang && orcname) {
Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang));
Sprintf(buf, "%s of %s", upstart(orcname),
upstart(strcpy(gbuf, gang)));
nameit = TRUE;
} else if (other && orcname) {
Sprintf(buf, "%s%s", upstart(orcname), other);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dokick.c $NHDT-Date: 1541842623 2018/11/10 09:37:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.122 $ */
/* NetHack 3.6 dokick.c $NHDT-Date: 1543185070 2018/11/25 22:31:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.128 $ */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1704,10 +1704,12 @@ unsigned long deliverflags;
/* special treatment for orcs and their kind */
if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) {
if (!has_mname(mtmp)) {
if (at_crime_scene || (!at_crime_scene && !rn2(2)))
if (at_crime_scene || !rn2(2))
mtmp = christen_orc(mtmp,
at_crime_scene ? ONAME(otmp) : (char *) 0,
" the Fence"); /* bought the stolen goods */
at_crime_scene ? ONAME(otmp)
: (char *) 0,
/* bought the stolen goods */
" the Fence");
}
free_oname(otmp);
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1537477570 2018/09/20 21:06:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.61 $ */
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1543185071 2018/11/25 22:31:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -705,9 +705,10 @@ int otyp;
const char *gang;
{
struct obj *otmp;
otmp = mksobj_migr_to_species(otyp, (unsigned long) M2_ORC, FALSE, FALSE);
if (otmp && gang) {
new_oname(otmp, strlen(gang) + 1); /* removes old name if one is present */
new_oname(otmp, strlen(gang) + 1); /* removes old name if present */
Strcpy(ONAME(otmp), gang);
if (otyp >= TRIPE_RATION && otyp <= TIN) {
if (otyp == SLIME_MOLD)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pager.c $NHDT-Date: 1537477571 2018/09/20 21:06:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.129 $ */
/* NetHack 3.6 pager.c $NHDT-Date: 1543185072 2018/11/25 22:31:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.139 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1397,7 +1397,7 @@ boolean without_asking;
}
if (yes_to_moreinfo) {
int i, subs = 0;
char *gang = (char *) 0;
const char *gang = (char *) 0;
if (bp) {
textp = suptext1;