From: <tp...@ke...> - 2007-04-12 16:36:53
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: tpm Date: Thu Apr 12 2007 16:36:48 UTC Log message: * gst-libs/gst/tag/tags.c: (gst_tag_freeform_string_to_utf8): Try encodings from all environment variables, not just those in the first environment variable that is set. Modified files: . : ChangeLog gst-libs/gst/tag: tags.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3260&r2=1.3261 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/tag/tags.c.diff?r1=1.8&r2=1.9 ====Begin Diffs==== Index: tags.c =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/tag/tags.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- tags.c 12 Apr 2007 12:19:20 -0000 1.8 +++ tags.c 12 Apr 2007 16:36:36 -0000 1.9 @@ -246,7 +246,7 @@ gst_tag_freeform_string_to_utf8 (const gchar * data, gint size, const gchar ** env_vars) { - const gchar *env = NULL; + const gchar *cur_loc = NULL; gsize bytes_read; gchar *utf8 = NULL; @@ -260,33 +260,35 @@ if (g_utf8_validate (data, size, NULL)) return g_strndup (data, size); - while ((env == NULL || *env == '\0') && env_vars && *env_vars != NULL) { - env = g_getenv (*env_vars); - ++env_vars; - } + while (env_vars && *env_vars != NULL) { + const gchar *env = NULL; - /* Try charsets specified via the environment */ - if (env != NULL && *env != '\0') { - gchar **c, **csets; + /* Try charsets specified via the environment */ + env = g_getenv (*env_vars); + if (env != NULL && *env != '\0') { + gchar **c, **csets; - csets = g_strsplit (env, G_SEARCHPATH_SEPARATOR_S, -1); + csets = g_strsplit (env, G_SEARCHPATH_SEPARATOR_S, -1); - for (c = csets; c && *c; ++c) { - if ((utf8 = g_convert (data, size, "UTF-8", *c, &bytes_read, NULL, NULL))) { - if (bytes_read == size) { - g_strfreev (csets); - goto beach; + for (c = csets; c && *c; ++c) { + if ((utf8 = + g_convert (data, size, "UTF-8", *c, &bytes_read, NULL, NULL))) { + if (bytes_read == size) { + g_strfreev (csets); + goto beach; + } + g_free (utf8); + utf8 = NULL; } - g_free (utf8); - utf8 = NULL; } - } - g_strfreev (csets); + g_strfreev (csets); + } + ++env_vars; } /* Try current locale (if not UTF-8) */ - if (!g_get_charset (&env)) { + if (!g_get_charset (&cur_loc)) { if ((utf8 = g_locale_to_utf8 (data, size, &bytes_read, NULL, NULL))) { if (bytes_read == size) { goto beach; Index: ChangeLog RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3260 retrieving revision 1.3261 diff -u -d -r1.3260 -r1.3261 --- ChangeLog 12 Apr 2007 15:00:02 -0000 1.3260 +++ ChangeLog 12 Apr 2007 16:36:36 -0000 1.3261 @@ -1,3 +1,9 @@ +2007-04-12 Tim-Philipp Müller <tim at centricular dot net> + + * gst-libs/gst/tag/tags.c: (gst_tag_freeform_string_to_utf8): + Try encodings from all environment variables, not just those in the + first environment variable that is set. 2007-04-12 Wim Taymans <wi...@fl...> * gst/videorate/gstvideorate.c: (gst_video_rate_setcaps), |