Commit de09a580 authored by Matthias Clasen's avatar Matthias Clasen

Handle strfxrm returning -1 a little better. Problem pointed out by Takao

        * glib/gunicollate.c (g_utf8_collate_key): Handle strfxrm returning
        -1 a little better. Problem pointed out by Takao Fujiwara


svn path=/trunk/; revision=7015
parent f532b61f
2008-06-11 Matthias Clasen <mclasen@redhat.com>
Bug 314453 – Nautilus crashes in Solaris when browsing the attached
file
* glib/gunicollate.c (g_utf8_collate_key): Handle strfxrm returning
-1 a little better. Problem pointed out by Takao Fujiwara
2008-06-11 Matthias Clasen <mclasen@redhat.com>
Bug 529321 – make check fails in glib/pcre
......
......@@ -414,11 +414,16 @@ g_utf8_collate_key (const gchar *str,
str_norm = g_utf8_normalize (str, len, G_NORMALIZE_ALL_COMPOSE);
result = NULL;
if (g_get_charset (&charset))
{
xfrm_len = strxfrm (NULL, str_norm, 0);
result = g_malloc (xfrm_len + 1);
strxfrm (result, str_norm, xfrm_len + 1);
if (xfrm_len >= 0 && xfrm_len < G_MAXINT - 2)
{
result = g_malloc (xfrm_len + 1);
strxfrm (result, str_norm, xfrm_len + 1);
}
}
else
{
......@@ -441,14 +446,15 @@ g_utf8_collate_key (const gchar *str,
g_free (str_locale);
}
else
{
xfrm_len = strlen (str_norm);
result = g_malloc (xfrm_len + 2);
result[0] = 'B';
memcpy (result + 1, str_norm, xfrm_len);
result[xfrm_len+1] = '\0';
}
}
if (!result)
{
xfrm_len = strlen (str_norm);
result = g_malloc (xfrm_len + 2);
result[0] = 'B';
memcpy (result + 1, str_norm, xfrm_len);
result[xfrm_len+1] = '\0';
}
g_free (str_norm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment