Module Name:    src
Committed By:   christos
Date:           Thu Aug 18 02:18:41 UTC 2011

Modified Files:
        src/sys/dev/adb: adb_kbd.c adb_ms.c

Log Message:
Fix gcc-4.5 warnings. If you still see them, e-mail them to me.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/adb/adb_ms.c

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

Modified files:

Index: src/sys/dev/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.14 src/sys/dev/adb/adb_kbd.c:1.15
--- src/sys/dev/adb/adb_kbd.c:1.14	Thu Jul 28 12:28:12 2011
+++ src/sys/dev/adb/adb_kbd.c	Wed Aug 17 22:18:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.14 2011/07/28 16:28:12 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.15 2011/08/18 02:18:40 christos Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.14 2011/07/28 16:28:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.15 2011/08/18 02:18:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -667,14 +667,14 @@
 	       CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 
 	ret = sysctl_createv(NULL, 0, NULL,
-	    (const struct sysctlnode **)&node, 
+	    (void *)&node, 
 	    CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
 	    CTLTYPE_INT, "middle", "middle mouse button", adbkbd_sysctl_mid, 
 		    1, sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
 		    CTL_EOL);
 
 	ret = sysctl_createv(NULL, 0, NULL, 
-	    (const struct sysctlnode **)&node, 
+	    (void *)&node, 
 	    CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
 	    CTLTYPE_INT, "right", "right mouse button", adbkbd_sysctl_right, 
 		    2, sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.11 src/sys/dev/adb/adb_ms.c:1.12
--- src/sys/dev/adb/adb_ms.c:1.11	Mon Aug  1 08:28:53 2011
+++ src/sys/dev/adb/adb_ms.c	Wed Aug 17 22:18:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.11 2011/08/01 12:28:53 mbalmer Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.12 2011/08/18 02:18:40 christos Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.11 2011/08/01 12:28:53 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.12 2011/08/18 02:18:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -179,17 +179,17 @@
 	/* print out the type of mouse we have */
 	switch (sc->sc_adbdev->handler_id) {
 	case ADBMS_100DPI:
-		printf("%d-button, %d dpi mouse\n", sc->sc_buttons,
-		    (int)(sc->sc_res));
+		printf("%d-button, %u dpi mouse\n", sc->sc_buttons,
+		    sc->sc_res);
 		break;
 	case ADBMS_200DPI:
 		sc->sc_res = 200;
-		printf("%d-button, %d dpi mouse\n", sc->sc_buttons,
-		    (int)(sc->sc_res));
+		printf("%d-button, %u dpi mouse\n", sc->sc_buttons,
+		    sc->sc_res);
 		break;
 	case ADBMS_MSA3:
-		printf("Mouse Systems A3 mouse, %d-button, %d dpi\n",
-		    sc->sc_buttons, (int)(sc->sc_res));
+		printf("Mouse Systems A3 mouse, %d-button, %u dpi\n",
+		    sc->sc_buttons, sc->sc_res);
 		break;
 	case ADBMS_USPEED:
 		printf("MicroSpeed mouse, default parameters\n");
@@ -235,8 +235,8 @@
 				printf("unknown device");
 				break;
 			}
-			printf(" <%s> %d-button, %d dpi\n", sc->sc_devid,
-			    sc->sc_buttons, (int)(sc->sc_res));
+			printf(" <%s> %d-button, %u dpi\n", sc->sc_devid,
+			    sc->sc_buttons, sc->sc_res);
 		}
 		break;
 	default:
@@ -390,6 +390,7 @@
 		memcpy(buffer, sc->sc_buffer, len);
 
 		if (sc->sc_msg_len == 8) {
+			uint16_t res;
 			/* we have a true EMP device */
 #ifdef ADB_PRINT_EMP
 		
@@ -397,10 +398,11 @@
 			    buffer[0], buffer[1], buffer[2], buffer[3],
 			    buffer[4], buffer[5], buffer[6], buffer[7]);
 #endif
+			memcpy(sc->sc_devid, &buffer[0], 4);
+			memcpy(&res, &buffer[4], sizeof(res));
+			sc->sc_res = res;
 			sc->sc_class = buffer[6];
 			sc->sc_buttons = buffer[7];
-			sc->sc_res = (int)*(short *)&buffer[4];
-				memcpy(sc->sc_devid, &(buffer[0]), 4);
 		} else if (buffer[0] == 0x9a &&
 		    ((buffer[1] == 0x20) || (buffer[1] == 0x21))) {
 			/*

Reply via email to