diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-07-25 16:05:27 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-07-25 16:05:27 -0700 |
commit | 2d96be0322d71ce62e2f68d038070b10a7c9201b (patch) | |
tree | 140084663640fd718cb3bb1d01e649a23a883e4d /pcap-int.h | |
parent | 1a796886890fb989e2071d63d9d0279a046ec62c (diff) |
Check for, and squelch, signed vs. unsigned comparison errors.
Use -Wsign-compare if the compiler supports it.
If we're comparing an unsigned value with a signed value, and we've
already determined that the signed value is >= 0, just cast it to an
unsigned type.
Use 0xffffffffU instead of -1 as the "unknown"/"unset"/etc. value for
unsigned variables and fields.
Assign the result of str2tok() to an int, not a u_int, as it can return
-1.
Declare some variables and fields unsigned if they don't need to be
signed. Make sure some arguments passed into "set" functions are
non-negative (and otherwise not invalid).
In the BPF optimizer, cast the "constant" fields of a struct block to an
unsigned type - the actual constant field of a BPF instruction is
unsigned.
Also, cast away one warning from MSVC.
Diffstat (limited to 'pcap-int.h')
-rw-r--r-- | pcap-int.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -110,7 +110,7 @@ extern "C" { struct pcap_opt { char *device; int timeout; /* timeout for buffering */ - int buffer_size; + u_int buffer_size; int promisc; int rfmon; /* monitor mode */ int immediate; /* immediate mode - deliver packets as soon as they arrive */ @@ -169,7 +169,7 @@ struct pcap { /* * Read buffer. */ - int bufsize; + u_int bufsize; void *buffer; u_char *bp; int cc; |