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 423051 - Vorbis tags of type double use locale-dependent formatting
Vorbis tags of type double use locale-dependent formatting
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal minor
: 0.10.13
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2007-03-26 19:48 UTC by René Stadler
Modified: 2007-03-26 22:38 UTC
See Also:
GNOME target: ---
GNOME version: ---

Use g_ascii_formatd for double type tag value formatting (777 bytes, patch)
2007-03-26 19:49 UTC, René Stadler
committed Details | Review

Description René Stadler 2007-03-26 19:48:30 UTC
gst-plugins-base/gst-libs/gst/tag/gstvorbistag.c:gst_tag_to_vorbis_comments contains this:

  /* FIXME: what about locale-specific floating point separators? */
  result = g_strdup_printf ("%s=%f", vorbis_tag, value);

This results in values of double type tags (ReplayGain) being possibly written out with "," as a decimal separator.  I'm attaching a simple patch that replaces this with

  g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", value);
  result = g_strconcat (vorbis_tag, "=", buf, NULL);

This also uses at most 6 digits after the decimal point (using g_ascii_dtostr here seems like overkill indeed) but formats the value irregardless of the current locale.
Comment 1 René Stadler 2007-03-26 19:49:50 UTC
Created attachment 85331 [details] [review]
Use g_ascii_formatd for double type tag value formatting
Comment 2 Tim-Philipp Müller 2007-03-26 22:38:35 UTC
Committed, thanks:

 2007-03-26  Tim-Philipp Müller  <tim at centricular dot net>

        Patch by: René Stadler  <mail at renestadler de>

        * gst-libs/gst/tag/gstvorbistag.c: (gst_tag_to_vorbis_comments):
          When writing out floating-point numbers to vorbis comment tags, always
          use the same character as separator no matter what the current locale is
          (fixes #423051).

        * tests/check/libs/tag.c: (GST_START_TEST):
          Add unit tests for replaygain tags in vorbis comments (closes #423055).