diff options
author | robert <robert@FreeBSD.org> | 2002-08-02 11:57:59 +0000 |
---|---|---|
committer | robert <robert@FreeBSD.org> | 2002-08-02 11:57:59 +0000 |
commit | 1495d7e56f4d94567dafa0b9aab512dd0a9e19b4 (patch) | |
tree | 5140b30371899b06fd6edc43bdb159ae68000f8c | |
parent | becaa16e962bdea9f9021ad295d9a47e797ceaa8 (diff) | |
download | FreeBSD-src-1495d7e56f4d94567dafa0b9aab512dd0a9e19b4.zip FreeBSD-src-1495d7e56f4d94567dafa0b9aab512dd0a9e19b4.tar.gz |
Use a cast to `void *' before casting to a pointer to a structure
to stop GCC emitting warnings about increased alignment requirements
which broke the build for sparc64.
Approved by: des
-rw-r--r-- | usr.bin/sockstat/sockstat.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index b8692a8..63b9058 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -223,7 +223,8 @@ gather_inet(int proto) bufsize *= 2; } xig = (struct xinpgen *)buf; - exig = (struct xinpgen *)((char *)buf + len - sizeof *exig); + exig = (struct xinpgen *)(void *) + ((char *)buf + len - sizeof *exig); if (xig->xig_len != sizeof *xig || exig->xig_len != sizeof *exig) errx(1, "struct xinpgen size mismatch"); @@ -233,7 +234,7 @@ gather_inet(int proto) warnx("warning: data may be inconsistent"); for (;;) { - xig = (struct xinpgen *)((char *)xig + xig->xig_len); + xig = (struct xinpgen *)(void *)((char *)xig + xig->xig_len); if (xig >= exig) break; switch (proto) { @@ -339,7 +340,8 @@ gather_unix(int proto) bufsize *= 2; } xug = (struct xunpgen *)buf; - exug = (struct xunpgen *)((char *)buf + len - sizeof *exug); + exug = (struct xunpgen *)(void *) + ((char *)buf + len - sizeof *exug); if (xug->xug_len != sizeof *xug || exug->xug_len != sizeof *exug) { warnx("struct xinpgen size mismatch"); @@ -351,7 +353,7 @@ gather_unix(int proto) warnx("warning: data may be inconsistent"); for (;;) { - xug = (struct xunpgen *)((char *)xug + xug->xug_len); + xug = (struct xunpgen *)(void *)((char *)xug + xug->xug_len); if (xug >= exug) break; xup = (struct xunpcb *)xug; @@ -370,7 +372,8 @@ gather_unix(int proto) sock->family = AF_UNIX; sock->protoname = protoname; if (xup->xu_unp.unp_addr != NULL) - sock->laddr = *(struct sockaddr_storage *)&xup->xu_addr; + sock->laddr = + *(struct sockaddr_storage *)(void *)&xup->xu_addr; else if (xup->xu_unp.unp_conn != NULL) *(void **)&sock->faddr = xup->xu_unp.unp_conn; hash = (int)((uintptr_t)sock->socket % HASHSIZE); |