changeset 652:7f865e3cd285 trunk

[svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
author yaz
date Wed, 14 Feb 2007 23:23:21 -0800
parents b9167008fc3f
children 638b290641f3
files ChangeLog src/xspf/xspf.c
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 14 18:03:22 2007 -0800
+++ b/ChangeLog	Wed Feb 14 23:23:21 2007 -0800
@@ -1,3 +1,12 @@
+2007-02-15 02:03:22 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1388]
+  - strings in audmad_config should be freed before update. thus constant initializer has been replaced with g_strdup().
+  
+  trunk/src/madplug/configure.c |    3 +++
+  trunk/src/madplug/plugin.c    |   13 +++++++++----
+  2 files changed, 12 insertions(+), 4 deletions(-)
+
+
 2007-02-14 18:15:53 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1386]
   - make sure audmad_config.id3_format is not NULL. closes #795.
--- a/src/xspf/xspf.c	Wed Feb 14 18:03:22 2007 -0800
+++ b/src/xspf/xspf.c	Wed Feb 14 23:23:21 2007 -0800
@@ -51,6 +51,31 @@
 gchar *base = NULL;
 gboolean override_mtime = FALSE;
 
+// this function is taken from libxml2-2.6.27.
+static xmlChar *
+audPathToURI(const xmlChar *path)
+{
+    xmlURIPtr uri;
+    xmlURI temp;
+    xmlChar *ret, *cal;
+
+    if (path == NULL)
+        return(NULL);
+
+    if ((uri = xmlParseURI((const char *) path)) != NULL) {
+	xmlFreeURI(uri);
+	return xmlStrdup(path);
+    }
+    cal = xmlCanonicPath(path);
+    if (cal == NULL)
+        return(NULL);
+    memset(&temp, 0, sizeof(temp));
+    temp.path = (char *) cal;
+    ret = xmlSaveUri(&temp);
+    xmlFree(cal);
+    return(ret);
+}
+
 static void
 add_file(xmlNode *track, const gchar *filename, gint pos)
 {
@@ -289,7 +314,7 @@
 		}
 		else /* local file */
 		{
-			gchar *tmp = (gchar *)xmlPathToURI((const xmlChar *)entry->filename);
+			gchar *tmp = (gchar *)audPathToURI((const xmlChar *)entry->filename);
 			filename = g_strdup_printf("file://%s", tmp);
 			g_free(tmp);
 		}