forked from osmocom/wireshark
The glib iconv routines are new to glib-2 so #ifdef around them to get glib-1 builds going again. I started to merge in using the regular iconv routines (if we don't have glib-2 but we HAVE_CONV) but the code rapidly got ugly with all the #ifdef's; it could be done but it's probably not worth the effort/ugliness.
svn path=/trunk/; revision=24098
This commit is contained in:
parent
6cb56fba71
commit
5ebba98529
|
@ -672,7 +672,7 @@ dis_field_dcs(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint8 oct,
|
||||||
case 0x00: str = "GSM 7 bit default alphabet";
|
case 0x00: str = "GSM 7 bit default alphabet";
|
||||||
*seven_bit = TRUE;
|
*seven_bit = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x01: str = "8 bit data";
|
case 0x01: str = "8 bit data";
|
||||||
*eight_bit = TRUE;
|
*eight_bit = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x02: str = "UCS2 (16 bit)";
|
case 0x02: str = "UCS2 (16 bit)";
|
||||||
|
@ -1547,7 +1547,7 @@ char_def_alphabet_ext_decode(unsigned char value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gunichar
|
static gunichar
|
||||||
char_def_alphabet_decode(unsigned char value)
|
char_def_alphabet_decode(unsigned char value)
|
||||||
{
|
{
|
||||||
if (value < GN_CHAR_ALPHABET_SIZE)
|
if (value < GN_CHAR_ALPHABET_SIZE)
|
||||||
|
@ -1822,7 +1822,7 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
|
||||||
static guint8 fill_bits_mask[NUM_FILL_BITS_MASKS] =
|
static guint8 fill_bits_mask[NUM_FILL_BITS_MASKS] =
|
||||||
{ 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc };
|
{ 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc };
|
||||||
proto_item *item;
|
proto_item *item;
|
||||||
proto_item *udh_item , *ucs2_item;
|
proto_item *udh_item;
|
||||||
proto_tree *subtree = NULL;
|
proto_tree *subtree = NULL;
|
||||||
proto_tree *udh_subtree = NULL;
|
proto_tree *udh_subtree = NULL;
|
||||||
guint8 oct;
|
guint8 oct;
|
||||||
|
@ -1830,9 +1830,12 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
|
||||||
guint32 out_len;
|
guint32 out_len;
|
||||||
char *ustr;
|
char *ustr;
|
||||||
char messagebuf[160];
|
char messagebuf[160];
|
||||||
gchar *utf8_text = NULL;
|
#if GLIB_MAJOR_VERSION > 2
|
||||||
GIConv cd;
|
proto_item *ucs2_item;
|
||||||
GError *l_conv_error = NULL;
|
gchar *utf8_text = NULL;
|
||||||
|
GIConv cd;
|
||||||
|
GError *l_conv_error = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
fill_bits = 0;
|
fill_bits = 0;
|
||||||
|
|
||||||
|
@ -1915,7 +1918,8 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
|
||||||
}
|
}
|
||||||
else if (ucs2)
|
else if (ucs2)
|
||||||
{
|
{
|
||||||
if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv)-1)
|
#if GLIB_MAJOR_VERSION > 2
|
||||||
|
if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv)-1)
|
||||||
{
|
{
|
||||||
utf8_text = g_convert_with_iconv(tvb->real_data + offset, length , cd , NULL , NULL , &l_conv_error);
|
utf8_text = g_convert_with_iconv(tvb->real_data + offset, length , cd , NULL , NULL , &l_conv_error);
|
||||||
if(!l_conv_error){
|
if(!l_conv_error){
|
||||||
|
@ -1926,14 +1930,17 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb
|
||||||
PROTO_ITEM_SET_GENERATED(ucs2_item);
|
PROTO_ITEM_SET_GENERATED(ucs2_item);
|
||||||
if(utf8_text)
|
if(utf8_text)
|
||||||
g_free(utf8_text);
|
g_free(utf8_text);
|
||||||
g_iconv_close(cd);
|
g_iconv_close(cd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
/* tvb_get_ephemeral_faked_unicode takes the lengt in number of guint16's */
|
/* tvb_get_ephemeral_faked_unicode takes the lengt in number of guint16's */
|
||||||
ustr = tvb_get_ephemeral_faked_unicode(tvb, offset, (length>>1), FALSE);
|
ustr = tvb_get_ephemeral_faked_unicode(tvb, offset, (length>>1), FALSE);
|
||||||
proto_tree_add_text(subtree, tvb, offset, length, "%s", ustr);
|
proto_tree_add_text(subtree, tvb, offset, length, "%s", ustr);
|
||||||
}
|
#if GLIB_MAJOR_VERSION > 2
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue