After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 150200 - gst_init breaks atof, strtod etc.
gst_init breaks atof, strtod etc.
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.8.4
Other Linux
: Urgent major
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-08-15 19:22 UTC by thomas.kulessa
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6



Description thomas.kulessa 2004-08-15 19:22:54 UTC
Seems like gstreamer a some strange side effect on libc's atof() function:
#include <gst/gst.h>
#include <stdlib.h>
int main (int argc, char **argv) 
{
  printf("f=%f\n", atof("0.22"));
  gst_init(&argc, &argv);
  printf("f=%f\n", atof("0.22"));
  return 0;
}

outputs:
f=0.220000
f=0,000000
Comment 1 Ronald Bultje 2004-08-16 04:19:08 UTC
We set locale information and so on. I think atof() will, after the call to
gst_init(), expect commas rather than dots. Solution is to set the locale before
doing any other function calls.
Comment 2 thomas.kulessa 2004-08-16 09:24:00 UTC
Thanks, that helps.

But is it still a bug!? I would expect a media library (any library) to respect
my locale setting, but not to change it...
But perhaps I am wrong, I justed checked ant saw that gtk_init() does the same
thing.

Problem is (ok not really a problem) my gstreamer based app uses libxml2 to
read/write configuration data, and libxml2 writes "0.2" to the file, so it seems
to ignore the locale set by gtk or gst.

Comment 3 Ronald Bultje 2004-08-16 18:05:04 UTC
In that case, you're apparently using libxml2 for parsing the file during
writing, but doing the reading yourself. Either do both yourself or have libxml2
do both.

We're supposed to change such settings inside the application, because otherwise
i18n in plugins doesn't work...
Comment 4 thomas.kulessa 2004-08-16 20:17:45 UTC
Nono, of course I am doing reading and writing with libxml (libxml++ do be
exact). But libxml++ does only take strings as attribute values. 
Now i am using g_sprintf for writing the float, which respects the locale and i
am pleased:-)
Comment 5 David Schleef 2004-08-16 21:14:06 UTC
Actually, you need functions that _ignore_ the locale setting, and are thus
locale-independent.  See g_ascii_strtod() and friends.
Comment 6 Thomas Vander Stichele 2004-09-10 22:58:03 UTC
reporter seems to be happy with resolution that it is in fact not a bug.  closing.