Fix currency display in locale with non utf8 charset
Didier Vidal
didier-devel at 9online.fr
Thu Oct 20 07:14:54 EDT 2005
I was not sure about the copy, especially if the string is already utf8
before we call g_locale_to_utf8. I prefered to risk a small leak than a
crash.
But if someone knows what happens behind the cover, he could remove the
strdup...
Didier.
Le jeu 20/10/2005 à 11:19, Christian Stimming a écrit :
> Hi,
>
> Didier Vidal schrieb:
> > This should fix one of the problems that Neil reported in en_GB locale.
> > Do you see other pango-related problems, Neil ?
>
> it's great that this fixes the pango problems. However --
>
> > if ((value == NULL) || (value[0] == 0))
> > *p_value = default_value;
> >
> > + *p_value = g_locale_to_utf8 (*p_value, -1, NULL, NULL, NULL);
> > + // FIXME: Do we really need to make a copy here ?
> > *p_value = g_strdup (*p_value);
> > }
>
> -- IMHO the g_strdup shouldn't be used here, because g_locale_to_utf8
> returns a "gchar*" which IMHO means that this is an already newly
> allocated string. Unfortunately the documentation of g_locale_to_utf8
> doesn't clearly say this, but since it isn't a "const gchar*" I could
> only guess that the returned string is already newly allocated. So the
> g_strdup line should simply be removed.
>
> Christian
> _______________________________________________
> gnucash-patches mailing list
> gnucash-patches at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-patches
More information about the gnucash-patches
mailing list