From 2fd7d6c3ebdbdd42a45d6039f53371cfc95f7bce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 12 May 2006 08:21:37 +0000 Subject: [PATCH] tag: id3v2: Some more debug info. No need to check whether the string returned by g_convert() is real... Original commit message from CVS: * gst-libs/gst/tag/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. --- gst-libs/gst/tag/id3v2frames.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/tag/id3v2frames.c b/gst-libs/gst/tag/id3v2frames.c index 832b7b2..6690f5a 100644 --- a/gst-libs/gst/tag/id3v2frames.c +++ b/gst-libs/gst/tag/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); } -- 2.7.4