Do not assume that text is null-terminated as pointed out by Christopher

2007-08-07  Johan Dahlin  <jdahlin@async.com.br>

    * gtk/gtkbuilderparser.c (text): 
    * gtk/gtkcelllayout.c (attributes_text_element): 
    * gtk/gtkliststore.c (list_store_text): 
    Do not assume that text is null-terminated as pointed out by
    Christopher Fergeau


svn path=/trunk/; revision=18592
This commit is contained in:
Johan Dahlin
2007-08-07 21:52:29 +00:00
committed by Johan Dahlin
parent 923a1cf84e
commit 12e1855bba
4 changed files with 28 additions and 9 deletions

View File

@ -908,14 +908,20 @@ text (GMarkupParseContext *context,
{
PropertyInfo *prop_info = (PropertyInfo*)info;
/* text is not guaranteed to be null-terminated */
char *string = g_strndup (text, text_len);
if (prop_info->translatable && text_len)
{
if (prop_info->context)
text = dpgettext (data->domain, prop_info->context, text);
if (prop_info->context)
text = dpgettext (data->domain, prop_info->context, string);
else
text = dgettext (data->domain, text);
text = dgettext (data->domain, string);
g_free (string);
string = g_strdup (text);
}
prop_info->data = g_strdup (text);
prop_info->data = string;
}
}