From 708a169917a40a057a3dd9d8376708812d67f132 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 11 May 2021 09:24:21 -0400 Subject: [PATCH] =?UTF-8?q?three=20warnings=20building=20with=20gcc=2010?= =?UTF-8?q?=20---=20insight.c:=20In=20function=20=E2=80=98status=5Fenlight?= =?UTF-8?q?enment=E2=80=99:=20insight.c:937:28:=20warning:=20=E2=80=98=20(?= =?UTF-8?q?=E2=80=99=20directive=20writing=202=20bytes=20into=20a=20region?= =?UTF-8?q?=20of=20size=20between=200=20and=20255=20[-Wformat-overflow=3D]?= =?UTF-8?q?=20=20=20937=20|=20=20=20=20=20=20=20=20=20Sprintf(buf,=20"%s?= =?UTF-8?q?=20%s=20(%s)",=20ustick=20=3F=20"holding"=20:=20"held=20by",=20?= =?UTF-8?q?=20=20=20=20=20=20|=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20^~=20In=20file=20incl?= =?UTF-8?q?uded=20from=20../include/config.h:631,=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20from=20../include/hack.h:10,=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20from=20insig?= =?UTF-8?q?ht.c:15:=20../include/global.h:274:24:=20note:=20=E2=80=98sprin?= =?UTF-8?q?tf=E2=80=99=20output=205=20or=20more=20bytes=20(assuming=20260)?= =?UTF-8?q?=20into=20a=20destination=20of=20size=20256=20=20=20274=20|=20#?= =?UTF-8?q?define=20Sprintf=20(void)=20sprintf=20insight.c:937:9:=20note:?= =?UTF-8?q?=20in=20expansion=20of=20macro=20=E2=80=98Sprintf=E2=80=99=20?= =?UTF-8?q?=20=20937=20|=20=20=20=20=20=20=20=20=20Sprintf(buf,=20"%s=20%s?= =?UTF-8?q?=20(%s)",=20ustick=20=3F=20"holding"=20:=20"held=20by",=20=20?= =?UTF-8?q?=20=20=20=20=20|=20=20=20=20=20=20=20=20=20^~~~~~~=20insight.c:?= =?UTF-8?q?918:29:=20warning:=20=E2=80=98%s=E2=80=99=20directive=20writing?= =?UTF-8?q?=20up=20to=20255=20bytes=20into=20a=20region=20of=20size=20252?= =?UTF-8?q?=20[-Wformat-overflow=3D]=20=20=20918=20|=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20Sprintf(buf,=20"%s=20by=20%s",=20=20=20=20=20=20=20|=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20^~=20=20=20919=20|=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20is=5Fanimal(u.ustuck->data)=20=3F=20?= =?UTF-8?q?"swallowed"=20:=20"engulfed",=20=20=20920=20|=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20heldmon);=20=20=20=20=20=20=20?= =?UTF-8?q?|=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20~~~~~~~=20I?= =?UTF-8?q?n=20file=20included=20from=20../include/config.h:631,=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20from=20../include/?= =?UTF-8?q?hack.h:10,=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20from=20insight.c:15:=20../include/global.h:274:24:=20note:?= =?UTF-8?q?=20=E2=80=98sprintf=E2=80=99=20output=205=20or=20more=20bytes?= =?UTF-8?q?=20(assuming=20260)=20into=20a=20destination=20of=20size=20256?= =?UTF-8?q?=20=20=20274=20|=20#define=20Sprintf=20(void)=20sprintf=20insig?= =?UTF-8?q?ht.c:918:9:=20note:=20in=20expansion=20of=20macro=20=E2=80=98Sp?= =?UTF-8?q?rintf=E2=80=99=20=20=20918=20|=20=20=20=20=20=20=20=20=20Sprint?= =?UTF-8?q?f(buf,=20"%s=20by=20%s",=20=20=20=20=20=20=20|=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20^~~~~~~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zap.c:475:1: warning: old-style function definition [-Wold-style-definition] 475 | release_hold() | ^~~~~~~~~~~~ --- src/insight.c | 7 ++++--- src/zap.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/insight.c b/src/insight.c index e185b7f98..44981364f 100644 --- a/src/insight.c +++ b/src/insight.c @@ -915,7 +915,7 @@ status_enlightenment(int mode, int final) Strcpy(heldmon, "an unseen creature"); } 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", heldmon); if (dmgtype(u.ustuck->data, AD_DGST)) { @@ -934,8 +934,9 @@ status_enlightenment(int mode, int final) boolean ustick = (Upolyd && sticks(g.youmonst.data)); int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy; - Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by", - heldmon, dxdy_to_dist_descr(dx, dy, TRUE)); + Snprintf(buf, sizeof buf, "%s %s (%s)", + ustick ? "holding" : "held by", + heldmon, dxdy_to_dist_descr(dx, dy, TRUE)); you_are(buf, ""); } if (Riding) { diff --git a/src/zap.c b/src/zap.c index bbd1e5af8..a226bc3d4 100644 --- a/src/zap.c +++ b/src/zap.c @@ -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 opening/unlocking magic at holder/engulfer/holdee or at self */ void -release_hold() +release_hold(void) { struct monst *mtmp = u.ustuck;