Module Name:src
Committed By: lukem
Date: Mon Apr 6 12:35:21 UTC 2009
Modified Files:
src/sbin/wsconsctl: keysym.c map_parse.y util.c
Log Message:
fix sign-compare issues
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/wsconsctl/keysym.c
cvs rdiff -u -r1.7 -r1.8 src/sbin/wsconsctl/map_parse.y
cvs rdiff -u -r1.27 -r1.28 src/sbin/wsconsctl/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/wsconsctl/keysym.c
diff -u src/sbin/wsconsctl/keysym.c:1.8 src/sbin/wsconsctl/keysym.c:1.9
--- src/sbin/wsconsctl/keysym.c:1.8 Mon Apr 28 20:23:09 2008
+++ src/sbin/wsconsctl/keysym.c Mon Apr 6 12:35:20 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: keysym.c,v 1.8 2008/04/28 20:23:09 martin Exp $ */
+/* $NetBSD: keysym.c,v 1.9 2009/04/06 12:35:20 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -122,7 +122,7 @@
static void
sort_ksym_tab(void)
{
- int i;
+ size_t i;
for (i = 0; i NUMKSYMS; i++)
ksym_tab_by_ksym[i] = ksym_tab_by_name[i];
Index: src/sbin/wsconsctl/map_parse.y
diff -u src/sbin/wsconsctl/map_parse.y:1.7 src/sbin/wsconsctl/map_parse.y:1.8
--- src/sbin/wsconsctl/map_parse.y:1.7 Mon Apr 28 20:23:09 2008
+++ src/sbin/wsconsctl/map_parse.y Mon Apr 6 12:35:20 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: map_parse.y,v 1.7 2008/04/28 20:23:09 martin Exp $ */
+/* $NetBSD: map_parse.y,v 1.8 2009/04/06 12:35:20 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -63,12 +63,12 @@
struct wskbd_map_data newkbmap; /* used in util.c */
static struct wscons_keymap *cur_mp;
-static int ksym_lookup(keysym_t);
+static size_t ksym_lookup(keysym_t);
-static int
+static size_t
ksym_lookup(keysym_t ksym)
{
- int i;
+ size_t i;
struct wscons_keymap *mp;
for (i = 0; i kbmap.maplen; i++) {
@@ -124,7 +124,7 @@
;
keysym_expr : T_KEYSYM keysym_var = keysym_var = {
- int src, dst;
+ size_t src, dst;
dst = ksym_lookup($2);
src = ksym_lookup($4);
@@ -137,7 +137,7 @@
keycode_expr : T_KEYCODE T_NUMBER = = {
if ($2 = KS_NUMKEYCODES)
errx(EXIT_FAILURE, %d: keycode too large, $2);
- if ($2 = newkbmap.maplen)
+ if ((unsigned int)$2 = newkbmap.maplen)
newkbmap.maplen = $2 + 1;
cur_mp = mapdata + $2;
} keysym_cmd keysym_list
Index: src/sbin/wsconsctl/util.c
diff -u src/sbin/wsconsctl/util.c:1.27 src/sbin/wsconsctl/util.c:1.28
--- src/sbin/wsconsctl/util.c:1.27 Mon Apr 28 20:23:09 2008
+++ src/sbin/wsconsctl/util.c Mon Apr 6 12:35:20 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.27 2008/04/28 20:23:09 martin Exp $ */
+/* $NetBSD: util.c,v 1.28 2009/04/06 12:35:20 lukem Exp $ */
/*-
* Copyright (c) 1998, 2006 The NetBSD Foundation, Inc.
@@ -330,11 +330,12 @@
if (f == 0)
(void)printf(none);
else {
- int i, first, mask;
+ unsigned int i;
+ int first, mask;
for (i = 0, first = 1, mask = 1; i sizeof(f) * 8; i++) {
if (f mask) {
-(void)printf(%s%d, first ? : , i);
+(void)printf(%s%u, first ? : , i);
first = 0;
}
mask = mask 1;
@@ -396,14 +397,14 @@
if (merge) {
if (newkbmap.maplen kbmap.maplen)
newkbmap.maplen = kbmap.maplen;
- for (i = 0; i kbmap.maplen; i++) {
-mp = newkbmap.map + i;
+ for (u = 0; u kbmap.maplen; u++) {
+mp = newkbmap.map + u;
if (mp-command == KS_voidSymbol
mp-group1[0] == KS_voidSymbol
mp-group1[1] == KS_voidSymbol
mp-group2[0] == KS_voidSymbol
mp-group2[1] == KS_voidSymbol)
- *mp = kbmap.map[i];
+ *mp = kbmap.map[u];
}
}
kbmap.maplen = newkbmap.maplen;
@@ -455,7 +456,7 @@
errx(EXIT_FAILURE, %s: not a valid number list, str);
if (errno == ERANGE (lval == LONG_MAX || lval == LONG_MIN))
errx(EXIT_FAILURE, %s: not a valid number list, str);
- if (lval = sizeof(result) * 8)
+ if (lval = (long)sizeof(result) * 8)
errx(EXIT_FAILURE, %ld: number out of range, lval);
result |= (1 lval);
@@ -470,7 +471,7 @@
static void
print_kmap(struct wskbd_map_data *map)
{
- int i;
+ unsigned int i;
struct wscons_keymap *mp;
for (i = 0; i map-maplen; i++) {