Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/hunt/hunt When indexing an array with a char, cast it ...



details:   https://anonhg.NetBSD.org/src/rev/95d001fe97ee
branches:  trunk
changeset: 328274:95d001fe97ee
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Mar 30 02:11:25 2014 +0000

description:
When indexing an array with a char, cast it to unsigned char, not int,
to not only silence the compiler warning but also get the correct
behavior.

diffstat:

 games/hunt/hunt/playit.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 797a05816121 -r 95d001fe97ee games/hunt/hunt/playit.c
--- a/games/hunt/hunt/playit.c  Sun Mar 30 01:44:37 2014 +0000
+++ b/games/hunt/hunt/playit.c  Sun Mar 30 02:11:25 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: playit.c,v 1.18 2014/03/29 21:24:26 dholland Exp $     */
+/*     $NetBSD: playit.c,v 1.19 2014/03/30 02:11:25 dholland Exp $     */
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: playit.c,v 1.18 2014/03/29 21:24:26 dholland Exp $");
+__RCSID("$NetBSD: playit.c,v 1.19 2014/03/30 02:11:25 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/file.h>
@@ -261,7 +261,7 @@
        Buf[count] = '\0';
        nsp = inp;
        for (sp = Buf; *sp != '\0'; sp++)
-               if ((*nsp = map_key[(int)*sp]) == 'q')
+               if ((*nsp = map_key[(unsigned char)*sp]) == 'q')
                        intr(0);
                else
                        nsp++;



Home | Main Index | Thread Index | Old Index