decode_mixed()'s return type
decode_mixed() writes its output into a 'char *' buffer that's passed in to it and then returns that buffer. Some excessively paranoid error checking forced to return 'const char *'. Relax that and use 'char *' so callers can work with the result without extra casts.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1550524545 2019/02/18 21:15:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.694 $ */
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1552945074 2019/03/18 21:37:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.695 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1176,7 +1176,7 @@ E boolean FDECL(usmellmon, (struct permonst *));
|
||||
|
||||
E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int));
|
||||
E char *FDECL(encglyph, (int));
|
||||
E const char *FDECL(decode_mixed, (char *,const char *));
|
||||
E char *FDECL(decode_mixed, (char *, const char *));
|
||||
E void FDECL(genl_putmixed, (winid, int, const char *));
|
||||
|
||||
/* ### mcastu.c ### */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1526429201 2018/05/16 00:06:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.47 $ */
|
||||
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1552945095 2019/03/18 21:38:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.48 $ */
|
||||
/* Copyright (c) David Cohrs, 1991 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -249,7 +249,7 @@ int glyph;
|
||||
return encbuf;
|
||||
}
|
||||
|
||||
const char *
|
||||
char *
|
||||
decode_mixed(buf, str)
|
||||
char *buf;
|
||||
const char *str;
|
||||
@@ -257,8 +257,8 @@ const char *str;
|
||||
static const char hex[] = "00112233445566778899aAbBcCdDeEfF";
|
||||
char *put = buf;
|
||||
|
||||
if (!put || !str)
|
||||
return "";
|
||||
if (!str)
|
||||
return strcpy(buf, "");
|
||||
|
||||
while (*str) {
|
||||
if (*str == '\\') {
|
||||
|
||||
Reference in New Issue
Block a user