diff options
author | kan <kan@FreeBSD.org> | 2004-07-28 06:58:23 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2004-07-28 06:58:23 +0000 |
commit | f70e41029a11381a7a06fea43eb09cc0db652143 (patch) | |
tree | 7449f744cbf131f25b43e6d01a79db311f3fc8d8 | |
parent | 1fc93948ca09f50cfcff8df075c14c02eb7c4e8c (diff) | |
download | FreeBSD-src-f70e41029a11381a7a06fea43eb09cc0db652143.zip FreeBSD-src-f70e41029a11381a7a06fea43eb09cc0db652143.tar.gz |
Avoid casts as lvalues. Declare local variable as u_char * instead of
declaring it as u_short * and casting it back to uchar * all over the place.
-rw-r--r-- | sys/netipx/ipx_cksum.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/netipx/ipx_cksum.c b/sys/netipx/ipx_cksum.c index 09f6fcc..b63b807 100644 --- a/sys/netipx/ipx_cksum.c +++ b/sys/netipx/ipx_cksum.c @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); u_short ipx_cksum(struct mbuf *m, int len) { u_int32_t sum = 0; - u_short *w; + u_char *w; u_char oldtc; int mlen, words; struct ipx *ipx; @@ -62,7 +62,7 @@ ipx_cksum(struct mbuf *m, int len) { ipx = mtod(m, struct ipx*); oldtc = ipx->ipx_tc; ipx->ipx_tc = 0; - w = &ipx->ipx_len; + w = (u_char *)&ipx->ipx_len; len -= 2; mlen = 2; @@ -83,7 +83,7 @@ ipx_cksum(struct mbuf *m, int len) { break; mlen &= 1; if (mlen) { - buf.b[0] = *(u_char*)w; + buf.b[0] = *w; if (--len == 0) { buf.b[1] = 0; sum += buf.w; @@ -93,11 +93,11 @@ ipx_cksum(struct mbuf *m, int len) { m = m->m_next; if (m == NULL) break; - w = mtod(m, u_short*); + w = mtod(m, u_char *); if (mlen) { - buf.b[1] = *(u_char*)w; + buf.b[1] = *w; sum += buf.w; - ((u_char*)w)++; + w++; if (--len == 0) break; } |