From ed516154d881e1948f5ff8888c3d5de64cfbe8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Mon, 12 Jun 2017 12:47:01 +0200 Subject: [PATCH 1/5] fix some warnings --- announce.c | 2 +- game.c | 13 +++++++------ gfx.c | 8 ++++---- gfx.h | 26 +++++++++++++------------- list.c | 2 -- sound.c | 4 ++-- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/announce.c b/announce.c index 12c353d..ce3e63b 100644 --- a/announce.c +++ b/announce.c @@ -279,7 +279,7 @@ int searchgames(void) { avahi_threaded_poll_lock(threaded_poll); - if (NULL == (browser = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, NULL, 0, browse_callback, &gameversion))) { + if (NULL == (browser = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, NULL, 0, browse_callback, NULL))) { fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client))); avahi_threaded_poll_unlock(threaded_poll); return 0; diff --git a/game.c b/game.c index b57c5a0..ab27fda 100644 --- a/game.c +++ b/game.c @@ -468,11 +468,12 @@ static void drawbombs(void) { static void drawflames(void) { flame *fl; int xpos,ypos; - int color; + /* no player specific flame sprites yet */ + /* int color; */ int fig; list_for_each_entry(fl, &activeflames, list) { - color=fl->owner->color; + /* color=fl->owner->color; */ xpos=tovideox(fl->xpos); ypos=tovideoy(fl->ypos); fig=(fl->timer*10)/FLAMELIFE; @@ -747,9 +748,9 @@ static void applybonus(player *pl,bonustile *bonus) { } static void doplayer(player *pl) { - int last; + /* int last; */ int color; - int speed; + /* int speed; */ int px,py; int there; int flags; @@ -763,9 +764,9 @@ static void doplayer(player *pl) { flags=pl->flags; if(flags&FLG_DEAD) return; color=pl->color; - last=pl->doing; + /* last=pl->doing; */ pl->doing=what; - speed=pl->speed; + /* speed=pl->speed; */ px=screentoarrayx(pl->xpos); py=screentoarrayy(pl->ypos); there=field[py][px]; diff --git a/gfx.c b/gfx.c index 42d8d6c..3eb0c14 100644 --- a/gfx.c +++ b/gfx.c @@ -158,12 +158,12 @@ static void gfxfetchsingle(figure *fig,gfxset *gs,int sourcex,int sourcey,int si { uchar *p,*p2; int dx,dy; -uchar *map1; +/* uchar *map1; */ int gswidth; int minx,miny,maxx,maxy; int tx,ty; - map1=gs->gs_inout; + /* map1=gs->gs_inout; */ gswidth=gs->gs_xsize; p=gs->gs_pic+sourcex+gswidth*sourcey; minx=miny=maxx=maxy=-1; @@ -480,7 +480,7 @@ int checkbuttondown(int button) return buttondown & (1< Date: Wed, 15 Sep 2021 15:02:32 +0200 Subject: [PATCH 2/5] use $LDFLAGS in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d28716d..82e02c3 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ override CFLAGS += -D_REENTRANT $(shell sdl-config --cflags) $(DBG) $(WARNFLAGS) all: sdlbomber sdlbomber: announce.o bomber.o draw.o game.o gfx.o sound.o list.o network.o menu.o utils.o - gcc -o $@ $^ $(shell sdl-config --libs) -lavahi-common -lavahi-client $(DBG) + gcc $(LDFLAGS) -o $@ $^ $(shell sdl-config --libs) -lavahi-common -lavahi-client $(DBG) matcher: matcher.c From fc3baeef516dc255100dc2a9b6b71687bd5cf18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Wed, 15 Sep 2021 15:07:35 +0200 Subject: [PATCH 3/5] fix some warnings about buffer sizes --- draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/draw.c b/draw.c index a625051..23cb39f 100644 --- a/draw.c +++ b/draw.c @@ -100,7 +100,7 @@ static int dopcxreal(char *name,gfxset *gs) { sprintf(tname,DATADIR "/%s",name); ihand=open(tname,O_RDONLY); if(ihand<0) { - char tname2[256]; + char tname2[260]; sprintf(tname2,"%s.pcx",tname); ihand=open(tname2,O_RDONLY); if(ihand<0) @@ -386,7 +386,7 @@ void loadgfx() { gfxset *colorgs; int err; int i; - char name[256]; + char name[267]; strcpy(walkingname,"walk"); strcpy(colorsetname,"pal"); From 38de80b9f123762c27a5c97d48a0ce7ccf2e730c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Wed, 15 Sep 2021 15:12:45 +0200 Subject: [PATCH 4/5] use s*n*printf instead of sprintf --- draw.c | 8 ++++---- menu.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/draw.c b/draw.c index 23cb39f..055b89d 100644 --- a/draw.c +++ b/draw.c @@ -97,11 +97,11 @@ static int dopcxreal(char *name,gfxset *gs) { memset(gs,0,sizeof(gfxset)); ileft=0; - sprintf(tname,DATADIR "/%s",name); + snprintf(tname,sizeof(tname),DATADIR "/%s",name); ihand=open(tname,O_RDONLY); if(ihand<0) { char tname2[260]; - sprintf(tname2,"%s.pcx",tname); + snprintf(tname2,sizeof(tname2),"%s.pcx",tname); ihand=open(tname2,O_RDONLY); if(ihand<0) return 1; @@ -258,7 +258,7 @@ static void bigscrprintf(char *str,...) { va_list ap; va_start(ap, str); - vsprintf(output,str,ap); + vsnprintf(output,sizeof(output),str,ap); p=output; for(;;) { p2=p; @@ -407,7 +407,7 @@ void loadgfx() { colorgs=gs+1; for(i=0;i Date: Wed, 15 Sep 2021 15:13:59 +0200 Subject: [PATCH 5/5] fix maxnetnodesconst linker error - no need for typename, certainly no need as variable --- network.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network.h b/network.h index e666429..2cdbbcf 100644 --- a/network.h +++ b/network.h @@ -7,7 +7,7 @@ enum { MAXNETNODES = 8 -} maxnetnodesconst; +}; struct netnode { struct sockaddr_in netname;