Re: CVS commit: src/games/battlestar

2020-02-05 Thread Roy Marples

On 05/02/2020 21:28, Joerg Sonnenberger wrote:

On Wed, Feb 05, 2020 at 08:11:54PM +, Santhosh Raju wrote:

Module Name:src
Committed By:   fox
Date:   Wed Feb  5 20:11:54 UTC 2020

Modified Files:
src/games/battlestar: parse.c

Log Message:
games/battlestar: Fix the -Werror=restrict warning.

Replace strcpy(1) with the safer snprintf(3) which guarantees NULL
termination of strings.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.


This can all use plain memcpy?


And if not memcpy, strlcpy is a better choice for replacing strcpy than 
snprintf.

Roy


Re: CVS commit: src/games/battlestar

2020-02-05 Thread Joerg Sonnenberger
On Wed, Feb 05, 2020 at 08:11:54PM +, Santhosh Raju wrote:
> Module Name:  src
> Committed By: fox
> Date: Wed Feb  5 20:11:54 UTC 2020
> 
> Modified Files:
>   src/games/battlestar: parse.c
> 
> Log Message:
> games/battlestar: Fix the -Werror=restrict warning.
> 
> Replace strcpy(1) with the safer snprintf(3) which guarantees NULL
> termination of strings.
> 
> Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

This can all use plain memcpy?

Joerg


CVS commit: src/games/battlestar

2019-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 29 21:30:42 UTC 2019

Modified Files:
src/games/battlestar: Makefile

Log Message:
Gcc-8 bug confusion with restrict on sh3


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/games/battlestar/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/battlestar/Makefile
diff -u src/games/battlestar/Makefile:1.10 src/games/battlestar/Makefile:1.11
--- src/games/battlestar/Makefile:1.10	Sat Feb  6 18:45:24 2010
+++ src/games/battlestar/Makefile	Tue Oct 29 17:30:42 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2010/02/06 23:45:24 he Exp $
+#	$NetBSD: Makefile,v 1.11 2019/10/29 21:30:42 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 PROG=	battlestar
@@ -12,4 +12,8 @@ LDADD=	-lcurses -lterminfo
 HIDEGAME=hidegame
 SETGIDGAME=yes
 
+.if !empty(MACHINE_ARCH:Msh3*)
+COPTS.parse.c+=-Wno-restrict
+.endif
+
 .include 



CVS commit: src/games/battlestar

2019-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 29 21:30:42 UTC 2019

Modified Files:
src/games/battlestar: Makefile

Log Message:
Gcc-8 bug confusion with restrict on sh3


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/games/battlestar/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/battlestar

2019-10-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 23:34:15 UTC 2019

Modified Files:
src/games/battlestar: room.c

Log Message:
expand the internal consistency checks in truedirec() to avoid
fallthrough cases.  now if direction turns up wrong (it should
not, but this code can't tell that, and convert it to an enum
that would also fix this, is more effort than this is worth.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/battlestar/room.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/battlestar/room.c
diff -u src/games/battlestar/room.c:1.13 src/games/battlestar/room.c:1.14
--- src/games/battlestar/room.c:1.13	Mon May 23 22:44:18 2011
+++ src/games/battlestar/room.c	Sat Oct  5 23:34:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: room.c,v 1.13 2011/05/23 22:44:18 joerg Exp $	*/
+/*	$NetBSD: room.c,v 1.14 2019/10/05 23:34:14 mrg Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)room.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: room.c,v 1.13 2011/05/23 22:44:18 joerg Exp $");
+__RCSID("$NetBSD: room.c,v 1.14 2019/10/05 23:34:14 mrg Exp $");
 #endif
 #endif/* not lint */
 
@@ -129,6 +129,7 @@ truedirec(int way, int option)
 		case WEST:
 			return ("right");
 		}
+		break;
 
 	case SOUTH:
 		switch (direction) {
@@ -142,6 +143,7 @@ truedirec(int way, int option)
 		case WEST:
 			return ("left");
 		}
+		break;
 
 	case EAST:
 		switch (direction) {
@@ -155,6 +157,7 @@ truedirec(int way, int option)
 			return (option == '+' ? "behind you" :
 			"back");
 		}
+		break;
 
 	case WEST:
 		switch (direction) {
@@ -168,12 +171,12 @@ truedirec(int way, int option)
 		case WEST:
 			return ("ahead");
 		}
-
-	default:
-		printf("Error: room %d.  More than four directions wanted.", 
-		position);
-		return ("!!");
+		break;
 	}
+
+	printf("Error: room %d.  More than four directions wanted.", 
+	position);
+	return ("!!");
 }
 
 void



CVS commit: src/games/battlestar

2019-10-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 23:34:15 UTC 2019

Modified Files:
src/games/battlestar: room.c

Log Message:
expand the internal consistency checks in truedirec() to avoid
fallthrough cases.  now if direction turns up wrong (it should
not, but this code can't tell that, and convert it to an enum
that would also fix this, is more effort than this is worth.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/battlestar/room.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.