Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net elide non portable casts
details: https://anonhg.NetBSD.org/src/rev/e752df6ab56e
branches: trunk
changeset: 494392:e752df6ab56e
user: christos <christos%NetBSD.org@localhost>
date: Thu Jul 06 02:58:07 2000 +0000
description:
elide non portable casts
add lint const castaway directives
diffstat:
lib/libc/net/ip6opt.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diffs (150 lines):
diff -r 370612b5c4ec -r e752df6ab56e lib/libc/net/ip6opt.c
--- a/lib/libc/net/ip6opt.c Thu Jul 06 02:57:23 2000 +0000
+++ b/lib/libc/net/ip6opt.c Thu Jul 06 02:58:07 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6opt.c,v 1.7 2000/04/24 10:40:25 itojun Exp $ */
+/* $NetBSD: ip6opt.c,v 1.8 2000/07/06 02:58:07 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ip6opt.c,v 1.7 2000/04/24 10:40:25 itojun Exp $");
+__RCSID("$NetBSD: ip6opt.c,v 1.8 2000/07/06 02:58:07 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -129,8 +129,8 @@
_DIAGASSERT(cmsg != NULL);
_DIAGASSERT(typep != NULL);
- bp = (u_char *)cmsg + cmsg->cmsg_len;
- eh = (struct ip6_ext *)CMSG_DATA(cmsg);
+ bp = (u_char *)(void *)cmsg + cmsg->cmsg_len;
+ eh = (struct ip6_ext *)(void *)CMSG_DATA(cmsg);
/* argument validation */
if (multx != 1 && multx != 2 && multx != 4 && multx != 8)
@@ -145,13 +145,13 @@
* first 2 bytes(for next header and length fields) of
* the option header.
*/
- if (bp == (u_char *)eh) {
+ if (bp == (u_char *)(void *)eh) {
bp += 2;
cmsg->cmsg_len += 2;
}
/* calculate pad length before the option. */
- off = bp - (u_char *)eh;
+ off = bp - (u_char *)(void *)eh;
padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) -
(off % multx);
padlen += plusy;
@@ -170,14 +170,14 @@
cmsg->cmsg_len += optlen;
/* calculate pad length after the option and insert the padding */
- off = bp - (u_char *)eh;
+ off = bp - (u_char *)(void *)eh;
padlen = ((off + 7) & ~7) - off;
inet6_insert_padopt(bp, padlen);
bp += padlen;
cmsg->cmsg_len += padlen;
/* update the length field of the ip6 option header */
- off = bp - (u_char *)eh;
+ off = bp - (u_char *)(void *)eh;
eh->ip6e_len = (off >> 3) - 1;
return(0);
@@ -210,8 +210,8 @@
_DIAGASSERT(cmsg != NULL);
- bp = (u_char *)cmsg + cmsg->cmsg_len;
- eh = (struct ip6_ext *)CMSG_DATA(cmsg);
+ bp = (u_char *)(void *)cmsg + cmsg->cmsg_len;
+ eh = (struct ip6_ext *)(void *)CMSG_DATA(cmsg);
/* argument validation */
if (multx != 1 && multx != 2 && multx != 4 && multx != 8)
@@ -224,13 +224,13 @@
* first 2 bytes(for next header and length fields) of
* the option header.
*/
- if (bp == (u_char *)eh) {
+ if (bp == (u_char *)(void *)eh) {
bp += 2;
cmsg->cmsg_len += 2;
}
/* calculate pad length before the option. */
- off = bp - (u_char *)eh;
+ off = bp - (u_char *)(void *)eh;
padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) -
(off % multx);
padlen += plusy;
@@ -245,14 +245,14 @@
cmsg->cmsg_len += datalen;
/* calculate pad length after the option and insert the padding */
- off = bp - (u_char *)eh;
+ off = bp - (u_char *)(void *)eh;
padlen = ((off + 7) & ~7) - off;
inet6_insert_padopt(bp, padlen);
bp += padlen;
cmsg->cmsg_len += padlen;
/* update the length field of the ip6 option header */
- off = bp - (u_char *)eh;
+ off = bp - (u_char *)(void *)eh;
eh->ip6e_len = (off >> 3) - 1;
return(retval);
@@ -288,7 +288,8 @@
/* message length validation */
if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext)))
return(-1);
- ip6e = (struct ip6_ext *)CMSG_DATA(cmsg);
+ /* LINTED const castaway */
+ ip6e = (struct ip6_ext *)(void *)CMSG_DATA(cmsg);
hdrlen = (ip6e->ip6e_len + 1) << 3;
if (cmsg->cmsg_len < CMSG_SPACE(hdrlen))
return(-1);
@@ -298,9 +299,9 @@
* simply return the 1st option.
* Otherwise, search the option list for the next option.
*/
- lim = (u_int8_t *)ip6e + hdrlen;
+ lim = (u_int8_t *)(void *)ip6e + hdrlen;
if (*tptrp == NULL)
- *tptrp = (u_int8_t *)(ip6e + 1);
+ *tptrp = (u_int8_t *)(void *)(ip6e + 1);
else {
if ((optlen = ip6optlen(*tptrp, lim)) == 0)
return(-1);
@@ -350,7 +351,8 @@
/* message length validation */
if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext)))
return(-1);
- ip6e = (struct ip6_ext *)CMSG_DATA(cmsg);
+ /* LINTED const castaway */
+ ip6e = (struct ip6_ext *)(void *)CMSG_DATA(cmsg);
hdrlen = (ip6e->ip6e_len + 1) << 3;
if (cmsg->cmsg_len < CMSG_SPACE(hdrlen))
return(-1);
@@ -360,9 +362,9 @@
* search from the beginning of the option list.
* Otherwise, search from *the next option* of the specified point.
*/
- lim = (u_int8_t *)ip6e + hdrlen;
+ lim = (u_int8_t *)(void *)ip6e + hdrlen;
if (*tptrp == NULL)
- *tptrp = (u_int8_t *)(ip6e + 1);
+ *tptrp = (u_int8_t *)(void *)(ip6e + 1);
else {
if ((optlen = ip6optlen(*tptrp, lim)) == 0)
return(-1);
Home |
Main Index |
Thread Index |
Old Index