Source-Changes-HG archive

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

[src/trunk]: src/sys/netkey Use unsigned char * variables when scanning buffe...



details:   https://anonhg.NetBSD.org/src/rev/df3a2298d925
branches:  trunk
changeset: 570817:df3a2298d925
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Oct 30 08:22:40 2004 +0000

description:
Use unsigned char * variables when scanning buffer - saves casts and & 0xff

diffstat:

 sys/netkey/key_debug.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (39 lines):

diff -r e908a3867c0c -r df3a2298d925 sys/netkey/key_debug.c
--- a/sys/netkey/key_debug.c    Sat Oct 30 08:19:30 2004 +0000
+++ b/sys/netkey/key_debug.c    Sat Oct 30 08:22:40 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key_debug.c,v 1.29 2004/10/29 19:31:04 dsl Exp $       */
+/*     $NetBSD: key_debug.c,v 1.30 2004/10/30 08:22:40 dsl Exp $       */
 /*     $KAME: key_debug.c,v 1.36 2003/06/27 06:46:01 itojun Exp $      */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.29 2004/10/29 19:31:04 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.30 2004/10/30 08:22:40 dsl Exp $");
 
 #ifdef _KERNEL
 #include "opt_inet.h"
@@ -342,15 +342,15 @@
 #ifdef _KERNEL
                        ipsec_hexdump((caddr_t)(id + 1), len); /*XXX cast ?*/
 #else
-                       char *p, *ep;
+                       unsigned char *p, *ep;
                        printf("\n  str=\"");
-                       p = (char *)(id + 1);
+                       p = (void *)(id + 1);
                        ep = p + len;
                        for (/*nothing*/; *p && p < ep; p++) {
-                               if (isprint((unsigned char)*p))
-                                       printf("%c", *p & 0xff);
+                               if (isprint(*p))
+                                       printf("%c", *p);
                                else
-                                       printf("\\%03o", *p & 0xff);
+                                       printf("\\%03o", *p);
                        }
 #endif
                        printf("\"");



Home | Main Index | Thread Index | Old Index