more warnings

This commit is contained in:
nhmall
2019-11-24 18:01:48 -05:00
parent 5d778f7418
commit 2a187c47c7
3 changed files with 24 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1573940539 2019/11/16 21:42:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.741 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1574636502 2019/11/24 23:01:42 $ $NHDT-Branch: paxed-quest-lua $:$NHDT-Revision: 1.760 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -980,6 +980,7 @@ E void FDECL(strbuf_append, (strbuf_t *, const char *));
E void FDECL(strbuf_reserve, (strbuf_t *, int));
E void FDECL(strbuf_empty, (strbuf_t *));
E void FDECL(strbuf_nl_to_crlf, (strbuf_t *));
E char *FDECL(nonconst, (const char *, char *));
/* ### invent.c ### */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 hacklib.c $NHDT-Date: 1552639487 2019/03/15 08:44:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */
/* NetHack 3.6 hacklib.c $NHDT-Date: 1574636502 2019/11/24 23:01:42 $ $NHDT-Branch: paxed-quest-lua $:$NHDT-Revision: 1.79 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* Copyright (c) Robert Patrick Rankin, 1991 */
@@ -71,6 +71,7 @@
void strbuf_reserve (strbuf *, int)
void strbuf_empty (strbuf *)
void strbuf_nl_to_crlf (strbuf_t *)
char * nonconst (const char *, char *)
=*/
#ifdef LINT
#define Static /* pacify lint */
@@ -1261,4 +1262,19 @@ strbuf_t *strbuf;
}
}
char *
nonconst(str, buf)
const char *str;
char *buf;
{
char *retval = emptystr;
if (str && buf)
if ((int) strlen(str) < BUFSZ - 1) {
Strcpy(buf, str);
retval = buf;
}
return retval;
}
/*hacklib.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1567805254 2019/09/06 21:27:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.117 $ */
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1574636502 2019/11/24 23:01:42 $ $NHDT-Branch: paxed-quest-lua $:$NHDT-Revision: 1.141 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -3373,24 +3373,25 @@ lua_State *L;
spltrap tmptrap;
int x, y;
int argc = lua_gettop(L);
char ncbuf[BUFSZ];
create_des_coder();
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
const char *trapstr = luaL_checkstring(L, 1);
tmptrap.type = get_traptype_byname(trapstr);
tmptrap.type = get_traptype_byname(nonconst(trapstr, ncbuf));
x = y = -1;
} else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING
&& lua_type(L, 2) == LUA_TTABLE) {
const char *trapstr = luaL_checkstring(L, 1);
tmptrap.type = get_traptype_byname(trapstr);
tmptrap.type = get_traptype_byname(nonconst(trapstr, ncbuf));
get_coord(L, 2, &x, &y);
} else if (argc == 3) {
const char *trapstr = luaL_checkstring(L, 1);
tmptrap.type = get_traptype_byname(trapstr);
tmptrap.type = get_traptype_byname(nonconst(trapstr, ncbuf));
x = luaL_checkinteger(L, 2);
y = luaL_checkinteger(L, 3);
} else {