From 72ec57ac5372e00a359ed5e700cafa9f59151d04 Mon Sep 17 00:00:00 2001 From: niklas Date: Sun, 8 Dec 1996 14:25:46 +0000 Subject: [PATCH] -Wcast-qual happiness --- sys/compat/common/compat_util.c | 5 ++-- sys/kern/tty.c | 8 ++--- sys/lib/libkern/bcmp.c | 10 +++---- sys/lib/libkern/strcmp.c | 4 +-- sys/lib/libkern/strncmp.c | 4 +-- sys/scsi/ss_scanjet.c | 10 +++++-- sys/sys/namei.h | 4 +-- sys/sys/systm.h | 52 ++++++++++++++++----------------- 8 files changed, 50 insertions(+), 47 deletions(-) diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c index 58425111887..89cba00ae75 100644 --- a/sys/compat/common/compat_util.c +++ b/sys/compat/common/compat_util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat_util.c,v 1.4 1996/04/18 21:21:32 niklas Exp $ */ +/* $OpenBSD: compat_util.c,v 1.5 1996/12/08 14:25:46 niklas Exp $ */ /* $NetBSD: compat_util.c,v 1.4 1996/03/14 19:31:45 christos Exp $ */ /* @@ -129,8 +129,7 @@ emul_find(p, sgp, prefix, path, pbuf, cflag) * to the emulation root directory. This is expensive :-( */ /* XXX: prototype should have const here for NDINIT */ - NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, - (char *) prefix, p); + NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix, p); if ((error = namei(&ndroot)) != 0) goto bad2; diff --git a/sys/kern/tty.c b/sys/kern/tty.c index f6fb3acec5b..9d698fccd82 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.19 1996/11/11 04:28:16 tholo Exp $ */ +/* $OpenBSD: tty.c,v 1.20 1996/12/08 14:25:48 niklas Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -106,7 +106,7 @@ char ttyout[] = "ttyout"; #define TB TAB #define VT VTAB -char const char_type[] = { +u_char const char_type[] = { E|CC, O|CC, O|CC, E|CC, O|CC, E|CC, E|CC, O|CC, /* nul - bel */ O|BS, E|TB, E|NL, O|CC, E|VT, O|CR, O|CC, E|CC, /* bs - si */ O|CC, E|CC, E|CC, O|CC, E|CC, O|CC, O|CC, E|CC, /* dle - etb */ @@ -1557,8 +1557,8 @@ loop: if (!ISSET(tp->t_oflag, OPOST)) ce = cc; else { - ce = cc - scanc((u_int)cc, cp, - (u_char *)char_type, CCLASSMASK); + ce = cc - scanc((u_int)cc, cp, char_type, + CCLASSMASK); /* * If ce is zero, then we're processing * a special character through ttyoutput. diff --git a/sys/lib/libkern/bcmp.c b/sys/lib/libkern/bcmp.c index 53b867e557b..68aff5a5ed8 100644 --- a/sys/lib/libkern/bcmp.c +++ b/sys/lib/libkern/bcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcmp.c,v 1.3 1996/05/01 15:18:45 deraadt Exp $ */ +/* $OpenBSD: bcmp.c,v 1.4 1996/12/08 14:25:49 niklas Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. @@ -35,7 +35,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)bcmp.c 5.6 (Berkeley) 2/24/91";*/ -static char *rcsid = "$OpenBSD: bcmp.c,v 1.3 1996/05/01 15:18:45 deraadt Exp $"; +static char *rcsid = "$OpenBSD: bcmp.c,v 1.4 1996/12/08 14:25:49 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #ifndef _KERNEL @@ -52,12 +52,12 @@ bcmp(b1, b2, length) const void *b1, *b2; register size_t length; { - register char *p1, *p2; + register const char *p1, *p2; if (length == 0) return(0); - p1 = (char *)b1; - p2 = (char *)b2; + p1 = (const char *)b1; + p2 = (const char *)b2; do if (*p1++ != *p2++) break; diff --git a/sys/lib/libkern/strcmp.c b/sys/lib/libkern/strcmp.c index 9dd06cb389e..78449ab0a32 100644 --- a/sys/lib/libkern/strcmp.c +++ b/sys/lib/libkern/strcmp.c @@ -36,7 +36,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strcmp.c 5.5 (Berkeley) 1/26/91";*/ -static char *rcsid = "$Id: strcmp.c,v 1.2 1996/05/01 15:18:49 deraadt Exp $"; +static char *rcsid = "$Id: strcmp.c,v 1.3 1996/12/08 14:25:49 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #ifndef _KERNEL @@ -55,5 +55,5 @@ strcmp(s1, s2) while (*s1 == *s2++) if (*s1++ == 0) return (0); - return (*(unsigned char *)s1 - *(unsigned char *)--s2); + return (*(const u_char *)s1 - *(const u_char *)--s2); } diff --git a/sys/lib/libkern/strncmp.c b/sys/lib/libkern/strncmp.c index 0a88e080488..60756ccc4d7 100644 --- a/sys/lib/libkern/strncmp.c +++ b/sys/lib/libkern/strncmp.c @@ -33,7 +33,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strncmp.c 5.6 (Berkeley) 1/26/91";*/ -static char *rcsid = "$Id: strncmp.c,v 1.2 1996/05/01 15:18:52 deraadt Exp $"; +static char *rcsid = "$Id: strncmp.c,v 1.3 1996/12/08 14:25:49 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #ifndef _KERNEL @@ -52,7 +52,7 @@ strncmp(s1, s2, n) return (0); do { if (*s1 != *s2++) - return (*(unsigned char *)s1 - *(unsigned char *)--s2); + return (*(const u_char *)s1 - *(const u_char *)--s2); if (*s1++ == 0) break; } while (--n != 0); diff --git a/sys/scsi/ss_scanjet.c b/sys/scsi/ss_scanjet.c index a4142aa3c54..5e794d03f47 100644 --- a/sys/scsi/ss_scanjet.c +++ b/sys/scsi/ss_scanjet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ss_scanjet.c,v 1.13 1996/11/23 06:05:02 kstailey Exp $ */ +/* $OpenBSD: ss_scanjet.c,v 1.14 1996/12/08 14:25:50 niklas Exp $ */ /* $NetBSD: ss_scanjet.c,v 1.6 1996/05/18 22:58:01 christos Exp $ */ /* @@ -67,7 +67,7 @@ int scanjet_set_window __P((struct ss_softc *, int)); int scanjet_compute_sizes __P((struct ss_softc *, int)); /* Maybe move to libkern? */ __inline static int atoi __P((const char *)); -__inline static char *strchr __P((const char *, char)); +__inline static char *strchr __P((/* const */ char *, char)); /* @@ -437,7 +437,11 @@ atoi(cp) __inline static char * strchr(cp, ch) - const char *cp; + /* + * The const was removed to make -Wcast-qual happy. I + * don't particularily like this solution but what to do? + */ + /* const */ char *cp; char ch; { while (*cp && *cp != ch) cp++; diff --git a/sys/sys/namei.h b/sys/sys/namei.h index ac6b1d1232d..d7c691c27d1 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namei.h,v 1.2 1996/03/03 12:12:05 niklas Exp $ */ +/* $OpenBSD: namei.h,v 1.3 1996/12/08 14:25:51 niklas Exp $ */ /* $NetBSD: namei.h,v 1.11 1996/02/09 18:25:20 christos Exp $ */ /* @@ -48,7 +48,7 @@ struct nameidata { /* * Arguments to namei/lookup. */ - caddr_t ni_dirp; /* pathname pointer */ + const char *ni_dirp; /* pathname pointer */ enum uio_seg ni_segflg; /* location of pathname */ /* u_long ni_nameiop; namei operation */ /* u_long ni_flags; flags to namei */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 7aa6658432f..d84c774d55e 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.16 1996/11/29 04:53:38 kstailey Exp $ */ +/* $OpenBSD: systm.h,v 1.17 1996/12/08 14:25:52 niklas Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -135,8 +135,8 @@ void vfs_opv_init_explicit __P((struct vnodeopv_desc *)); void vfs_opv_init_default __P((struct vnodeopv_desc *)); void vfs_op_init __P((void)); -int seltrue __P((dev_t dev, int which, struct proc *p)); -void *hashinit __P((int count, int type, u_long *hashmask)); +int seltrue __P((dev_t dev, int which, struct proc *)); +void *hashinit __P((int, int, u_long *)); int sys_nosys __P((struct proc *, void *, register_t *)); void panic __P((const char *, ...)) @@ -161,40 +161,40 @@ void ttyprintf __P((struct tty *, const char *, ...)) void tablefull __P((const char *)); -void bcopy __P((const void *from, void *to, size_t len)); -void ovbcopy __P((const void *from, void *to, size_t len)); -void bzero __P((void *buf, size_t len)); -int bcmp __P((const void *b1, const void *b2, size_t len)); +void bcopy __P((const void *, void *, size_t)); +void ovbcopy __P((const void *, void *, size_t)); +void bzero __P((void *, size_t)); +int bcmp __P((const void *, const void *, size_t)); -int copystr __P((void *kfaddr, void *kdaddr, size_t len, size_t *done)); -int copyinstr __P((void *udaddr, void *kaddr, size_t len, size_t *done)); -int copyoutstr __P((void *kaddr, void *udaddr, size_t len, size_t *done)); -int copyin __P((void *udaddr, void *kaddr, size_t len)); -int copyout __P((void *kaddr, void *udaddr, size_t len)); +int copystr __P((const void *, void *, size_t, size_t *)); +int copyinstr __P((const void *, void *, size_t, size_t *)); +int copyoutstr __P((const void *, void *, size_t, size_t *)); +int copyin __P((const void *, void *, size_t)); +int copyout __P((const void *, void *, size_t)); -int fubyte __P((void *base)); +int fubyte __P((void *)); #ifdef notdef -int fuibyte __P((void *base)); +int fuibyte __P((void *)); #endif -int subyte __P((void *base, int byte)); -int suibyte __P((void *base, int byte)); -long fuword __P((void *base)); -long fuiword __P((void *base)); -int suword __P((void *base, long word)); -int suiword __P((void *base, long word)); +int subyte __P((void *, int)); +int suibyte __P((void *, int)); +long fuword __P((void *)); +long fuiword __P((void *)); +int suword __P((void *, long)); +int suiword __P((void *, long)); int fuswintr __P((caddr_t)); int suswintr __P((caddr_t, u_int)); struct timeval; -int hzto __P((struct timeval *tv)); -void timeout __P((void (*func)(void *), void *arg, int ticks)); -void untimeout __P((void (*func)(void *), void *arg)); +int hzto __P((struct timeval *)); +void timeout __P((void (*)(void *), void *, int)); +void untimeout __P((void (*)(void *), void *)); void realitexpire __P((void *)); struct clockframe; -void hardclock __P((struct clockframe *frame)); +void hardclock __P((struct clockframe *)); void softclock __P((void)); -void statclock __P((struct clockframe *frame)); +void statclock __P((struct clockframe *)); #ifdef NTP void hardupdate __P((long offset)); #endif @@ -206,7 +206,7 @@ void cpu_initclocks __P((void)); void startprofclock __P((struct proc *)); void stopprofclock __P((struct proc *)); -void setstatclockrate __P((int hzrate)); +void setstatclockrate __P((int)); /* * Shutdown hooks. Functions to be run with all interrupts disabled -- 2.20.1