From 14603ea3764ccdfbe4bc2586d0cd70feea8412e2 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 25 Dec 2016 00:22:31 -0800 Subject: Fix some narrowing warnings. Don't narrow values until it's necessary, and then put in explicit casts to indicate that the narrowing is intentional. Change-Id: I8afc2a457822febbed33cee573953993013a7185 Reviewed-on: https://code.wireshark.org/review/19423 Reviewed-by: Guy Harris --- extcap/udpdump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'extcap/udpdump.c') diff --git a/extcap/udpdump.c b/extcap/udpdump.c index f128929711..adfa514c69 100644 --- a/extcap/udpdump.c +++ b/extcap/udpdump.c @@ -193,8 +193,8 @@ static int setup_dumpfile(const char* fifo, FILE** fp) static void add_proto_name(char* mbuf, guint* offset, const char* proto_name) { - guint proto_str_len = strlen(proto_name); - guint16 proto_name_len = ((proto_str_len + 3) & 0xfffffffc); + size_t proto_str_len = strlen(proto_name); + guint16 proto_name_len = (guint16)((proto_str_len + 3) & 0xfffffffc); mbuf[*offset] = 0; mbuf[*offset+1] = EXP_PDU_TAG_PROTO_NAME; @@ -282,7 +282,7 @@ static int dump_packet(const char* proto_name, const guint16 listenport, const c add_end_options(mbuf, &offset); memcpy(mbuf + offset, buf, buflen); - offset += buflen; + offset += (guint)buflen; if (!libpcap_write_packet(fp, curtime, (guint32)(curtime / 1000), offset, offset, mbuf, &bytes_written, &err)) { g_warning("Can't write packet"); -- cgit v1.2.1