changeset 2335:e80c9dfc93aa trunk

[svn] - g_strsplit() wraps strsplit(3), and thus has different results on different systems (strsplit nul-terminates on uclibc). process URIs in a different way, as a result.
author nenolod
date Mon, 15 Jan 2007 08:44:39 -0800
parents 345d38f25eb1
children b332cdd2ea43
files ChangeLog src/audacious/vfs.c
diffstat 2 files changed, 15 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 15 08:08:40 2007 -0800
+++ b/ChangeLog	Mon Jan 15 08:44:39 2007 -0800
@@ -1,3 +1,11 @@
+2007-01-15 16:08:40 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [3678]
+  - only evaluate -DHAVE_CONFIG_H if we're in audacious core. closes #760.
+  
+  trunk/src/audacious/util.h |    4 +++-
+  1 file changed, 3 insertions(+), 1 deletion(-)
+
+
 2007-01-15 02:58:03 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [3676]
   - gettext requires mkinstalldirs
--- a/src/audacious/vfs.c	Mon Jan 15 08:08:40 2007 -0800
+++ b/src/audacious/vfs.c	Mon Jan 15 08:44:39 2007 -0800
@@ -26,6 +26,8 @@
 
 static GList *vfs_transports = NULL;
 
+#define VFS_DEBUG
+
 #ifdef VFS_DEBUG
 # define DBG(x, args...) g_print(x, ## args);
 #else
@@ -62,7 +64,6 @@
           const gchar * mode)
 {
     VFSFile *file;
-    gchar **vec;
     VFSConstructor *vtable = NULL;
     GList *node;
     gchar *decpath;
@@ -72,49 +73,26 @@
 
     decpath = xmms_urldecode_plain(path);
 
-    vec = g_strsplit(decpath, "://", 2);
-
-    /* special case: no transport specified, look for the "/" transport */
-    if (vec[1] == NULL)
+    for (node = vfs_transports; node != NULL; node = g_list_next(node))
     {
-        for (node = vfs_transports; node != NULL; node = g_list_next(node))
-        {
-            vtable = (VFSConstructor *) node->data;
+        vtable = (VFSConstructor *) node->data;
 
-            if (*vtable->uri_id == '/')
-                break;
-        }
-    }
-    else
-    {
-        for (node = vfs_transports; node != NULL; node = g_list_next(node))
-        {
-            vtable = (VFSConstructor *) node->data;
-
-            if (!g_strcasecmp(vec[0], vtable->uri_id))
-                break;
-        }
+        if (!strncasecmp(decpath, vtable->uri_id, strlen(vtable->uri_id)))
+            break;
     }
 
     /* no transport vtable has been registered, bail. */
     if (vtable == NULL)
-    {
-        g_strfreev(vec);
         return NULL;
-    }
 
-    file = vtable->vfs_fopen_impl(vec[1] ? vec[1] : vec[0], mode);
+    file = vtable->vfs_fopen_impl(decpath + strlen(vtable->uri_id), mode);
 
     if (file == NULL)
-    {
-        g_strfreev(vec);
         return NULL;
-    }
 
     file->uri = g_strdup(path);
     file->base = vtable;
 
-    g_strfreev(vec);
     g_free(decpath);
 
     return file;