diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2014-01-01 14:33:19 +0000 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2014-01-01 14:33:19 +0000 |
commit | 6ebc058f473085a2fa9884fe2fd7f4a9959be915 (patch) | |
tree | f514e3d9eadd1c89ad434cc00d5d20fda6168ef1 /epan/dissectors/packet-gsm_a_dtap.c | |
parent | e504cf945bb54c3c73efbaee51acaa968179586a (diff) |
Add proto_tree_add_ts_23_038_7bits_item() / tvb_get_ts_23_038_7bits_string() functions and update dissectors to use it.
Remove gsm_sms_char_7bit_unpack() / gsm_sms_chars_to_utf8() functions.
Update documentation a bit.
svn path=/trunk/; revision=54534
Diffstat (limited to 'epan/dissectors/packet-gsm_a_dtap.c')
-rw-r--r-- | epan/dissectors/packet-gsm_a_dtap.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/epan/dissectors/packet-gsm_a_dtap.c b/epan/dissectors/packet-gsm_a_dtap.c index 1a3a08bd21..c2fa7729b2 100644 --- a/epan/dissectors/packet-gsm_a_dtap.c +++ b/epan/dissectors/packet-gsm_a_dtap.c @@ -788,7 +788,7 @@ de_network_name(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off guint32 curr_offset; const gchar *str; guint8 coding_scheme, num_spare_bits; - guint32 num_chars, num_text_bits; + guint32 num_text_bits; gchar *net_name = NULL; proto_item *item; @@ -819,24 +819,13 @@ de_network_name(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off switch(coding_scheme) { case 0: - num_chars = gsm_sms_char_7bit_unpack(0, len - 1, sizeof(a_bigbuf), - tvb_get_ptr(tvb, curr_offset, len - 1), a_bigbuf); - /* Check if there was a reasonable value for number of spare bits in last octet */ num_text_bits = ((len - 1) << 3) - num_spare_bits; if (num_spare_bits && (num_text_bits % 7)) { expert_add_info(pinfo, item, &ei_gsm_a_dtap_text_string_not_multiple_of_7); } - /* - * If the number of spare bits is 7, then we have unpacked one extra - * character. Disregard this character. - */ - if (num_spare_bits == 7) - num_chars--; - a_bigbuf[num_chars] = '\0'; - net_name = gsm_sms_chars_to_utf8(a_bigbuf, num_chars); - proto_tree_add_string(tree, hf_gsm_a_dtap_text_string, tvb, curr_offset, len - 1, net_name); + proto_tree_add_ts_23_038_7bits_item(tree, hf_gsm_a_dtap_text_string, tvb, curr_offset<<3, num_text_bits/7); break; case 1: net_name = tvb_get_string_enc(wmem_packet_scope(), tvb, curr_offset, (len - 1), ENC_UCS_2|ENC_BIG_ENDIAN); |