summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-05-12 08:21:37 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-05-12 08:21:37 +0000
commitd0a4d90b5077c5e2591593e4099e34ddd514bb95 (patch)
treea35c87d8d083f01c368188fd55c00b644dab80f6
parent9edc0c0365f79ab07ff2e65461c6696e3931a3f0 (diff)
gst/id3demux/id3v2frames.c: Some more debug info. No need to check whether the string returned by g_convert() is real...
Original commit message from CVS: * gst/id3demux/id3v2frames.c: (parse_insert_string_field): Some more debug info. No need to check whether the string returned by g_convert() is really UTF-8 - either it is or we get NULL returned.
-rw-r--r--ChangeLog7
-rw-r--r--gst/id3demux/id3v2frames.c18
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b777a35a..af2522e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-10 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/id3demux/id3v2frames.c: (parse_insert_string_field):
+ Some more debug info. No need to check whether the string
+ returned by g_convert() is really UTF-8 - either it is or
+ we get NULL returned.
+
2006-05-10 Jan Schmidt <thaytan@mad.scientist.com>
* gst/id3demux/id3v2frames.c: (id3v2_genre_fields_to_taglist):
diff --git a/gst/id3demux/id3v2frames.c b/gst/id3demux/id3v2frames.c
index 832b7b22..6690f5a5 100644
--- a/gst/id3demux/id3v2frames.c
+++ b/gst/id3demux/id3v2frames.c
@@ -671,14 +671,20 @@ static void
parse_insert_string_field (const gchar * encoding, gchar * data, gint data_size,
GArray * fields)
{
- gchar *field;
+ gchar *field = NULL;
- field = g_convert (data, data_size, "UTF-8", encoding, NULL, NULL, NULL);
- if (field && !g_utf8_validate (field, -1, NULL)) {
- GST_DEBUG ("%s was bad UTF-8. Ignoring", field);
- g_free (field);
- field = NULL;
+ if (strcmp (encoding, "UTF-8") != 0) {
+ field = g_convert (data, data_size, "UTF-8", encoding, NULL, NULL, NULL);
+ if (field == NULL) {
+ GST_WARNING ("could not convert string from %s to UTF-8. Ignoring",
+ encoding);
+ }
+ } else if (g_utf8_validate (data, data_size, NULL)) {
+ field = g_strndup (data, data_size);
+ } else {
+ GST_WARNING ("alleged UTF-8 string is not valid UTF-8. Ignoring");
}
+
if (field)
g_array_append_val (fields, field);
}