three warnings building with gcc 10
---
insight.c: In function ‘status_enlightenment’:
insight.c:937:28: warning: ‘ (’ directive writing 2 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
937 | Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
| ^~
In file included from ../include/config.h:631,
from ../include/hack.h:10,
from insight.c:15:
../include/global.h:274:24: note: ‘sprintf’ output 5 or more bytes (assuming 260) into a destination of size 256
274 | #define Sprintf (void) sprintf
insight.c:937:9: note: in expansion of macro ‘Sprintf’
937 | Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
| ^~~~~~~
insight.c:918:29: warning: ‘%s’ directive writing up to 255 bytes into a region of size 252 [-Wformat-overflow=]
918 | Sprintf(buf, "%s by %s",
| ^~
919 | is_animal(u.ustuck->data) ? "swallowed" : "engulfed",
920 | heldmon);
| ~~~~~~~
In file included from ../include/config.h:631,
from ../include/hack.h:10,
from insight.c:15:
../include/global.h:274:24: note: ‘sprintf’ output 5 or more bytes (assuming 260) into a destination of size 256
274 | #define Sprintf (void) sprintf
insight.c:918:9: note: in expansion of macro ‘Sprintf’
918 | Sprintf(buf, "%s by %s",
| ^~~~~~~
---
zap.c:475:1: warning: old-style function definition [-Wold-style-definition]
475 | release_hold()
| ^~~~~~~~~~~~
This commit is contained in:
+4
-3
@@ -915,7 +915,7 @@ status_enlightenment(int mode, int final)
|
|||||||
Strcpy(heldmon, "an unseen creature");
|
Strcpy(heldmon, "an unseen creature");
|
||||||
}
|
}
|
||||||
if (u.uswallow) { /* implies u.ustuck is non-Null */
|
if (u.uswallow) { /* implies u.ustuck is non-Null */
|
||||||
Sprintf(buf, "%s by %s",
|
Snprintf(buf, sizeof buf, "%s by %s",
|
||||||
is_animal(u.ustuck->data) ? "swallowed" : "engulfed",
|
is_animal(u.ustuck->data) ? "swallowed" : "engulfed",
|
||||||
heldmon);
|
heldmon);
|
||||||
if (dmgtype(u.ustuck->data, AD_DGST)) {
|
if (dmgtype(u.ustuck->data, AD_DGST)) {
|
||||||
@@ -934,8 +934,9 @@ status_enlightenment(int mode, int final)
|
|||||||
boolean ustick = (Upolyd && sticks(g.youmonst.data));
|
boolean ustick = (Upolyd && sticks(g.youmonst.data));
|
||||||
int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy;
|
int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy;
|
||||||
|
|
||||||
Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
|
Snprintf(buf, sizeof buf, "%s %s (%s)",
|
||||||
heldmon, dxdy_to_dist_descr(dx, dy, TRUE));
|
ustick ? "holding" : "held by",
|
||||||
|
heldmon, dxdy_to_dist_descr(dx, dy, TRUE));
|
||||||
you_are(buf, "");
|
you_are(buf, "");
|
||||||
}
|
}
|
||||||
if (Riding) {
|
if (Riding) {
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ bhitm(struct monst *mtmp, struct obj *otmp)
|
|||||||
/* hero is held by a monster or engulfed or holding a monster and has zapped
|
/* hero is held by a monster or engulfed or holding a monster and has zapped
|
||||||
opening/unlocking magic at holder/engulfer/holdee or at self */
|
opening/unlocking magic at holder/engulfer/holdee or at self */
|
||||||
void
|
void
|
||||||
release_hold()
|
release_hold(void)
|
||||||
{
|
{
|
||||||
struct monst *mtmp = u.ustuck;
|
struct monst *mtmp = u.ustuck;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user