From 333e1766873a5609460a75a55a5cc7b9a9f72933 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 29 May 2005 21:22:52 +0000 Subject: [PATCH] - sprinkle const - remove unneeded casts - use more mem*() instead of b*() funcs. --- sys/net/if.c | 12 +++--- sys/net/if_ethersubr.c | 10 ++--- sys/net/if_gif.c | 8 ++-- sys/net/if_ppp.c | 14 +++---- sys/net/if_pppoe.c | 28 ++++++------- sys/net/if_spppsubr.c | 20 ++++----- sys/net/if_strip.c | 20 +++++---- sys/net/ppp_tty.c | 12 +++--- sys/net/radix.c | 28 ++++++------- sys/net/radix.h | 10 ++--- sys/net/route.c | 23 +++++------ sys/net/route.h | 8 ++-- sys/net/rtsock.c | 35 ++++++++-------- sys/net/zlib.c | 92 +++++++++++++++++++++--------------------- sys/net/zlib.h | 6 +-- 15 files changed, 161 insertions(+), 165 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 2b1faedcbed7..70295343cdc9 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.157 2005/05/02 15:34:32 yamt Exp $ */ +/* $NetBSD: if.c,v 1.158 2005/05/29 21:22:52 christos Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.157 2005/05/02 15:34:32 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.158 2005/05/29 21:22:52 christos Exp $"); #include "opt_inet.h" @@ -925,7 +925,7 @@ ifa_ifwithaddr(addr) struct ifaddr *ifa; #define equal(a1, a2) \ - (bcmp((caddr_t)(a1), (caddr_t)(a2), ((struct sockaddr *)(a1))->sa_len) == 0) + (bcmp((a1), (a2), ((const struct sockaddr *)(a1))->sa_len) == 0) for (ifp = TAILQ_FIRST(&ifnet); ifp != NULL; ifp = TAILQ_NEXT(ifp, if_list)) { @@ -994,7 +994,7 @@ ifa_ifwithnet(addr) char *addr_data = addr->sa_data, *cplim; if (af == AF_LINK) { - sdl = (struct sockaddr_dl *)addr; + sdl = (const struct sockaddr_dl *)addr; if (sdl->sdl_index && sdl->sdl_index < if_indexlim && ifindex2ifnet[sdl->sdl_index] && ifindex2ifnet[sdl->sdl_index]->if_output != if_nulloutput) @@ -1003,12 +1003,12 @@ ifa_ifwithnet(addr) #ifdef NETATALK if (af == AF_APPLETALK) { const struct sockaddr_at *sat, *sat2; - sat = (struct sockaddr_at *)addr; + sat = (const struct sockaddr_at *)addr; for (ifp = TAILQ_FIRST(&ifnet); ifp != NULL; ifp = TAILQ_NEXT(ifp, if_list)) { if (ifp->if_output == if_nulloutput) continue; - ifa = at_ifawithnet((struct sockaddr_at *)addr, ifp); + ifa = at_ifawithnet((const struct sockaddr_at *)addr, ifp); if (ifa == NULL) continue; sat2 = (struct sockaddr_at *)ifa->ifa_addr; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 43be024ad821..f54dd3ace86f 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.124 2005/05/17 04:14:58 christos Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.125 2005/05/29 21:22:52 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.124 2005/05/17 04:14:58 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.125 2005/05/29 21:22:52 christos Exp $"); #include "opt_inet.h" #include "opt_atalk.h" @@ -267,8 +267,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, #ifdef INET case AF_INET: if (m->m_flags & M_BCAST) - bcopy((caddr_t)etherbroadcastaddr, (caddr_t)edst, - sizeof(edst)); + (void)memcpy(edst, etherbroadcastaddr, sizeof(edst)); else if (m->m_flags & M_MCAST) { ETHER_MAP_IP_MULTICAST(&SIN(dst)->sin_addr, @@ -285,8 +284,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, case AF_ARP: ah = mtod(m, struct arphdr *); if (m->m_flags & M_BCAST) - bcopy((caddr_t)etherbroadcastaddr, (caddr_t)edst, - sizeof(edst)); + (void)memcpy(edst, etherbroadcastaddr, sizeof(edst)); else bcopy((caddr_t)ar_tha(ah), (caddr_t)edst, sizeof(edst)); diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 91c7b66e2e30..48b60a13f11d 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gif.c,v 1.51 2005/05/20 16:23:05 christos Exp $ */ +/* $NetBSD: if_gif.c,v 1.52 2005/05/29 21:22:52 christos Exp $ */ /* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.51 2005/05/20 16:23:05 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.52 2005/05/29 21:22:52 christos Exp $"); #include "opt_inet.h" #include "opt_iso.h" @@ -538,8 +538,8 @@ gif_input(m, af, ifp) eh = mtod(m, struct ether_header *); m->m_flags &= ~(M_BCAST|M_MCAST); if (eh->ether_dhost[0] & 1) { - if (bcmp((caddr_t) etherbroadcastaddr, - (caddr_t)eh->ether_dhost, sizeof(etherbroadcastaddr)) == 0) + if (memcmp(etherbroadcastaddr, + eh->ether_dhost, sizeof(etherbroadcastaddr)) == 0) m->m_flags |= M_BCAST; else m->m_flags |= M_MCAST; diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index af3313e5a940..90bb649a4bf9 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ppp.c,v 1.100 2005/05/17 04:14:58 christos Exp $ */ +/* $NetBSD: if_ppp.c,v 1.101 2005/05/29 21:22:52 christos Exp $ */ /* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */ /* @@ -102,7 +102,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.100 2005/05/17 04:14:58 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.101 2005/05/29 21:22:52 christos Exp $"); #include "ppp.h" @@ -521,13 +521,13 @@ pppioctl(sc, cmd, data, flag, p) case PPPIOCGRAWIN: { struct ppp_rawin *rwin = (struct ppp_rawin *)data; - u_char p, q = 0; + u_char c, q = 0; - for (p = sc->sc_rawin_start; p < sizeof(sc->sc_rawin.buf);) - rwin->buf[q++] = sc->sc_rawin.buf[p++]; + for (c = sc->sc_rawin_start; c < sizeof(sc->sc_rawin.buf);) + rwin->buf[q++] = sc->sc_rawin.buf[c++]; - for (p = 0; p < sc->sc_rawin_start;) - rwin->buf[q++] = sc->sc_rawin.buf[p++]; + for (c = 0; c < sc->sc_rawin_start;) + rwin->buf[q++] = sc->sc_rawin.buf[c++]; rwin->count = sc->sc_rawin.count; } diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 992b90d21039..92a1d4d9c0dc 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_pppoe.c,v 1.59 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: if_pppoe.c,v 1.60 2005/05/29 21:22:53 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.59 2005/02/26 22:45:09 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.60 2005/05/29 21:22:53 christos Exp $"); #include "pppoe.h" #include "bpfilter.h" @@ -856,43 +856,43 @@ pppoe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) } if (parms->ac_name) { size_t s; - char * p = malloc(parms->ac_name_len + 1, M_DEVBUF, + char *b = malloc(parms->ac_name_len + 1, M_DEVBUF, M_WAITOK); - if (p == NULL) + if (b == NULL) return ENOMEM; - error = copyinstr(parms->ac_name, p, + error = copyinstr(parms->ac_name, b, parms->ac_name_len+1, &s); if (error != 0) { - free(p, M_DEVBUF); + free(b, M_DEVBUF); return error; } if (s != parms->ac_name_len+1) { - free(p, M_DEVBUF); + free(b, M_DEVBUF); return EINVAL; } if (sc->sc_concentrator_name) free(sc->sc_concentrator_name, M_DEVBUF); - sc->sc_concentrator_name = p; + sc->sc_concentrator_name = b; } if (parms->service_name) { size_t s; - char * p = malloc(parms->service_name_len + 1, M_DEVBUF, + char *b = malloc(parms->service_name_len + 1, M_DEVBUF, M_WAITOK); - if (p == NULL) + if (b == NULL) return ENOMEM; - error = copyinstr(parms->service_name, p, + error = copyinstr(parms->service_name, b, parms->service_name_len+1, &s); if (error != 0) { - free(p, M_DEVBUF); + free(b, M_DEVBUF); return error; } if (s != parms->service_name_len+1) { - free(p, M_DEVBUF); + free(b, M_DEVBUF); return EINVAL; } if (sc->sc_service_name) free(sc->sc_service_name, M_DEVBUF); - sc->sc_service_name = p; + sc->sc_service_name = b; } return 0; } diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index d0eee3efaa45..7d8336ae54fc 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.84 2005/04/27 07:48:02 martin Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.85 2005/05/29 21:22:53 christos Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.84 2005/04/27 07:48:02 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.85 2005/05/29 21:22:53 christos Exp $"); #include "opt_inet.h" #include "opt_ipx.h" @@ -3991,7 +3991,7 @@ chap_failure: sp->pp_auth_failures++; splx(x); sppp_auth_send(&chap, sp, CHAP_FAILURE, h->ident, - sizeof(FAILMSG) - 1, (u_char *)FAILMSG, + sizeof(FAILMSG) - 1, (const u_char *)FAILMSG, 0); chap.tld(sp); break; @@ -4001,7 +4001,7 @@ chap_failure: if (sp->state[IDX_CHAP] == STATE_REQ_SENT || sp->state[IDX_CHAP] == STATE_OPENED) sppp_auth_send(&chap, sp, CHAP_SUCCESS, h->ident, - sizeof(SUCCMSG) - 1, (u_char *)SUCCMSG, + sizeof(SUCCMSG) - 1, (const u_char *)SUCCMSG, 0); if (sp->state[IDX_CHAP] == STATE_REQ_SENT) { sppp_cp_change_state(&chap, sp, STATE_OPENED); @@ -4285,7 +4285,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) mlen = sizeof(FAILMSG) - 1; sppp_auth_send(&pap, sp, PAP_NAK, h->ident, sizeof mlen, (const char *)&mlen, - sizeof(FAILMSG) - 1, (u_char *)FAILMSG, + sizeof(FAILMSG) - 1, (const u_char *)FAILMSG, 0); pap.tld(sp); break; @@ -4296,7 +4296,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) mlen = sizeof(SUCCMSG) - 1; sppp_auth_send(&pap, sp, PAP_ACK, h->ident, sizeof mlen, (const char *)&mlen, - sizeof(SUCCMSG) - 1, (u_char *)SUCCMSG, + sizeof(SUCCMSG) - 1, (const u_char *)SUCCMSG, 0); } if (sp->state[IDX_PAP] == STATE_REQ_SENT) { @@ -5133,14 +5133,14 @@ sppp_params(struct sppp *sp, int cmd, void *data) break; case SPPPGETLCPCFG: { - struct sppplcpcfg *lcp = (struct sppplcpcfg *)data; - lcp->lcp_timeout = sp->lcp.timeout; + struct sppplcpcfg *lcpp = (struct sppplcpcfg *)data; + lcpp->lcp_timeout = sp->lcp.timeout; } break; case SPPPSETLCPCFG: { - struct sppplcpcfg *lcp = (struct sppplcpcfg *)data; - sp->lcp.timeout = lcp->lcp_timeout; + struct sppplcpcfg *lcpp = (struct sppplcpcfg *)data; + sp->lcp.timeout = lcpp->lcp_timeout; } break; case SPPPGETSTATUS: diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index d43e89881110..9c95c7c46e07 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_strip.c,v 1.59 2005/03/31 15:48:13 christos Exp $ */ +/* $NetBSD: if_strip.c,v 1.60 2005/05/29 21:22:53 christos Exp $ */ /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ /* @@ -87,7 +87,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_strip.c,v 1.59 2005/03/31 15:48:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_strip.c,v 1.60 2005/05/29 21:22:53 christos Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -261,9 +261,9 @@ static u_char* UnStuffData __P((u_char *src, u_char *end, u_char static u_char* StuffData __P((u_char *src, u_long length, u_char *dest, u_char **code_ptr_ptr)); -static void RecvErr __P((char *msg, struct strip_softc *sc)); +static void RecvErr __P((const char *msg, struct strip_softc *sc)); static void RecvErr_Message __P((struct strip_softc *strip_info, - u_char *sendername, u_char *msg)); + u_char *sendername, const u_char *msg)); void strip_resetradio __P((struct strip_softc *sc, struct tty *tp)); void strip_proberadio __P((struct strip_softc *sc, struct tty *tp)); void strip_watchdog __P((struct ifnet *ifp)); @@ -850,11 +850,9 @@ stripoutput(ifp, m, dst, rt) dldst = dl_addrbuf; shp = mtod(m, struct st_header *); - bcopy((caddr_t)"SIP0", (caddr_t)&shp->starmode_type, - sizeof(shp->starmode_type)); + memcpy(&shp->starmode_type, "SIP0", sizeof(shp->starmode_type)); - bcopy((const char *)dldst, (caddr_t)shp->starmode_addr, - sizeof (shp->starmode_addr)); + memcpy(shp->starmode_addr, dldst, sizeof(shp->starmode_addr)); s = spltty(); if (sc->sc_oqlen && sc->sc_ttyp->t_outq.c_cc == sc->sc_oqlen) { @@ -1445,7 +1443,7 @@ strip_proberadio(sc, tp) #ifdef DEBUG -static char *strip_statenames[] = { +static const char *strip_statenames[] = { "Alive", "Probe sent, awaiting answer", "Probe not answered, resetting" @@ -1936,7 +1934,7 @@ UnStuffData(u_char *src, u_char *end, u_char *dst, u_long dst_length) */ static void RecvErr(msg, sc) - char *msg; + const char *msg; struct strip_softc *sc; { #define MAX_RecErr 80 @@ -1973,7 +1971,7 @@ static void RecvErr_Message(strip_info, sendername, msg) struct strip_softc *strip_info; u_char *sendername; - /*const*/ u_char *msg; + const u_char *msg; { static const char ERR_001[] = "001"; /* Not in StarMode! */ static const char ERR_002[] = "002"; /* Remap handle */ diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 38db30fa722c..5c2a7f755c99 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: ppp_tty.c,v 1.36 2005/05/17 04:14:58 christos Exp $ */ +/* $NetBSD: ppp_tty.c,v 1.37 2005/05/29 21:22:53 christos Exp $ */ /* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */ /* @@ -93,7 +93,7 @@ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.36 2005/05/17 04:14:58 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.37 2005/05/29 21:22:53 christos Exp $"); #include "ppp.h" @@ -1255,11 +1255,11 @@ pppdumpb(b, l) u_char *b; int l; { - char buf[3*MAX_DUMP_BYTES+4]; - char *bp = buf; + char bf[3*MAX_DUMP_BYTES+4]; + char *bp = bf; while (l--) { - if (bp >= buf + sizeof(buf) - 3) { + if (bp >= bf + sizeof(bf) - 3) { *bp++ = '>'; break; } @@ -1269,7 +1269,7 @@ pppdumpb(b, l) } *bp = 0; - printf("%s\n", buf); + printf("%s\n", bf); } static void diff --git a/sys/net/radix.c b/sys/net/radix.c index 62c6af520204..3dba3debbf4d 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -1,4 +1,4 @@ -/* $NetBSD: radix.c,v 1.28 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: radix.c,v 1.29 2005/05/29 21:22:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.28 2005/02/26 22:45:09 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.29 2005/05/29 21:22:53 christos Exp $"); #ifndef _NET_RADIX_H_ #include @@ -64,8 +64,6 @@ static const char normal_chars[] = static char *rn_zeros, *rn_ones; #define rn_masktop (mask_rnhead->rnh_treetop) -#undef Bcmp -#define Bcmp(a, b, l) (l == 0 ? 0 : bcmp((caddr_t)(a), (caddr_t)(b), (u_long)l)) static int rn_satisfies_leaf(const char *, struct radix_node *, int); static int rn_lexobetter(const void *, const void *); @@ -150,9 +148,9 @@ rn_refines( { const char *m = m_arg; const char *n = n_arg; - const char *lim = n + *(u_char *)n; + const char *lim = n + *(const u_char *)n; const char *lim2 = lim; - int longer = (*(u_char *)n++) - (int)(*(u_char *)m++); + int longer = (*(const u_char *)n++) - (int)(*(const u_char *)m++); int masks_are_equal = 1; if (longer > 0) @@ -205,12 +203,12 @@ rn_satisfies_leaf( const char *cp2 = leaf->rn_key; const char *cp3 = leaf->rn_mask; const char *cplim; - int length = min(*(u_char *)cp, *(u_char *)cp2); + int length = min(*(const u_char *)cp, *(const u_char *)cp2); if (cp3 == 0) cp3 = rn_ones; else - length = min(length, *(u_char *)cp3); + length = min(length, *(const u_char *)cp3); cplim = cp + length; cp3 += skip; cp2 += skip; for (cp += skip; cp < cplim; cp++, cp2++, cp3++) if ((*cp ^ *cp2) & *cp3) @@ -232,7 +230,7 @@ rn_match( const char *cp2; const char *cplim; int off = t->rn_off; - int vlen = *(u_char *)cp; + int vlen = *(const u_char *)cp; int matched_off; int test, b, rn_b; @@ -258,7 +256,7 @@ rn_match( * are probably the most common case... */ if (t->rn_mask) - vlen = *(u_char *)t->rn_mask; + vlen = *(const u_char *)t->rn_mask; cp += off; cp2 = t->rn_key + off; cplim = v + vlen; for (; cp < cplim; cp++, cp2++) if (*cp != *cp2) @@ -363,7 +361,7 @@ rn_insert( struct radix_node *tt; const char *v = v_arg; int head_off = top->rn_off; - int vlen = *((u_char *)v); + int vlen = *((const u_char *)v); const char *cp = v + head_off; int b; /* @@ -432,7 +430,7 @@ rn_addmask( int maskduplicated, m0, isnormal; static int last_zeroed = 0; - if ((mlen = *(u_char *)netmask) > max_keylen) + if ((mlen = *(const u_char *)netmask) > max_keylen) mlen = max_keylen; if (skip == 0) skip = 1; @@ -477,7 +475,7 @@ rn_addmask( * Calculate index of mask, and check for normalcy. */ cplim = netmask + mlen; isnormal = 1; - for (cp = netmask + skip; (cp < cplim) && *(u_char *)cp == 0xff;) + for (cp = netmask + skip; (cp < cplim) && *(const u_char *)cp == 0xff;) cp++; if (cp != cplim) { for (j = 0x80; (j & *cp) != 0; j >>= 1) @@ -615,7 +613,7 @@ rn_addroute( t=tt+1; tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; tt->rn_twin = t; tt->rn_ybro = rn_clist; rn_clist = tt; #endif - tt->rn_key = (caddr_t) v; + tt->rn_key = __UNCONST(v); /*XXXUNCONST*/ tt->rn_b = -1; tt->rn_flags = RNF_ACTIVE; } @@ -713,7 +711,7 @@ rn_delete( x = head->rnh_treetop; tt = rn_search(v, x); head_off = x->rn_off; - vlen = *(u_char *)v; + vlen = *(const u_char *)v; saved_tt = tt; top = x; if (tt == 0 || diff --git a/sys/net/radix.h b/sys/net/radix.h index ba0b13691af1..1b60248802c1 100644 --- a/sys/net/radix.h +++ b/sys/net/radix.h @@ -1,4 +1,4 @@ -/* $NetBSD: radix.h,v 1.14 2004/04/21 21:03:43 matt Exp $ */ +/* $NetBSD: radix.h,v 1.15 2005/05/29 21:22:53 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1993 @@ -129,11 +129,11 @@ struct radix_node_head { #ifdef _KERNEL -#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) -#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) -#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n)); +#define Bcmp(a, b, n) ((n) == 0 ? 0 : memcmp((a), (b), (n))) +#define Bcopy(a, b, n) memmove((b), (a), (n)) +#define Bzero(p, n) memset((p), 0, (n)); #define R_Malloc(p, t, n) (p = (t) malloc((size_t)(n), M_RTABLE, M_NOWAIT)) -#define Free(p) free((caddr_t)p, M_RTABLE); +#define Free(p) free(p, M_RTABLE); #endif /*_KERNEL*/ void rn_init(void); diff --git a/sys/net/route.c b/sys/net/route.c index 307263a089aa..f6a4d98d509a 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $NetBSD: route.c,v 1.65 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: route.c,v 1.66 2005/05/29 21:22:53 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.65 2005/02/26 22:45:09 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.66 2005/05/29 21:22:53 christos Exp $"); #include "opt_ns.h" @@ -183,7 +183,7 @@ rtalloc1(const struct sockaddr *dst, int report) struct rt_addrinfo info; int s = splsoftnet(), err = 0, msgtype = RTM_MISS; - if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && + if (rnh && (rn = rnh->rnh_matchaddr(dst, rnh)) && ((rn->rn_flags & RNF_ROOT) == 0)) { newrt = rt = (struct rtentry *)rn; if (report && (rt->rt_flags & RTF_CLONING)) { @@ -296,7 +296,7 @@ rtredirect(const struct sockaddr *dst, const struct sockaddr *gateway, */ #define equal(a1, a2) \ ((a1)->sa_len == (a2)->sa_len && \ - bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0) + memcmp((a1), (a2), (a1)->sa_len) == 0) if (!(flags & RTF_DONE) && rt && (!equal(src, rt->rt_gateway) || rt->rt_ifa != ifa)) error = EINVAL; @@ -637,14 +637,13 @@ rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt) rt->rt_parent = *ret_nrt; rt->rt_parent->rt_refcnt++; } - rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask, - rnh, rt->rt_nodes); + rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); if (rn == NULL && (crt = rtalloc1(ndst, 0)) != NULL) { /* overwrite cloned route */ if ((crt->rt_flags & RTF_CLONED) != 0) { rtdeletemsg(crt); - rn = rnh->rnh_addaddr((caddr_t)ndst, - (caddr_t)netmask, rnh, rt->rt_nodes); + rn = rnh->rnh_addaddr(ndst, + netmask, rnh, rt->rt_nodes); } RTFREE(crt); } @@ -698,7 +697,7 @@ rt_setgate( struct rtentry *rt0, const struct sockaddr *dst, Bzero(new, dlen + glen); rt->rt_nodes->rn_key = new; } else { - new = (void *)rt->rt_nodes->rn_key; + new = __UNCONST(rt->rt_nodes->rn_key); /*XXXUNCONST*/ old = 0; } Bcopy(gate, (rt->rt_gateway = (struct sockaddr *)(new + dlen)), glen); @@ -733,9 +732,9 @@ void rt_maskedcopy(const struct sockaddr *src, struct sockaddr *dst, const struct sockaddr *netmask) { - const u_char *cp1 = (u_char *)src; + const u_char *cp1 = (const u_char *)src; u_char *cp2 = (u_char *)dst; - const u_char *cp3 = (u_char *)netmask; + const u_char *cp3 = (const u_char *)netmask; u_char *cplim = cp2 + *cp3; u_char *cplim2 = cp2 + *cp1; @@ -746,7 +745,7 @@ rt_maskedcopy(const struct sockaddr *src, struct sockaddr *dst, while (cp2 < cplim) *cp2++ = *cp1++ & *cp3++; if (cp2 < cplim2) - memset((caddr_t)cp2, 0, (unsigned)(cplim2 - cp2)); + memset(cp2, 0, (unsigned)(cplim2 - cp2)); } /* diff --git a/sys/net/route.h b/sys/net/route.h index e2b751eb3aab..fd22289901ae 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $NetBSD: route.h,v 1.39 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: route.h,v 1.40 2005/05/29 21:22:53 christos Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -92,8 +92,10 @@ struct rt_metrics { #endif struct rtentry { struct radix_node rt_nodes[2]; /* tree glue, and other values */ -#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) -#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) +/*XXXUNCONST*/ +#define rt_key(r) ((struct sockaddr *)__UNCONST((r)->rt_nodes->rn_key)) +/*XXXUNCONST*/ +#define rt_mask(r) ((struct sockaddr *)__UNCONST((r)->rt_nodes->rn_mask)) struct sockaddr *rt_gateway; /* value */ int rt_flags; /* up/down?, host/net */ int rt_refcnt; /* # held references */ diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index eb8ab7e73abd..567f6f7e4a4f 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.75 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: rtsock.c,v 1.76 2005/05/29 21:22:53 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.75 2005/02/26 22:45:09 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.76 2005/05/29 21:22:53 christos Exp $"); #include "opt_inet.h" @@ -244,11 +244,11 @@ route_output(struct mbuf *m, ...) senderr(EINVAL); if (genmask) { struct radix_node *t; - t = rn_addmask((caddr_t)genmask, 0, 1); - if (t && genmask->sa_len >= ((struct sockaddr *)t->rn_key)->sa_len && - Bcmp((caddr_t *)genmask + 1, (caddr_t *)t->rn_key + 1, - ((struct sockaddr *)t->rn_key)->sa_len) - 1) - genmask = (struct sockaddr *)(t->rn_key); + t = rn_addmask(genmask, 0, 1); + if (t && genmask->sa_len >= ((const struct sockaddr *)t->rn_key)->sa_len && + Bcmp((const char *const *)genmask + 1, (const char *const *)t->rn_key + 1, + ((const struct sockaddr *)t->rn_key)->sa_len) - 1) + genmask = (const struct sockaddr *)(t->rn_key); else senderr(ENOBUFS); } @@ -296,20 +296,20 @@ route_output(struct mbuf *m, ...) rt = (struct rtentry *)rn; rt->rt_refcnt++; if (rtm->rtm_type != RTM_GET) {/* XXX: too grotty */ - struct radix_node *rn; + struct radix_node *rnn; extern struct radix_node_head *mask_rnhead; if (Bcmp(dst, rt_key(rt), dst->sa_len) != 0) senderr(ESRCH); - if (netmask && (rn = rn_search(netmask, + if (netmask && (rnn = rn_search(netmask, mask_rnhead->rnh_treetop))) - netmask = (struct sockaddr *)rn->rn_key; - for (rn = rt->rt_nodes; rn; rn = rn->rn_dupedkey) - if (netmask == (struct sockaddr *)rn->rn_mask) + netmask = (const struct sockaddr *)rnn->rn_key; + for (rnn = rt->rt_nodes; rnn; rnn = rnn->rn_dupedkey) + if (netmask == (const struct sockaddr *)rnn->rn_mask) break; - if (rn == 0) + if (rnn == 0) senderr(ETOOMANYREFS); - rt = (struct rtentry *)rn; + rt = (struct rtentry *)rnn; } switch (rtm->rtm_type) { @@ -478,7 +478,7 @@ rt_xaddrs(u_char rtmtype, const char *cp, const char *cplim, struct rt_addrinfo for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { if ((rtinfo->rti_addrs & (1 << i)) == 0) continue; - rtinfo->rti_info[i] = sa = (struct sockaddr *)cp; + rtinfo->rti_info[i] = sa = (const struct sockaddr *)cp; ADVANCE(cp, sa); } @@ -566,7 +566,7 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo, caddr_t data, int datalen) continue; rtinfo->rti_addrs |= (1 << i); dlen = ROUNDUP(sa->sa_len); - m_copyback(m, len, dlen, (caddr_t)sa); + m_copyback(m, len, dlen, sa); len += dlen; } if (m->m_pkthdr.len != len) { @@ -1027,7 +1027,8 @@ sysctl_rtable(SYSCTLFN_ARGS) struct walkarg w; if (namelen == 1 && name[0] == CTL_QUERY) - return (sysctl_query(SYSCTLFN_CALL(rnode))); + /*XXXUNCONST*/ + return (sysctl_query(SYSCTLFN_CALL(__UNCONST(rnode)))); if (new) return (EPERM); diff --git a/sys/net/zlib.c b/sys/net/zlib.c index 6d8ee3c11aac..a476050655f5 100644 --- a/sys/net/zlib.c +++ b/sys/net/zlib.c @@ -1,4 +1,4 @@ -/* $NetBSD: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ /* * This file is derived from various .h and .c files from the zlib-1.0.4 * distribution by Jean-loup Gailly and Mark Adler, with some additions @@ -11,7 +11,7 @@ * - added inflateIncomp and deflateOutputPending * - allow strm->next_out to be NULL, meaning discard the output * - * $Id: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ + * $Id: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ /* @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $"); #define NO_DUMMY_DECL #define NO_ZCFUNCS @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $"); subject to change. Applications should only use zlib.h. */ -/* @(#) $Id: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ */ +/* @(#) $Id: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ #ifndef _Z_UTIL_H #define _Z_UTIL_H @@ -104,7 +104,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) + return (strm->msg = ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ @@ -293,7 +293,7 @@ void zcfree __P((voidpf opaque, voidpf ptr)); subject to change. Applications should only use zlib.h. */ -/* @(#) $Id: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ */ +/* @(#) $Id: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ #ifndef _DEFLATE_H #define _DEFLATE_H @@ -655,7 +655,7 @@ void _tr_stored_type_only __P((deflate_state *)); * */ -/* @(#) $Id: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ */ +/* @(#) $Id: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ /* #include "deflate.h" */ @@ -812,14 +812,14 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) + vers, stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; - const char *version; + const char *vers; int stream_size; { deflate_state *s; @@ -831,7 +831,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, * output size for (length,distance) codes is <= 24 bits. */ - if (version == Z_NULL || version[0] != my_version[0] || + if (vers == Z_NULL || vers[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; } @@ -887,7 +887,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + strm->msg = ERR_MSG(Z_MEM_ERROR); s->status = INIT_STATE; deflateEnd (strm); return Z_MEM_ERROR; @@ -2029,7 +2029,7 @@ local block_state deflate_slow(s, flush) * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ -/* @(#) $Id: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ */ +/* @(#) $Id: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ /* #define GEN_TREES_H */ @@ -2280,8 +2280,8 @@ local void send_tree __P((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree __P((deflate_state *s)); local void send_all_trees __P((deflate_state *s, int lcodes, int dcodes, int blcodes)); -local void compress_block __P((deflate_state *s, ct_data *ltree, - ct_data *dtree)); +local void compress_block __P((deflate_state *s, const ct_data *ltree, + const ct_data *dtree)); local void set_data_type __P((deflate_state *s)); local unsigned bi_reverse __P((unsigned value, int length)); local void bi_windup __P((deflate_state *s)); @@ -3124,7 +3124,7 @@ void _tr_flush_block(s, buf, stored_len, eof) } else if (static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+eof, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); + compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); #ifdef DEBUG_ZLIB s->compressed_len += 3 + s->static_len; #endif @@ -3132,7 +3132,7 @@ void _tr_flush_block(s, buf, stored_len, eof) send_bits(s, (DYN_TREES<<1)+eof, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); + compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); #ifdef DEBUG_ZLIB s->compressed_len += 3 + s->opt_len; #endif @@ -3211,8 +3211,8 @@ int _tr_tally (s, dist, lc) */ local void compress_block(s, ltree, dtree) deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ + const ct_data *ltree; /* literal tree */ + const ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ @@ -3488,13 +3488,13 @@ z_streamp z; } -int ZEXPORT inflateInit2_(z, w, version, stream_size) +int ZEXPORT inflateInit2_(z, w, vers, stream_size) z_streamp z; int w; -const char *version; +const char *vers; int stream_size; { - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + if (vers == Z_NULL || vers[0] != ZLIB_VERSION[0] || stream_size != sizeof(z_stream)) return Z_VERSION_ERROR; @@ -3548,12 +3548,12 @@ int stream_size; #if 0 -int ZEXPORT inflateInit_(z, version, stream_size) +int ZEXPORT inflateInit_(z, vers, stream_size) z_streamp z; -const char *version; +const char *vers; int stream_size; { - return inflateInit2_(z, DEF_WBITS, version, stream_size); + return inflateInit2_(z, DEF_WBITS, vers, stream_size); } #endif @@ -3579,14 +3579,14 @@ int f; if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED) { z->state->mode = BAD; - z->msg = (char*)"unknown compression method"; + z->msg = "unknown compression method"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } if ((z->state->sub.method >> 4) + 8 > z->state->wbits) { z->state->mode = BAD; - z->msg = (char*)"invalid window size"; + z->msg = "invalid window size"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } @@ -3597,7 +3597,7 @@ int f; if (((z->state->sub.method << 8) + b) % 31) { z->state->mode = BAD; - z->msg = (char*)"incorrect header check"; + z->msg = "incorrect header check"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } @@ -3628,7 +3628,7 @@ int f; return Z_NEED_DICT; case DICT0: z->state->mode = BAD; - z->msg = (char*)"need dictionary"; + z->msg = "need dictionary"; z->state->sub.marker = 0; /* can try inflateSync */ return Z_STREAM_ERROR; case BLOCKS: @@ -3672,7 +3672,7 @@ int f; if (z->state->sub.check.was != z->state->sub.check.need) { z->state->mode = BAD; - z->msg = (char*)"incorrect data check"; + z->msg = "incorrect data check"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } @@ -3689,7 +3689,7 @@ int f; if (f != Z_PACKET_FLUSH) return r; z->state->mode = BAD; - z->msg = (char *)"need more for packet flush"; + z->msg = "need more for packet flush"; z->state->sub.marker = 0; return Z_DATA_ERROR; } @@ -4187,7 +4187,7 @@ int r; case 3: /* illegal */ DUMPBITS(3) s->mode = BADB; - z->msg = (char*)"invalid block type"; + z->msg = "invalid block type"; r = Z_DATA_ERROR; LEAVE } @@ -4197,7 +4197,7 @@ int r; if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) { s->mode = BADB; - z->msg = (char*)"invalid stored block lengths"; + z->msg = "invalid stored block lengths"; r = Z_DATA_ERROR; LEAVE } @@ -4230,7 +4230,7 @@ int r; if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) { s->mode = BADB; - z->msg = (char*)"too many length or distance symbols"; + z->msg = "too many length or distance symbols"; r = Z_DATA_ERROR; LEAVE } @@ -4302,7 +4302,7 @@ int r; { ZFREE(z, s->sub.trees.blens); s->mode = BADB; - z->msg = (char*)"invalid bit length repeat"; + z->msg = "invalid bit length repeat"; r = Z_DATA_ERROR; LEAVE } @@ -4797,10 +4797,10 @@ z_streamp z; /* for messages */ r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, hp, &hn, v); if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed dynamic bit lengths tree"; + z->msg = "oversubscribed dynamic bit lengths tree"; else if (r == Z_BUF_ERROR || *bb == 0) { - z->msg = (char*)"incomplete dynamic bit lengths tree"; + z->msg = "incomplete dynamic bit lengths tree"; r = Z_DATA_ERROR; } ZFREE(z, v); @@ -4832,10 +4832,10 @@ z_streamp z; /* for messages */ if (r != Z_OK || *bl == 0) { if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed literal/length tree"; + z->msg = "oversubscribed literal/length tree"; else if (r != Z_MEM_ERROR) { - z->msg = (char*)"incomplete literal/length tree"; + z->msg = "incomplete literal/length tree"; r = Z_DATA_ERROR; } ZFREE(z, v); @@ -4847,18 +4847,18 @@ z_streamp z; /* for messages */ if (r != Z_OK || (*bd == 0 && nl > 257)) { if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed distance tree"; + z->msg = "oversubscribed distance tree"; else if (r == Z_BUF_ERROR) { #ifdef PKZIP_BUG_WORKAROUND r = Z_OK; } #else - z->msg = (char*)"incomplete distance tree"; + z->msg = "incomplete distance tree"; r = Z_DATA_ERROR; } else if (r != Z_MEM_ERROR) { - z->msg = (char*)"empty distance tree with lengths"; + z->msg = "empty distance tree with lengths"; r = Z_DATA_ERROR; } ZFREE(z, v); @@ -5276,7 +5276,7 @@ int r; break; } c->mode = BADCODE; /* invalid code */ - z->msg = (char*)"invalid literal/length code"; + z->msg = "invalid literal/length code"; r = Z_DATA_ERROR; LEAVE case LENEXT: /* i: getting length extra (have base) */ @@ -5308,7 +5308,7 @@ int r; break; } c->mode = BADCODE; /* invalid code */ - z->msg = (char*)"invalid distance code"; + z->msg = "invalid distance code"; r = Z_DATA_ERROR; LEAVE case DISTEXT: /* i: getting distance extra */ @@ -5614,7 +5614,7 @@ z_streamp z; } else { - z->msg = (char*)"invalid distance code"; + z->msg = "invalid distance code"; UNGRAB UPDATE return Z_DATA_ERROR; @@ -5645,7 +5645,7 @@ z_streamp z; } else { - z->msg = (char*)"invalid literal/length code"; + z->msg = "invalid literal/length code"; UNGRAB UPDATE return Z_DATA_ERROR; @@ -5905,7 +5905,7 @@ void zcfree (opaque, ptr) * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: zlib.c,v 1.20 2005/02/26 22:45:09 perry Exp $ */ +/* @(#) $Id: zlib.c,v 1.21 2005/05/29 21:22:53 christos Exp $ */ /* #include "zlib.h" */ diff --git a/sys/net/zlib.h b/sys/net/zlib.h index e77bc58278bc..afb5bdf5372c 100644 --- a/sys/net/zlib.h +++ b/sys/net/zlib.h @@ -1,4 +1,4 @@ -/* $NetBSD: zlib.h,v 1.8 2005/02/26 22:45:09 perry Exp $ */ +/* $NetBSD: zlib.h,v 1.9 2005/05/29 21:22:53 christos Exp $ */ /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.1.4, March 11th, 2002 @@ -43,7 +43,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: zlib.h,v 1.8 2005/02/26 22:45:09 perry Exp $ */ +/* @(#) $Id: zlib.h,v 1.9 2005/05/29 21:22:53 christos Exp $ */ #ifndef _ZCONF_H #define _ZCONF_H @@ -365,7 +365,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ - char *msg; /* last error message, NULL if no error */ + const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */