[gst-devel] locale problems with our registry

David Schleef ds at schleef.org
Mon Dec 22 12:29:05 CET 2003


On Mon, Dec 22, 2003 at 02:07:04PM +0100, Thomas Vander Stichele wrote:
> I checked the caps xml saving code, and it relies on g_value_transform. 
> The API docs for that say:
> 
> Tries to cast the contents of src_value into a type apropriate to store
> in dest_value, e.g. to transform a G_TYPE_INT value into a G_TYPE_FLOAT
> value. Performing transformations between value types might incour
> precision lossage. Especially transformations into strings might reveal
> seemingly arbitrary results and shouldn't be relied upon for production
> code (such as rcfile value or object property serialization). 
> 
> I guess locale issues are one good reason why we shouldn't be using htis
> for object property serialization...

There are several reasons not to use g_value_transform(), including the
fact that it likes to put double quotes around strings without actually
escaping the strings.  It just wasn't meant for what we want to do,
which imo, is a flaw in glib.  It appears g_value_transform() wasn't
indended to actually do anything. :)

And, as you noticed, it's not possible to determine if
g_value_transform() was sucessful.

It's probably wise to just go ahead and add a gst_value_to_string()
and gst_value_from_string() that work the way we want them to.

> Anyone have a suggestion on how to fix this properly ? (ie, NOT by hacks
> like "run it in the C locale always")

It's fixed, mostly.  At least, fixed to the point where nobody should
notice.



dave...





More information about the gstreamer-devel mailing list