Mercurial > audlegacy
diff src/audacious/vfs.c @ 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 | 3149d4b1a9a9 |
| children | b332cdd2ea43 |
line wrap: on
line diff
--- 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;
