diff options
author | Gerald Combs <gerald@wireshark.org> | 2022-11-08 09:24:16 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2022-11-08 13:49:44 -0800 |
commit | 85357ae721105ad371f55494f72f7c9c29db538f (patch) | |
tree | a01ab3d1f54366fa0d26ae91bfbf592465f68e21 /epan | |
parent | b662f565f045fb1a778d409c16a2d8a3a12cdc23 (diff) |
Fix more unused variables and enable unused-but-set-variable errors.
Add -Werror=unused-but-set-variable to our default compiler flags and fix
```
epan/dissectors/packet-dcerpc-frsrpc.c:709:10: error: variable 'nb_chunk' set but not used [-Werror,-Wunused-but-set-variable]
guint32 nb_chunk = 0;
^
```
```
epan/dissectors/packet-dcom-oxid.c:175:13: error: variable 'u32ItemIdx' set but not used [-Werror,-Wunused-but-set-variable]
guint32 u32ItemIdx;
^
```
```
epan/dissectors/packet-l2tp.c:1775:104: error: parameter 'ccid' set but not used [-Werror,-Wunused-but-set-parameter]
static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid)
^
```
```
epan/dissectors/packet-ldp.c:1922:19: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
guint8 ix;
^
```
```
epan/dissectors/packet-nas_5gs.c:4757:14: error: variable 'curr_len' set but not used [-Werror,-Wunused-but-set-variable]
guint i, curr_len;
^
```
```
epan/dissectors/packet-per.c:1769:6: error: variable 'extension_addition_entries' set but not used [-Werror,-Wunused-but-set-variable]
int extension_addition_entries;
^
```
```
epan/dissectors/packet-rtitcp.c:618:11: error: variable 'messages_count' set but not used [-Werror,-Wunused-but-set-variable]
guint messages_count, offset;
^
```
```
epan/dissectors/packet-tcp.c:2130:9: error: variable 'ackcount' set but not used [-Werror,-Wunused-but-set-variable]
int ackcount;
^
epan/dissectors/packet-tcp.c:3317:12: error: variable 'nbOptionsChanged' set but not used [-Werror,-Wunused-but-set-variable]
guint8 nbOptionsChanged = 0;
^
```
```
epan/dissectors/packet-zbee-zcl-se.c:11802:15: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
for (gint i = 0; tvb_reported_length_remaining(tvb, *offset) >= 5; i++) {
^
```
```
ui/iface_lists.c:142:23: error: variable 'linktype_count' set but not used [-Werror,-Wunused-but-set-variable]
gint linktype_count;
^
```
```
ui/voip_calls.c:456:15: error: variable 'item_num' set but not used [-Werror,-Wunused-but-set-variable]
guint item_num;
^
```
```
file.c:572:17: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
guint32 count = 0;
^
```
```
file.c:3667:24: warning: cast from 'const unsigned char *' to 'unsigned char *' drops const qualifier [-Wcast-qual]
pd = (guint8 *)ws_mempbrk_exec(pd, buf_end - pd, pattern, &c_char);
^
```
```
ui/qt/io_graph_dialog.cpp:1932:60: error: variable 'mavg_right' set but not used [-Werror,-Wunused-but-set-variable]
unsigned int mavg_in_average_count = 0, mavg_left = 0, mavg_right = 0;
^
```
```
ui/qt/stats_tree_dialog.cpp:166:9: error: variable 'node_count' set but not used [-Werror,-Wunused-but-set-variable]
int node_count = 0;
^
```
```
ui/qt/models/profile_model.cpp:1142:13: error: variable 'entryCount' set but not used [-Werror,-Wunused-but-set-variable]
int entryCount = 0;
^
```
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-dcerpc-frsrpc.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-dcom-oxid.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-l2tp.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ldp.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-nas_5gs.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-rtitcp.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl-se.c | 2 |
9 files changed, 9 insertions, 30 deletions
diff --git a/epan/dissectors/packet-dcerpc-frsrpc.c b/epan/dissectors/packet-dcerpc-frsrpc.c index 5d506f487b..b733ae200b 100644 --- a/epan/dissectors/packet-dcerpc-frsrpc.c +++ b/epan/dissectors/packet-dcerpc-frsrpc.c @@ -663,7 +663,7 @@ frsrpc_dissect_struct_CommPktChunk(tvbuff_t *tvb _U_, int offset _U_, packet_inf item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); tree = proto_item_add_subtree(item, ett_frsrpc_frsrpc_CommPktChunk); } - + offset = frsrpc_dissect_element_CommPktChunk_type(tvb, offset, pinfo, tree, di, drep, &type); offset = frsrpc_dissect_element_CommPktChunk_data(tvb, offset, pinfo, tree, di, drep, &type); for (i=0; frsrpc_frsrpc_CommPktChunkType_vals[i].strptr; i++) { @@ -706,14 +706,13 @@ frsrpc_dissect_enum_CommPktCommand(tvbuff_t *tvb _U_, int offset _U_, packet_inf static int frsrpc_dissect_struct_frsrpc_CommPktChunkCtr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info* di, guint8 *drep _U_, int hf_index, guint32 param _U_) { - guint32 nb_chunk = 0; guint32 remaining = tvb_reported_length_remaining(tvb, offset); int align_status = di->no_align; if (remaining > 0) { proto_item *item = proto_tree_add_item(tree, hf_index, tvb, offset, -1, TRUE); proto_tree *subtree = proto_item_add_subtree(item, ett_ChunkCtr); di->no_align = 1; - for(nb_chunk = 0; remaining > 0; nb_chunk++) { + while (remaining > 0) { offset = frsrpc_dissect_struct_CommPktChunk(tvb, offset, pinfo, subtree, di, drep, hf_CommPktChunk, param); remaining = tvb_reported_length_remaining(tvb, offset); } diff --git a/epan/dissectors/packet-dcom-oxid.c b/epan/dissectors/packet-dcom-oxid.c index 09bd914911..0accf0e21d 100644 --- a/epan/dissectors/packet-dcom-oxid.c +++ b/epan/dissectors/packet-dcom-oxid.c @@ -172,7 +172,6 @@ dissect_oxid_resolve_oxid2_rqst(tvbuff_t *tvb, int offset, { guint16 u16ProtSeqs; guint32 u32ArraySize; - guint32 u32ItemIdx; offset = dissect_dcom_ID(tvb, offset, pinfo, tree, di, drep, @@ -184,11 +183,9 @@ dissect_oxid_resolve_oxid2_rqst(tvbuff_t *tvb, int offset, offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); - u32ItemIdx = 1; while (u32ArraySize--) { offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_oxid_protseqs, &u16ProtSeqs); - u32ItemIdx++; } return offset; diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 08e6b1316b..fd2181d3cd 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -1772,7 +1772,7 @@ static int dissect_l2tp_ericsson_tei_sc_map(tvbuff_t *tvb, proto_tree *parent_tr return offset; } -static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid) +static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid _U_) { int offset = 0; int avp_type; @@ -1813,8 +1813,6 @@ static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, pro offset += 2; avp_len -= 2; - ccid++; - switch (avp_type) { case ERICSSON_MSG_TYPE: proto_tree_add_item_ret_uint(l2tp_avp_tree, hf_l2tp_ericsson_msg_type, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_type); diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c index a8758d6e23..eb1bcfcaa2 100644 --- a/epan/dissectors/packet-ldp.c +++ b/epan/dissectors/packet-ldp.c @@ -1919,11 +1919,10 @@ static void dissect_tlv_mac(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem) { proto_tree *val_tree; - guint8 ix; val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "MAC addresses"); - for(ix=1; rem >= 6; ix++, offset += 6, rem -= 6) { + for(; rem >= 6; offset += 6, rem -= 6) { proto_tree_add_item(val_tree, hf_ldp_tlv_mac, tvb, offset, 6, ENC_NA); } if (rem) diff --git a/epan/dissectors/packet-nas_5gs.c b/epan/dissectors/packet-nas_5gs.c index 3a5c066d3e..57404de50a 100644 --- a/epan/dissectors/packet-nas_5gs.c +++ b/epan/dissectors/packet-nas_5gs.c @@ -4754,9 +4754,8 @@ de_nas_5gs_sm_mapped_eps_b_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pi proto_tree * sub_tree, *sub_tree1; guint32 num_cont, length, opt_code, num_eps_parms, param_id; proto_item * item; - guint i, curr_len; + guint i; - curr_len = len; curr_offset = offset; num_cont = 1; @@ -4785,12 +4784,10 @@ de_nas_5gs_sm_mapped_eps_b_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pi /* EPS bearer identity */ proto_tree_add_item(sub_tree, hf_nas_5gs_sm_mapd_eps_b_cont_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; - curr_len--; /* Length of Mapped EPS bearer context*/ proto_tree_add_item_ret_uint(sub_tree, hf_nas_5gs_sm_length, tvb, curr_offset, 2, ENC_BIG_ENDIAN, &length); curr_offset += 2; - curr_len -= 2; /* 8 7 6 5 4 3 2 1 */ /* operation code | spare | E | number of EPS params */ @@ -4810,7 +4807,6 @@ de_nas_5gs_sm_mapped_eps_b_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pi } curr_offset++; - curr_len--; i = 1; /* EPS parameters list */ @@ -4823,12 +4819,10 @@ de_nas_5gs_sm_mapped_eps_b_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pi proto_tree_add_item_ret_uint(sub_tree1, hf_nas_5gs_sm_mapd_eps_b_cont_param_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN, ¶m_id); proto_item_append_text(item, " - %s", val_to_str_const(param_id, nas_5gs_sm_mapd_eps_b_cont_param_id_vals, "Unknown")); curr_offset++; - curr_len--; /*length of the EPS parameter contents field */ proto_tree_add_item_ret_uint(sub_tree1, hf_nas_5gs_sm_length, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &length); curr_offset++; - curr_len--; proto_item_set_len(item, length + 2); /*content of the EPS parameter contents field */ @@ -4858,7 +4852,6 @@ de_nas_5gs_sm_mapped_eps_b_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pi break; } curr_offset +=length; - curr_len -= length; i++; num_eps_parms--; } diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 8a540b8fa3..1f136e2645 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -1766,7 +1766,6 @@ dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree * { gboolean /*extension_present,*/ extension_flag; int extension_root_entries; - int extension_addition_entries; guint32 choice_index; int i, idx, cidx; guint32 ext_length = 0; @@ -1790,7 +1789,6 @@ DEBUG_ENTRY("dissect_per_choice"); /* count the number of entries in the extension root and extension addition */ extension_root_entries = 0; - extension_addition_entries = 0; for (i=0; choice[i].p_id; i++) { switch(choice[i].extension){ case ASN1_NO_EXTENSIONS: @@ -1798,7 +1796,6 @@ DEBUG_ENTRY("dissect_per_choice"); extension_root_entries++; break; case ASN1_NOT_EXTENSION_ROOT: - extension_addition_entries++; break; } } diff --git a/epan/dissectors/packet-rtitcp.c b/epan/dissectors/packet-rtitcp.c index c8408c309a..d58ae19702 100644 --- a/epan/dissectors/packet-rtitcp.c +++ b/epan/dissectors/packet-rtitcp.c @@ -615,19 +615,16 @@ static guint16 dissect_control_message(proto_tree *rtitcp_tree, tvbuff_t *tvb, p /* This function dissects all the control messages found */ static guint dissect_rtitcp_control_protocol(proto_tree *rtitcp_tree, tvbuff_t *tvb, packet_info *pinfo) { - guint messages_count, offset; + guint offset; guint16 msg_length; guint32 tvb_len; offset = 0; tvb_len = tvb_reported_length(tvb); - messages_count = 0; - while (offset < tvb_len) { msg_length = dissect_control_message(rtitcp_tree, tvb, pinfo, offset); offset += msg_length; - ++messages_count; } return offset; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 3c79de5d10..db5ec84197 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -2127,7 +2127,6 @@ tcp_analyze_sequence_number(packet_info *pinfo, guint32 seq, guint32 ack, guint3 tcp_unacked_t *ual=NULL; tcp_unacked_t *prevual=NULL; guint32 nextseq; - int ackcount; #if 0 printf("\nanalyze_sequence numbers frame:%u\n",pinfo->num); @@ -2673,7 +2672,6 @@ finished_checking_retransmission_type: /* remove all segments this ACKs and we don't need to keep around any more */ - ackcount=0; prevual = NULL; ual = tcpd->rev->tcp_analyze_seq_info->segments; while(ual) { @@ -2698,7 +2696,6 @@ finished_checking_retransmission_type: } /* This segment is old, or an exact match. Delete the segment from the list */ - ackcount++; tmpual=ual->next; if (tcpd->rev->scps_capable) { @@ -3313,6 +3310,7 @@ mptcp_add_analysis_subtree(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent proto_item_set_generated(item); +#if 0 // nbOptionsChanged is currently unused. /* store the TCP Options related to MPTCP then we will avoid false DUP ACKs later */ guint8 nbOptionsChanged = 0; if((tcpd->mptcp_analysis->mp_operations&(0x01))!=tcph->th_mptcp->mh_mpc) { @@ -3348,6 +3346,7 @@ mptcp_add_analysis_subtree(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent nbOptionsChanged++; } /* we could track MPTCP option changes here, with nbOptionsChanged */ +#endif item = proto_tree_add_uint(tree, hf_mptcp_stream, tvb, 0, 0, mptcpd->stream); proto_item_set_generated(item); diff --git a/epan/dissectors/packet-zbee-zcl-se.c b/epan/dissectors/packet-zbee-zcl-se.c index ed852cd120..d91e862f36 100644 --- a/epan/dissectors/packet-zbee-zcl-se.c +++ b/epan/dissectors/packet-zbee-zcl-se.c @@ -11799,7 +11799,7 @@ dissect_zcl_calendar_publish_seasons(tvbuff_t *tvb, proto_tree *tree, guint *off proto_tree_add_item(tree, hf_zbee_zcl_calendar_total_number_of_commands, tvb, *offset, 1, ENC_NA); *offset += 1; - for (gint i = 0; tvb_reported_length_remaining(tvb, *offset) >= 5; i++) { + while (tvb_reported_length_remaining(tvb, *offset) >= 5) { /* Season Start Date */ dissect_zcl_date(tvb, tree, offset, ett_zbee_zcl_calendar_season_start_date, "Season Start Date", hf_zbee_zcl_calendar_date_year, hf_zbee_zcl_calendar_date_month, hf_zbee_zcl_calendar_date_month_day, hf_zbee_zcl_calendar_date_week_day); |