aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-12-20 02:33:15 +0000
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-12-21 01:30:06 +0000
commit4448b6494e0f6bece719160e652fb872be32eb21 (patch)
treede9c76bc675e57391e72370ff5479fa08590c9c6 /dumpcap.c
parent36d5aad962f6c481a4aed09a0a8f7a575fcbdd12 (diff)
Add a ws_posix_compat.h header
Currently used to define ssize_t on platforms that lack it. Fix some Windows build errors caused by moving the definition into a separate header. Fix some narrowing warnings on Windows x64 from changing the definition of ssize_t from long int to int64_t. The casts in dumpcap are ugly but necessary. The whole code needs to be rewritten for portability, or the warnings disabled.
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/dumpcap.c b/dumpcap.c
index fe1b133d80..3492283180 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -1260,7 +1260,7 @@ static void *cap_thread_read(void *arg)
break;
}
} else {
- bytes_read += b;
+ bytes_read += (DWORD)b;
}
}
#ifdef _WIN32
@@ -1485,7 +1485,11 @@ cap_pipe_read_data_bytes(capture_src *pcap_src, char *errmsg, size_t errmsgl)
}
return -1;
}
+#ifdef _WIN32
+ bytes_read += (DWORD)b;
+#else
bytes_read += b;
+#endif
}
}
pcap_src->cap_pipe_bytes_read += bytes_read;
@@ -2317,7 +2321,11 @@ pcap_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t er
result = PD_PIPE_ERR;
break;
}
+#ifdef _WIN32
+ pcap_src->cap_pipe_bytes_read += (DWORD)b;
+#else
pcap_src->cap_pipe_bytes_read += b;
+#endif
}
#ifdef _WIN32
else {
@@ -2374,7 +2382,11 @@ pcap_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t er
result = PD_PIPE_ERR;
break;
}
+#ifdef _WIN32
+ pcap_src->cap_pipe_bytes_read += (DWORD)b;
+#else
pcap_src->cap_pipe_bytes_read += b;
+#endif
}
#ifdef _WIN32
else {