Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Fixed casting bug in array indexing, a signed ...
details: https://anonhg.NetBSD.org/src/rev/d5734bdf049f
branches: trunk
changeset: 502010:d5734bdf049f
user: blymn <blymn%NetBSD.org@localhost>
date: Wed Jan 10 14:02:31 2001 +0000
description:
Fixed casting bug in array indexing, a signed char was being sign
extended when cast to unsigned, made the cast "unsigned char"
diffstat:
lib/libcurses/Makefile | 10 +++++-----
lib/libcurses/getch.c | 12 ++++++------
2 files changed, 11 insertions(+), 11 deletions(-)
diffs (69 lines):
diff -r f17b78f9c826 -r d5734bdf049f lib/libcurses/Makefile
--- a/lib/libcurses/Makefile Wed Jan 10 13:26:52 2001 +0000
+++ b/lib/libcurses/Makefile Wed Jan 10 14:02:31 2001 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: Makefile,v 1.31 2001/01/01 10:36:12 simonb Exp $
+# $NetBSD: Makefile,v 1.32 2001/01/10 14:02:31 blymn Exp $
# @(#)Makefile 8.2 (Berkeley) 1/2/94
CPPFLAGS+=#-DTFILE=\"/dev/ttyp0\"
CPPFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR} -I${.CURDIR}/../libterm
-#.if defined(DEBUG_CURSES)
-#CFLAGS+=-g
-#CPPFLAGS+=-DDEBUG
-#.endif
+.if defined(DEBUG_CURSES)
+CFLAGS+=-g
+CPPFLAGS+=-DDEBUG
+.endif
LIB= curses
SRCS= acs.c addbytes.c addch.c addnstr.c attributes.c background.c bell.c \
border.c box.c clear.c clearok.c clrtobot.c clrtoeol.c color.c \
diff -r f17b78f9c826 -r d5734bdf049f lib/libcurses/getch.c
--- a/lib/libcurses/getch.c Wed Jan 10 13:26:52 2001 +0000
+++ b/lib/libcurses/getch.c Wed Jan 10 14:02:31 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getch.c,v 1.32 2000/09/23 09:34:07 itojun Exp $ */
+/* $NetBSD: getch.c,v 1.33 2001/01/10 14:02:32 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: getch.c,v 1.32 2000/09/23 09:34:07 itojun Exp $");
+__RCSID("$NetBSD: getch.c,v 1.33 2001/01/10 14:02:32 blymn Exp $");
#endif
#endif /* not lint */
@@ -305,9 +305,9 @@
__CTRACE("Adding character %s of type %d, symbol 0x%x\n", unctrl(chr),
key_type, symbol);
#endif
- if (current->mapping[(unsigned) chr] < 0) {
+ if (current->mapping[(unsigned char) chr] < 0) {
/* first time for this char */
- current->mapping[(unsigned) chr] = current->count; /* map new entry */
+ current->mapping[(unsigned char) chr] = current->count; /* map new entry */
/* make sure we have room in the key array first */
if ((current->count & (KEYMAP_ALLOC_CHUNK - 1)) == 0)
{
@@ -360,7 +360,7 @@
#ifdef DEBUG
__CTRACE("Keymap already known\n");
#endif
- the_key = current->key[current->mapping[(unsigned) chr]];
+ the_key = current->key[current->mapping[(unsigned char) chr]];
}
return the_key;
@@ -419,7 +419,7 @@
/* index into the key array - it's
clearer if we stash this */
key_ent = current->mapping[
- (unsigned) entry[j]];
+ (unsigned char) entry[j]];
current->key[key_ent] = tmp_key;
Home |
Main Index |
Thread Index |
Old Index