aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.mathieson@keysight.com>2022-11-20 21:18:22 +0000
committerMartin Mathieson <martin.mathieson@keysight.com>2022-11-22 20:55:24 +0000
commit793365d0e04e43c823521297641bc6ad0ffb6ff1 (patch)
tree2cf2e193e9a0b390a6e58a77ce9e388fd4cc905f
parentec353e89f321487dfad19d4dcf1d68ff38d47a0f (diff)
Fix some issues seen with cppcheck
-rw-r--r--epan/dissectors/packet-amqp.c10
-rw-r--r--epan/dissectors/packet-bgp.c2
-rw-r--r--epan/dissectors/packet-dns.c2
-rw-r--r--epan/dissectors/packet-dtpt.c2
-rw-r--r--epan/dissectors/packet-gtp.c4
-rw-r--r--epan/dissectors/packet-gtpv2.h4
-rw-r--r--epan/dissectors/packet-http.c1
-rw-r--r--epan/dissectors/packet-mpeg-descriptor.c1
-rw-r--r--epan/dissectors/packet-nas_5gs.c9
-rw-r--r--epan/dissectors/packet-pvfs2.c2
-rw-r--r--epan/dissectors/packet-sapms.c2
-rw-r--r--epan/dissectors/packet-saprouter.c2
-rw-r--r--epan/dissectors/packet-umts_fp.c16
-rw-r--r--epan/dissectors/packet-v5ua.c2
-rw-r--r--epan/tvbuff.c6
-rw-r--r--epan/tvbuff_lz77.c2
-rw-r--r--wiretap/catapult_dct2000.c6
-rw-r--r--wiretap/file_wrappers.c2
-rw-r--r--wiretap/logcat.c17
-rw-r--r--wiretap/pcapng.c30
20 files changed, 59 insertions, 63 deletions
diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c
index bb1656d411..0b0be0be5f 100644
--- a/epan/dissectors/packet-amqp.c
+++ b/epan/dissectors/packet-amqp.c
@@ -585,9 +585,9 @@ dissect_amqp_1_0_skip(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
proto_item *item _U_, int hf_amqp_type _U_);
static int
-dissect_amqp_1_0_zero(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
- guint offset _U_, guint length _U_,
- proto_item *item _U_, int hf_amqp_type _U_);
+dissect_amqp_1_0_zero(tvbuff_t *tvb, packet_info *pinfo,
+ guint offset, guint length _U_,
+ proto_item *item, int hf_amqp_type);
static int
dissect_amqp_1_0_true(tvbuff_t *tvb, packet_info *pinfo,
@@ -601,8 +601,8 @@ dissect_amqp_1_0_false(tvbuff_t *tvb, packet_info *pinfo,
static int
format_amqp_1_0_null(tvbuff_t *tvb _U_,
- guint offset, guint length _U_,
- const char **value _U_);
+ guint offset _U_, guint length _U_,
+ const char **value);
static int
format_amqp_1_0_boolean_true(tvbuff_t *tvb, guint offset, guint length _U_,
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c
index c3892b20c5..26a1331c0a 100644
--- a/epan/dissectors/packet-bgp.c
+++ b/epan/dissectors/packet-bgp.c
@@ -4788,7 +4788,7 @@ static int decode_bgp_link_node_nlri_common_fields(tvbuff_t *tvb,
length -= dissected_length;
/* dissect Local Node Descriptors TLV */
- if (length > 0 && length < 4) {
+ if (length < 4) {
expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
"Unknown data in Link-State Link NLRI! length = %d bytes", length);
return dissected_length;
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index c01bb5026d..d10f75e0ec 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -4453,7 +4453,7 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
ext_tree = proto_tree_add_subtree_format(dns_tree, tvb, cur_off, extraneous_length,
ett_dns_extraneous, &it, "Extraneous Data (%d bytes)", extraneous_length);
- it = proto_tree_add_item(ext_tree, hf_dns_extraneous_data, tvb, cur_off, extraneous_length, ENC_NA);
+ proto_tree_add_item(ext_tree, hf_dns_extraneous_data, tvb, cur_off, extraneous_length, ENC_NA);
it = proto_tree_add_int(ext_tree, hf_dns_extraneous_length, tvb, 0, 0, extraneous_length);
proto_item_set_generated(it);
diff --git a/epan/dissectors/packet-dtpt.c b/epan/dissectors/packet-dtpt.c
index 1933adaaa8..42f41ba00d 100644
--- a/epan/dissectors/packet-dtpt.c
+++ b/epan/dissectors/packet-dtpt.c
@@ -426,7 +426,7 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *dtpt_addrs_tree = NULL;
guint32 blob_rawsize = 0;
guint32 blob_size = 0;
- guint32 blob_data_length = 0;
+ guint32 blob_data_length;
queryset_rawsize = tvb_get_letohl(tvb, offset + 0);
if (queryset_rawsize != 60) return 0;
diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c
index 12b4c85043..49cc2cfa94 100644
--- a/epan/dissectors/packet-gtp.c
+++ b/epan/dissectors/packet-gtp.c
@@ -2748,11 +2748,11 @@ static int decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinf
static int decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
-static int decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
+static int decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
-static int decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
+static int decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_ext_enodeb_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_ext_sel_mode_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
static int decode_gtp_ext_uli_timestamp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
diff --git a/epan/dissectors/packet-gtpv2.h b/epan/dissectors/packet-gtpv2.h
index a4ba27386d..b6d61d4f54 100644
--- a/epan/dissectors/packet-gtpv2.h
+++ b/epan/dissectors/packet-gtpv2.h
@@ -12,11 +12,11 @@ extern void dissect_gtpv2_ie_common(tvbuff_t* tvb, packet_info* pinfo _U_, proto
extern void dissect_gtpv2_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
extern void dissect_gtpv2_mbms_session_duration(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
-extern void dissect_gtpv2_mbms_time_to_data_xfer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
+extern void dissect_gtpv2_mbms_time_to_data_xfer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
extern void dissect_gtpv2_arp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
extern void dissect_gtpv2_fq_csid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
extern void dissect_gtpv2_selec_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
-extern void dissect_gtpv2_epc_timer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
+extern void dissect_gtpv2_epc_timer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
extern void dissect_gtpv2_twan_identifier(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
/*Used by custom dissector*/
extern gchar* dissect_gtpv2_tai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, gboolean is_5gs);
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 86a5045036..83d0fb9c38 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -3982,7 +3982,6 @@ dissect_http_heur_tls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
return FALSE;
}
- conv_data = get_http_conversation_data(pinfo, &conversation);
dissect_http_tls(tvb, pinfo, tree, data);
return TRUE;
}
diff --git a/epan/dissectors/packet-mpeg-descriptor.c b/epan/dissectors/packet-mpeg-descriptor.c
index 7e6121ba39..8447a28a0c 100644
--- a/epan/dissectors/packet-mpeg-descriptor.c
+++ b/epan/dissectors/packet-mpeg-descriptor.c
@@ -4051,7 +4051,6 @@ proto_mpeg_descriptor_dissect_nordig_lcd_v2(tvbuff_t *tvb, guint offset, guint l
guint8 channel_list_id;
guint8 channel_list_name_length;
guint8 descriptor_length;
- if (cnt < 1) return;
channel_list_id = tvb_get_guint8(tvb, offset);
channel_list_tree = proto_tree_add_subtree_format(tree, tvb, offset, ch_list_len,
diff --git a/epan/dissectors/packet-nas_5gs.c b/epan/dissectors/packet-nas_5gs.c
index 57404de50a..fb294c6d6c 100644
--- a/epan/dissectors/packet-nas_5gs.c
+++ b/epan/dissectors/packet-nas_5gs.c
@@ -4026,7 +4026,7 @@ de_nas_5gs_mm_extended_rejected_nssai(tvbuff_t* tvb, proto_tree* tree, packet_in
proto_tree* sub_partial_tree;
proto_tree* sub_rejected_tree;
proto_item* item;
- int i = 1;
+ int i;
guint num_partial_items = 1;
guint32 curr_offset = offset;
guint32 type_of_list, number_of_element, nssai_len;
@@ -10256,10 +10256,9 @@ dissect_nas_5gs_media_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
str = json_get_string(json_data, cur_tok, "contentId");
} else {
/* TS 29.502 ch6.1.6.4.4 n1SmInfoFromUe, n1SmInfoToUe, unknownN1SmInfo */
- if (!cur_tok) {
- cur_tok = json_get_object(json_data, tokens, N1_SMINFO_FROM_UE);
- n1_msg_class = N1_SMINFO_FROM_UE;
- }
+ cur_tok = json_get_object(json_data, tokens, N1_SMINFO_FROM_UE);
+ n1_msg_class = N1_SMINFO_FROM_UE;
+
if (!cur_tok) {
cur_tok = json_get_object(json_data, tokens, N1_SMINFO_TO_UE);
n1_msg_class = N1_SMINFO_TO_UE;
diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c
index c76590e3a1..8c22cbff89 100644
--- a/epan/dissectors/packet-pvfs2.c
+++ b/epan/dissectors/packet-pvfs2.c
@@ -717,7 +717,7 @@ dissect_pvfs2_attrmask(tvbuff_t *tvb, proto_tree *tree, int offset,
for (i = 0; i < 32; i++)
{
- if (attrmask & (1 << i))
+ if (attrmask & (1u << i))
proto_tree_add_uint(attrtree, hf_pvfs_attr, tvb, offset, 4, i);
}
diff --git a/epan/dissectors/packet-sapms.c b/epan/dissectors/packet-sapms.c
index 4e6a3b9750..7955ddfdfe 100644
--- a/epan/dissectors/packet-sapms.c
+++ b/epan/dissectors/packet-sapms.c
@@ -662,7 +662,7 @@ dissect_sapms_adm_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
proto_item *record = NULL, *value = NULL;
proto_tree *record_tree = NULL, *value_tree = NULL;
- guint8 adm_opcode = 0;
+ guint8 adm_opcode;
while (length>=104){
diff --git a/epan/dissectors/packet-saprouter.c b/epan/dissectors/packet-saprouter.c
index 763a3eab3a..9acd3dce42 100644
--- a/epan/dissectors/packet-saprouter.c
+++ b/epan/dissectors/packet-saprouter.c
@@ -416,7 +416,7 @@ static int
dissect_saprouter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
tvbuff_t *next_tvb = NULL;
- guint8 opcode = 0;
+ guint8 opcode;
guint32 offset = 0, eyecatcher_length = 0;
conversation_t *conversation = NULL;
saprouter_session_state *session_state = NULL;
diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c
index 9b70b8a909..b8f9636aea 100644
--- a/epan/dissectors/packet-umts_fp.c
+++ b/epan/dissectors/packet-umts_fp.c
@@ -1486,7 +1486,7 @@ dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 ft;
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
- guint header_length = 0;
+ guint header_length;
/* Header CRC */
header_crc_pi = proto_tree_add_item_ret_uint(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN, &header_crc);
@@ -1742,7 +1742,7 @@ dissect_fach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 ft;
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
- guint header_length = 0;
+ guint header_length;
/* Header CRC */
header_crc_pi = proto_tree_add_item_ret_uint(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN, &header_crc);
@@ -2538,7 +2538,7 @@ dissect_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
guint32 ft;
guint32 cfn;
- guint header_length = 0;
+ guint header_length;
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
@@ -2613,7 +2613,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
proto_item * item;
- guint header_length = 0;
+ guint header_length;
rlc_info * rlcinf;
if (p_fp_info->edch_type == 1) {
@@ -2645,7 +2645,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
else {
/********************************/
/* E-DCH data here */
- guint bit_offset = 0;
+ guint bit_offset;
guint total_pdus = 0;
guint total_bits = 0;
gboolean dissected = FALSE;
@@ -3169,7 +3169,7 @@ dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset, struct fp_info *p_fp_info, void *data)
{
guint32 ft;
- guint header_length = 0;
+ guint header_length;
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
@@ -3388,7 +3388,7 @@ dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree
guint32 ft;
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
- guint16 header_length = 0;
+ guint16 header_length;
/* Header CRC */
header_crc_pi = proto_tree_add_item_ret_uint(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN, &header_crc);
@@ -3649,7 +3649,7 @@ void dissect_hsdsch_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto
guint32 ft;
guint32 header_crc = 0;
proto_item * header_crc_pi = NULL;
- guint header_length = 0;
+ guint header_length;
/* Header CRC */
header_crc_pi = proto_tree_add_item_ret_uint(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN, &header_crc);
diff --git a/epan/dissectors/packet-v5ua.c b/epan/dissectors/packet-v5ua.c
index 0859b51518..150ee4a323 100644
--- a/epan/dissectors/packet-v5ua.c
+++ b/epan/dissectors/packet-v5ua.c
@@ -246,7 +246,7 @@ dissect_dlci_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, prot
"ISDN (%u)", efa);
proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:ISDN (%u))",sapi,tei,efa);
}
- else if (efa > 8175 && efa <= 8180){
+ else if (efa <= 8180){
proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa,
"%s (%u)", val_to_str_const(efa, efa_values, "unknown EFA"),tvb_get_ntohs(parameter_tvb, offset));
proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:%s (%u))",sapi,tei,val_to_str_const(efa, efa_values, "unknown EFA-value"),efa);
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index ab1c075fb9..99d37ed68b 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -132,7 +132,7 @@ tvb_new_chain(tvbuff_t *parent, tvbuff_t *backing)
void
tvb_add_to_chain(tvbuff_t *parent, tvbuff_t *child)
{
- tvbuff_t *tmp = child;
+ tvbuff_t *tmp;
DISSECTOR_ASSERT(parent);
DISSECTOR_ASSERT(child);
@@ -4208,7 +4208,7 @@ tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next
gint
tvb_skip_wsp(tvbuff_t *tvb, const gint offset, const gint maxlength)
{
- gint counter = offset;
+ gint counter;
gint end, tvb_len;
guint8 tempchar;
@@ -4237,7 +4237,7 @@ tvb_skip_wsp(tvbuff_t *tvb, const gint offset, const gint maxlength)
gint
tvb_skip_wsp_return(tvbuff_t *tvb, const gint offset)
{
- gint counter = offset;
+ gint counter;
guint8 tempchar;
DISSECTOR_ASSERT(tvb && tvb->initialized);
diff --git a/epan/tvbuff_lz77.c b/epan/tvbuff_lz77.c
index 2cbfe5a7b0..08e711ca1d 100644
--- a/epan/tvbuff_lz77.c
+++ b/epan/tvbuff_lz77.c
@@ -38,7 +38,7 @@ static gboolean do_uncompress(tvbuff_t *tvb, int offset, int in_size,
buf_flag_count = 32;
}
buf_flag_count--;
- if ((buf_flags & (1 << buf_flag_count)) == 0) {
+ if ((buf_flags & (1u << buf_flag_count)) == 0) {
guint8 v = tvb_get_guint8(tvb, offset+in_off);
wmem_array_append_one(obuf, v);
in_off++;
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c
index 9d4a5a0f69..f0dadd88ff 100644
--- a/wiretap/catapult_dct2000.c
+++ b/wiretap/catapult_dct2000.c
@@ -819,10 +819,10 @@ parse_line(gchar *linebuff, gint line_length,
int n = 0;
int port_digits;
char port_number_string[MAX_PORT_DIGITS+1];
- int variant_digits = 0;
+ int variant_digits;
int variant = 1;
- int protocol_chars = 0;
- int outhdr_chars = 0;
+ int protocol_chars;
+ int outhdr_chars;
char seconds_buff[MAX_SECONDS_CHARS+1];
int seconds_chars;
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index a513389648..cda6c6f6bc 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -2202,7 +2202,7 @@ gzwfile_close(GZWFILE_T state)
int ret = 0;
/* flush, free memory, and close file */
- if (gz_comp(state, Z_FINISH) == -1 && ret == 0)
+ if (gz_comp(state, Z_FINISH) == -1)
ret = state->err;
(void)deflateEnd(&(state->strm));
g_free(state->out);
diff --git a/wiretap/logcat.c b/wiretap/logcat.c
index f4f8bef6d6..da4d13e006 100644
--- a/wiretap/logcat.c
+++ b/wiretap/logcat.c
@@ -267,15 +267,14 @@ wtap_open_return_val logcat_open(wtap *wth, int *err, gchar **err_info)
return WTAP_OPEN_ERROR; /* I/O error */
if (tmp_version == 0)
return WTAP_OPEN_NOT_MINE; /* not a logcat file */
- if (tmp_version != -2) {
- /*
- * we've read three packets and the first two have the same
- * version; does the third have the same version?
- */
- if (tmp_version != version) {
- /* no, so this is presumably not a logcat file */
- return WTAP_OPEN_NOT_MINE;
- }
+
+ /*
+ * we've read three packets and the first two have the same
+ * version; does the third have the same version?
+ */
+ if (tmp_version != version) {
+ /* no, so this is presumably not a logcat file */
+ return WTAP_OPEN_NOT_MINE;
}
}
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index ed3fdd08e0..6f6b977e99 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -3999,7 +3999,7 @@ static guint32 pcapng_compute_packet_verdict_option_size(wtap_optval_t *optval)
static gboolean
compute_block_option_size(wtap_block_t block _U_, guint option_id, wtap_opttype_e option_type, wtap_optval_t *optval, void *user_data)
{
- compute_options_size_t* compute_options_size = (compute_options_size_t*)user_data;
+ compute_options_size_t* options_size = (compute_options_size_t*)user_data;
guint32 size = 0;
/*
@@ -4027,7 +4027,7 @@ compute_block_option_size(wtap_block_t block _U_, guint option_id, wtap_opttype_
break;
default:
/* Block-type dependent; call the callback. */
- size = (*compute_options_size->compute_option_size)(block, option_id, option_type, optval);
+ size = (*options_size->compute_option_size)(block, option_id, option_type, optval);
break;
}
@@ -4039,15 +4039,15 @@ compute_block_option_size(wtap_block_t block _U_, guint option_id, wtap_opttype_
* Yes. Add the size of the option header to the size of the
* option data.
*/
- compute_options_size->size += 4;
+ options_size->size += 4;
/* Now add the size of the option value. */
- compute_options_size->size += size;
+ options_size->size += size;
/* Add optional padding to 32 bits */
if ((size & 0x03) != 0)
{
- compute_options_size->size += 4 - (size & 0x03);
+ options_size->size += 4 - (size & 0x03);
}
}
return TRUE; /* we always succeed */
@@ -4605,7 +4605,7 @@ static gboolean pcapng_write_packet_verdict_option(wtap_dumper *wdh, guint optio
static gboolean write_block_option(wtap_block_t block, guint option_id, wtap_opttype_e option_type _U_, wtap_optval_t *optval, void* user_data)
{
- write_options_t* write_options = (write_options_t*)user_data;
+ write_options_t* options = (write_options_t*)user_data;
/*
* Process the option IDs that are the same for all block types here;
@@ -4614,12 +4614,12 @@ static gboolean write_block_option(wtap_block_t block, guint option_id, wtap_opt
switch(option_id)
{
case OPT_COMMENT:
- if (!pcapng_write_string_option(write_options->wdh, option_id, optval, write_options->err))
+ if (!pcapng_write_string_option(options->wdh, option_id, optval, options->err))
return FALSE;
break;
case OPT_CUSTOM_STR_COPY:
case OPT_CUSTOM_BIN_COPY:
- if (!pcapng_write_custom_option(write_options->wdh, option_id, optval, write_options->err))
+ if (!pcapng_write_custom_option(options->wdh, option_id, optval, options->err))
return FALSE;
break;
case OPT_CUSTOM_STR_NO_COPY:
@@ -4634,8 +4634,8 @@ static gboolean write_block_option(wtap_block_t block, guint option_id, wtap_opt
break;
default:
/* Block-type dependent; call the callback, if we have one. */
- if (write_options->write_option != NULL &&
- !(*write_options->write_option)(write_options->wdh, block, option_id, option_type, optval, write_options->err))
+ if (options->write_option != NULL &&
+ !(*options->write_option)(options->wdh, block, option_id, option_type, optval, options->err))
return FALSE;
break;
}
@@ -4645,12 +4645,12 @@ static gboolean write_block_option(wtap_block_t block, guint option_id, wtap_opt
static gboolean
write_options(wtap_dumper *wdh, wtap_block_t block, write_option_func write_option, int *err)
{
- write_options_t write_options;
+ write_options_t options;
- write_options.wdh = wdh;
- write_options.err = err;
- write_options.write_option = write_option;
- if (!wtap_block_foreach_option(block, write_block_option, &write_options))
+ options.wdh = wdh;
+ options.err = err;
+ options.write_option = write_option;
+ if (!wtap_block_foreach_option(block, write_block_option, &options))
return FALSE;
/* Write end of options */