From 3c6b969c65b46ad618e051c5f42ceb5111fd7358 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Mon, 7 Apr 2008 20:52:34 +0000 Subject: Since the GTK1 code was taken out of gsmmap_add_ucs2_ussd_string(), move that code back into gsmmap.cnf (this undoes rev 24227 whose sole purpose was to allow GTK1 builds). svn path=/trunk/; revision=24836 --- asn1/gsmmap/gsmmap.cnf | 20 +++++++++++++++++++- asn1/gsmmap/packet-gsmmap-template.c | 27 ++------------------------- 2 files changed, 21 insertions(+), 26 deletions(-) (limited to 'asn1') diff --git a/asn1/gsmmap/gsmmap.cnf b/asn1/gsmmap/gsmmap.cnf index b1642c5f0e..585fa23407 100644 --- a/asn1/gsmmap/gsmmap.cnf +++ b/asn1/gsmmap/gsmmap.cnf @@ -365,6 +365,9 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; * use ep_alloc ? */ static unsigned char bigbuf[1024]; + gchar *utf8_text = NULL; + GIConv cd; + GError *l_conv_error = NULL; %(DEFAULT_BODY)s if (!parameter_tvb) @@ -388,7 +391,22 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; break; case SMS_ENCODING_UCS2: case SMS_ENCODING_UCS2_LANG: - gsmmap_add_ucs2_ussd_string(tvb, tree, length); + if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv) -1) + { + utf8_text = g_convert_with_iconv(tvb->real_data, length, cd, NULL, NULL, &l_conv_error); + if(!l_conv_error) + proto_tree_add_text(tree, tvb, 0, length, "USSD String: %%s", utf8_text); + else + proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_convert_with_iconv FAILED"); + + if(utf8_text) + g_free(utf8_text); + + g_iconv_close(cd); + } + else + proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark"); + break; default: break; diff --git a/asn1/gsmmap/packet-gsmmap-template.c b/asn1/gsmmap/packet-gsmmap-template.c index 72663f2de8..985bef405f 100644 --- a/asn1/gsmmap/packet-gsmmap-template.c +++ b/asn1/gsmmap/packet-gsmmap-template.c @@ -238,31 +238,8 @@ const value_string gsm_map_etsi_defined_pdp_vals[] = { { 0, NULL } }; -static void -gsmmap_add_ucs2_ussd_string(tvbuff_t *tvb, proto_tree *tree, int length) -{ - gchar *utf8_text = NULL; - GIConv cd; - GError *l_conv_error = NULL; - - if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv) -1) - { - utf8_text = g_convert_with_iconv(tvb->real_data, length, cd, NULL, NULL, &l_conv_error); - if(!l_conv_error) - proto_tree_add_text(tree, tvb, 0, length, "USSD String: %%s", utf8_text); - else - proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_convert_with_iconv FAILED"); - - if(utf8_text) - g_free(utf8_text); - - g_iconv_close(cd); - } - else - proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark"); -} - -char * unpack_digits(tvbuff_t *tvb, int offset){ +char * +unpack_digits(tvbuff_t *tvb, int offset) { int length; guint8 octet; -- cgit v1.2.3