diff options
author | Bill Meier <wmeier@newsguy.com> | 2014-08-21 18:44:07 -0400 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2014-08-21 23:57:18 +0000 |
commit | f580ebe3a97f834a744af9681c4e5b97903cc0a3 (patch) | |
tree | b452e22edbeac9ab57395b444139536098778689 /epan/dissectors/packet-gsm_cbch.c | |
parent | 5b5ef967d2780b130cf010c7e9090357bc34af84 (diff) |
packet-gsm_cbch.c: various minor changes
- tvb_length() --> tvb_reported_length();
- Use -1 for length arg in proto_tree_add_protocol_format();
- Remove unused 'for' loop increment which caused Windows
warning: "C4701: potentially uninitialized local variable";
- Add editor modelines.
Change-Id: I37833b750c100e333f4fa76d9465169be456d7c1
Reviewed-on: https://code.wireshark.org/review/3788
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-gsm_cbch.c')
-rw-r--r-- | epan/dissectors/packet-gsm_cbch.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/epan/dissectors/packet-gsm_cbch.c b/epan/dissectors/packet-gsm_cbch.c index 4a0dac11d2..da3bc5be80 100644 --- a/epan/dissectors/packet-gsm_cbch.c +++ b/epan/dissectors/packet-gsm_cbch.c @@ -127,19 +127,19 @@ cbch_defragment_init(void) static void dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree) { - guint len, offset = 0; - guint8 octet1, i, j, k = 0; + guint len, offset = 0; + guint8 octet1, i, k = 0; guint8 sched_begin, sched_end, new_slots[48]; gboolean valid_message = TRUE; guint16 other_slots[48]; proto_item *item = NULL, *schedule_item = NULL; proto_tree *sched_tree = NULL, *sched_subtree = NULL; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); col_append_str(pinfo->cinfo, COL_INFO, " CBCH Schedule Message "); - schedule_item = proto_tree_add_protocol_format(top_tree, proto_cbch, tvb, 0, len, + schedule_item = proto_tree_add_protocol_format(top_tree, proto_cbch, tvb, 0, -1, "GSM CBCH Schedule Message"); sched_tree = proto_item_add_subtree(schedule_item, ett_schedule_msg); @@ -181,6 +181,7 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree /* iterate over the octets */ for (i=0; i<6; i++) { + guint8 j; octet1 = tvb_get_guint8(tvb, offset++); /* iterate over the bits */ @@ -263,7 +264,7 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree /* print schedule of other messages */ sched_subtree = proto_tree_add_subtree(sched_tree, tvb, offset, 0, ett_schedule_new_msg, &item, "Other message slots in this schedule"); - for (k=0; offset < len; j++) + for (k=0; offset < len; ) { /* XXX I don't know if a message can validly contain more than * 48 slots, but that's the size of the array we create so cap @@ -360,19 +361,17 @@ dissect_cbch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fragment_head *frag_data = NULL; guint8 octet, lb, lpd, seq_num; guint32 offset; - guint32 len; - proto_item *cbch_item = NULL; - proto_tree *cbch_tree = NULL; + proto_item *cbch_item; + proto_tree *cbch_tree; tvbuff_t *reass_tvb = NULL, *msg_tvb = NULL; - len = tvb_length(tvb); offset = 0; octet = tvb_get_guint8(tvb, offset); /* * create the protocol tree */ - cbch_item = proto_tree_add_protocol_format(tree, proto_cbch, tvb, 0, len, + cbch_item = proto_tree_add_protocol_format(tree, proto_cbch, tvb, 0, -1, "GSM CBCH - Block (0x%02x)", octet&3); col_append_str(pinfo->cinfo, COL_PROTOCOL, " CBCH"); @@ -622,3 +621,16 @@ proto_reg_handoff_gsm_cbch(void) data_handle = find_dissector("data"); cbs_handle = find_dissector("gsm_cbs"); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |