From 905d87a28fe8fc61691373dddb16c57ebab0f58b Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Fri, 4 Jan 2019 14:12:45 +0100 Subject: [PATCH] wiretap: fix code according to clang-tidy. Change-Id: I7f539968e9dce3a49112b7aeaa052b8cdb7501a6 Reviewed-on: https://code.wireshark.org/review/31364 Petri-Dish: Dario Lombardo Reviewed-by: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- wiretap/logcat_text.c | 6 +++--- wiretap/pcapng.c | 2 +- wiretap/pcapng_module.h | 4 ++-- wiretap/pppdump.c | 2 +- wiretap/vms.c | 8 ++++---- wiretap/vwr.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wiretap/logcat_text.c b/wiretap/logcat_text.c index 11d51d47ae..2191c2ad8d 100644 --- a/wiretap/logcat_text.c +++ b/wiretap/logcat_text.c @@ -161,13 +161,13 @@ static void get_time(gchar *string, wtap_rec *rec) { date.tm_mon -= 1; date.tm_isdst = -1; seconds = mktime(&date); - rec->ts.secs = (time_t) seconds; + rec->ts.secs = seconds; rec->ts.nsecs = (int) (ms * 1e6); rec->presence_flags = WTAP_HAS_TS; } else { rec->presence_flags = 0; rec->ts.secs = (time_t) 0; - rec->ts.nsecs = (int) 0; + rec->ts.nsecs = 0; } } @@ -231,7 +231,7 @@ static gboolean logcat_text_read_packet(FILE_T fh, wtap_rec *rec, } else { rec->presence_flags = 0; rec->ts.secs = (time_t) 0; - rec->ts.nsecs = (int) 0; + rec->ts.nsecs = 0; } memcpy(pd, cbuff, rec->rec_header.packet_header.caplen + 1); g_free(cbuff); diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 378c6c97a6..dfa028cab6 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -927,7 +927,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, pcapng_debug("pcapng_read_if_descr_block: if_filter_str %s oh.option_length %u", if_filter.if_filter_str, oh.option_length); } else if (option_content[0] == 1) { if_filter.bpf_filter_len = oh.option_length-1; - if_filter.if_filter_bpf_bytes = (guint8 *)option_content+1; + if_filter.if_filter_bpf_bytes = option_content+1; } /* Fails with multiple options; we silently ignore the failure */ wtap_block_add_custom_option(wblock->block, oh.option_code, &if_filter, sizeof if_filter); diff --git a/wiretap/pcapng_module.h b/wiretap/pcapng_module.h index 78396f4265..483082226d 100644 --- a/wiretap/pcapng_module.h +++ b/wiretap/pcapng_module.h @@ -60,8 +60,8 @@ typedef gboolean (*block_writer)(wtap_dumper *, const wtap_rec *, * Register a handler for a pcapng block type. */ WS_DLL_PUBLIC -void register_pcapng_block_type_handler(guint block_type, block_reader read, - block_writer write); +void register_pcapng_block_type_handler(guint block_type, block_reader reader, + block_writer writer); /* * Handler routine for pcapng option type. diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index 67e801a30e..7c2b28160c 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -197,7 +197,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, int *err, gchar **err_info, pkt_id *pid); static gboolean -collate(pppdump_t*, FILE_T fh, int *err, gchar **err_info, guint8 *pd, +collate(pppdump_t *state, FILE_T fh, int *err, gchar **err_info, guint8 *pd, int *num_bytes, direction_enum *direction, pkt_id *pid, gint64 num_bytes_to_skip); diff --git a/wiretap/vms.c b/wiretap/vms.c index 5dee35fab6..978a4e53e0 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -482,7 +482,7 @@ parse_vms_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_in */ static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, long byte_offset, - int in_off, int remaining) { + int in_off, int remaining_bytes) { int i; char *s; @@ -499,14 +499,14 @@ parse_single_hex_dump_line(char* rec, guint8 *buf, long byte_offset, return FALSE; } - if (remaining > 16) - remaining = 16; + if (remaining_bytes > 16) + remaining_bytes = 16; /* Read the octets right to left, as that is how they are displayed * in VMS. */ - for (i = 0; i < remaining; i++) { + for (i = 0; i < remaining_bytes; i++) { lbuf[0] = rec[offsets[i] + in_off]; lbuf[1] = rec[offsets[i] + 1 + in_off]; diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 1e01add146..67a886edec 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -771,12 +771,12 @@ static guint8 get_cck_rate(const guint8 *plcp); static void setup_defaults(vwr_t *, guint16); static gboolean vwr_read(wtap *, int *, gchar **, gint64 *); -static gboolean vwr_seek_read(wtap *, gint64, wtap_rec *rec, +static gboolean vwr_seek_read(wtap *, gint64, wtap_rec *record, Buffer *, int *, gchar **); static gboolean vwr_read_rec_header(vwr_t *, FILE_T, int *, int *, int *, int *, gchar **); static gboolean vwr_process_rec_data(FILE_T fh, int rec_size, - wtap_rec *rec, Buffer *buf, + wtap_rec *record, Buffer *buf, vwr_t *vwr, int IS_TX, int log_mode, int *err, gchar **err_info); -- 2.34.1