diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-03-19 13:14:33 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-03-19 13:14:33 -0700 |
commit | 909431013ea2e395d836f15f3508b55a98af7f15 (patch) | |
tree | 632ae92e80ab243afced2155f09ca09f41574bcd /pcap-usb-linux.c | |
parent | 4ccdc8a3cbf5195a7c089002136e53db541b36ba (diff) |
Squelch some compiler warnings.
The size of the USB metadata header will be small enough to fit into an
int; make the header_size argument to usb_set_ring_size() an int, and
add casts just in case some compilers don't realize that 48 and 64 fit
comfortably into an int.
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r-- | pcap-usb-linux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index f202cb62..fbf6206a 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -388,7 +388,7 @@ usb_findalldevs(pcap_if_list_t *devlistp, char *err_str) #define MAX_RING_SIZE (1200*1024) static int -usb_set_ring_size(pcap_t* handle, size_t header_size) +usb_set_ring_size(pcap_t* handle, int header_size) { /* * A packet from binary usbmon has: @@ -412,7 +412,7 @@ usb_set_ring_size(pcap_t* handle, size_t header_size) */ int ring_size; - if ((size_t)handle->snapshot < header_size) + if (handle->snapshot < header_size) handle->snapshot = header_size; /* The maximum snapshot size is small enough that this won't overflow */ ring_size = (handle->snapshot - header_size) * 5; @@ -460,7 +460,7 @@ int usb_mmap(pcap_t* handle) * length, reducing the snapshot length if that'd make the ring * bigger than the kernel supports. */ - len = usb_set_ring_size(handle, sizeof(pcap_usb_header_mmapped)); + len = usb_set_ring_size(handle, (int)sizeof(pcap_usb_header_mmapped)); if (len == -1) { /* Failed. Fall back on non-memory-mapped access. */ return 0; @@ -715,7 +715,7 @@ usb_activate(pcap_t* handle) * if that'd make the ring bigger than the kernel * supports. */ - if (usb_set_ring_size(handle, sizeof(pcap_usb_header)) == -1) { + if (usb_set_ring_size(handle, (int)sizeof(pcap_usb_header)) == -1) { /* Failed. */ close(handle->fd); return PCAP_ERROR; |