From: Guy Harris Date: Fri, 23 Mar 2018 01:41:04 +0000 (-0700) Subject: Add casts to finish eliminating those warnings. X-Git-Tag: libpcap-1.9-bp~178 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/aee2ffad4d75172d0febfcb53312c93c3e1156d4 Add casts to finish eliminating those warnings. At the point we're doing the cast, we know the offset in question is < 256, so we can cast it to u_char safely. --- diff --git a/optimize.c b/optimize.c index e866879c..0ca639cc 100644 --- a/optimize.c +++ b/optimize.c @@ -2209,13 +2209,13 @@ filled: bpf_error(cstate, "too many extra jumps"); /*NOTREACHED*/ } - dst->jt = extrajmps; + dst->jt = (u_char)extrajmps; extrajmps++; dst[extrajmps].code = BPF_JMP|BPF_JA; dst[extrajmps].k = off - extrajmps; } else - dst->jt = off; + dst->jt = (u_char)off; off = JF(p)->offset - (p->offset + slen) - 1; if (off >= 256) { /* offset too large for branch, must add a jump */ @@ -2230,13 +2230,13 @@ filled: bpf_error(cstate, "too many extra jumps"); /*NOTREACHED*/ } - dst->jf = extrajmps; + dst->jf = (u_char)extrajmps; extrajmps++; dst[extrajmps].code = BPF_JMP|BPF_JA; dst[extrajmps].k = off - extrajmps; } else - dst->jf = off; + dst->jf = (u_char)off; } return (1); }