diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-12-25 00:22:31 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-12-25 08:26:21 +0000 |
commit | 14603ea3764ccdfbe4bc2586d0cd70feea8412e2 (patch) | |
tree | 387d88f1504d42451700f1ed31b8a184fc7eff17 | |
parent | 45553db9d1fd72e6d5b79b6c9fd4bdf5d733344c (diff) |
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 <guy@alum.mit.edu>
-rw-r--r-- | extcap/udpdump.c | 6 |
1 files changed, 3 insertions, 3 deletions
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"); |