diff options
author | 2013-03-04 14:00:31 +0000 | |
---|---|---|
committer | 2013-03-04 14:00:31 +0000 | |
commit | 4ecc9392fd9cd038a99bfb42d04c900069c50b5f (patch) | |
tree | 2d9032883084be5f4222bf09921f0f0ec51d2912 | |
parent | sync with reality, only sha256 checksums are generated for distinfo. (diff) | |
download | wireguard-openbsd-4ecc9392fd9cd038a99bfb42d04c900069c50b5f.tar.xz wireguard-openbsd-4ecc9392fd9cd038a99bfb42d04c900069c50b5f.zip |
Fix compiler warnings about casts discarding const qualifiers and
comparison between signed and unsigned. No binary change.
OK reyk@ joel@ gerhard@
-rw-r--r-- | usr.sbin/snmpd/pf.c | 25 | ||||
-rw-r--r-- | usr.sbin/snmpd/snmpd.h | 4 |
2 files changed, 15 insertions, 14 deletions
diff --git a/usr.sbin/snmpd/pf.c b/usr.sbin/snmpd/pf.c index 9700a496937..544968e21c9 100644 --- a/usr.sbin/snmpd/pf.c +++ b/usr.sbin/snmpd/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.4 2012/05/28 20:55:40 joel Exp $ */ +/* $OpenBSD: pf.c,v 1.5 2013/03/04 14:00:31 bluhm Exp $ */ /* * Copyright (c) 2012 Joel Knight <joel@openbsd.org> @@ -144,7 +144,7 @@ pfr_buf_grow(struct pfr_buffer *b, int minsize) } else { if (minsize == 0) minsize = b->pfrb_msize * 2; - if (minsize < 0 || minsize >= SIZE_T_MAX / bs) { + if (minsize < 0 || (size_t)minsize >= SIZE_T_MAX / bs) { /* msize overflow */ return (-1); } @@ -158,7 +158,7 @@ pfr_buf_grow(struct pfr_buffer *b, int minsize) return (0); } -void * +const void * pfr_buf_next(struct pfr_buffer *b, const void *prev) { size_t bs; @@ -170,10 +170,11 @@ pfr_buf_next(struct pfr_buffer *b, const void *prev) if (prev == NULL) return (b->pfrb_caddr); bs = buf_esize[b->pfrb_type]; - if ((((caddr_t)prev)-((caddr_t)b->pfrb_caddr)) / bs >= b->pfrb_size-1) + if ((((const char *)prev)-((char *)b->pfrb_caddr)) / bs >= + (size_t)b->pfrb_size-1) return (NULL); - return (((caddr_t)prev) + bs); + return (((const char *)prev) + bs); } int @@ -223,7 +224,7 @@ int pfi_count(void) { struct pfr_buffer b; - struct pfi_kif *p; + const struct pfi_kif *p; int c = 0; if (pfi_get(&b, NULL)) { @@ -242,7 +243,7 @@ int pfi_get_if(struct pfi_kif *rp, int idx) { struct pfr_buffer b; - struct pfi_kif *p; + const struct pfi_kif *p; int i = 1; if (pfi_get(&b, NULL)) { @@ -289,7 +290,7 @@ int pft_get_table(struct pfr_tstats *rts, int idx) { struct pfr_buffer b; - struct pfr_tstats *ts; + const struct pfr_tstats *ts; int i = 1; if (pft_get(&b, NULL)) { @@ -320,7 +321,7 @@ int pft_count(void) { struct pfr_buffer b; - struct pfr_tstats *ts; + const struct pfr_tstats *ts; int c = 0; if (pft_get(&b, NULL)) { @@ -363,7 +364,7 @@ pfta_get_addr(struct pfr_astats *ras, int tblidx) struct pfr_buffer ba; struct pfr_tstats ts; struct pfr_table filter; - struct pfr_astats *as; + const struct pfr_astats *as; if (pft_get_table(&ts, tblidx)) return (-1); @@ -405,7 +406,7 @@ pfta_get_nextaddr(struct pfr_astats *ras, int *tblidx) struct pfr_buffer ba; struct pfr_tstats ts; struct pfr_table filter; - struct pfr_astats *as; + const struct pfr_astats *as; int i, found = 0; ba.pfrb_caddr = NULL; @@ -453,7 +454,7 @@ pfta_get_first(struct pfr_astats *ras) struct pfr_buffer ba; struct pfr_tstats ts; struct pfr_table filter; - struct pfr_astats *as; + const struct pfr_astats *as; if (pft_get_table(&ts, 1)) return (-1); diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index f48f6c863b0..d144b7cc2a7 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.40 2013/01/24 09:30:27 gerhard Exp $ */ +/* $OpenBSD: snmpd.h,v 1.41 2013/03/04 14:00:31 bluhm Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -507,7 +507,7 @@ int pfr_get_astats(struct pfr_table *, struct pfr_astats *, int pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int); int pfr_buf_grow(struct pfr_buffer *, int); -void *pfr_buf_next(struct pfr_buffer *, const void *); +const void *pfr_buf_next(struct pfr_buffer *, const void *); int pfi_get_ifaces(const char *, struct pfi_kif *, int *); int pfi_get(struct pfr_buffer *, const char *); int pfi_count(void); |