changeset 2146:e0e50e151bab trunk

[svn] - move vfs from libaudacious to main audacious
author nenolod
date Sun, 17 Dec 2006 08:52:31 -0800
parents e2c6696c1d9a
children 12f8a35f86f5
files ChangeLog audacious/Makefile audacious/equalizer.c audacious/genevent.c audacious/main.c audacious/playlist.c audacious/plugin.h audacious/vfs.c audacious/vfs.h audacious/vfs_buffer.c audacious/vfs_buffer.h audacious/vfs_common.c libaudacious/Makefile libaudacious/vfs.c libaudacious/vfs.h libaudacious/vfs_buffer.c libaudacious/vfs_buffer.h libaudacious/vfs_common.c
diffstat 18 files changed, 922 insertions(+), 918 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 16 11:20:00 2006 -0800
+++ b/ChangeLog	Sun Dec 17 08:52:31 2006 -0800
@@ -1,3 +1,10 @@
+2006-12-16 19:20:00 +0000  Giacomo Lozito <james@develia.org>
+  revision [3295]
+  added enter keypress shortcut for search-in-playlist dialog
+  trunk/audacious/ui_playlist.c |   24 ++++++++++++++++++++++++
+  1 file changed, 24 insertions(+)
+
+
 2006-12-16 18:44:25 +0000  Giacomo Lozito <james@develia.org>
   revision [3293]
   - added auto-enqueue option for search-in-playlist
--- a/audacious/Makefile	Sat Dec 16 11:20:00 2006 -0800
+++ b/audacious/Makefile	Sun Dec 17 08:52:31 2006 -0800
@@ -35,10 +35,15 @@
 	playlist_container.h \
 	plugin.h \
 	prefswin.h \
-	util.h
+	util.h \
+	vfs.h \
+	vfs_buffer.h
 
 SOURCES = \
 	build_stamp.c \
+	vfs.c \
+	vfs_buffer.c \
+	vfs_common.c \
 	genevent.c \
 	util.c \
 	output.c \
@@ -71,8 +76,6 @@
 
 OBJECTS = ${SOURCES:.c=.o}
 
-beepinclude_HEADERS = plugin.h output.h input.h
-
 desktop_DATA = audacious.desktop
 desktopdir = $(datadir)/applications
 
--- a/audacious/equalizer.c	Sat Dec 16 11:20:00 2006 -0800
+++ b/audacious/equalizer.c	Sun Dec 17 08:52:31 2006 -0800
@@ -46,7 +46,7 @@
 #include "output.h"
 
 #include "libaudacious/rcfile.h"
-#include "libaudacious/vfs.h"
+#include "vfs.h"
 
 #include "images/audacious_eq.xpm"
 
--- a/audacious/genevent.c	Sat Dec 16 11:20:00 2006 -0800
+++ b/audacious/genevent.c	Sun Dec 17 08:52:31 2006 -0800
@@ -46,7 +46,7 @@
 #include "libaudacious/configdb.h"
 #include "libaudacious/beepctrl.h"
 #include "libaudacious/util.h"
-#include "libaudacious/vfs.h"
+#include "vfs.h"
 
 #include "controlsocket.h"
 #include "dnd.h"
--- a/audacious/main.c	Sat Dec 16 11:20:00 2006 -0800
+++ b/audacious/main.c	Sun Dec 17 08:52:31 2006 -0800
@@ -48,7 +48,7 @@
 #include "libaudacious/configdb.h"
 #include "libaudacious/beepctrl.h"
 #include "libaudacious/util.h"
-#include "libaudacious/vfs.h"
+#include "vfs.h"
 
 #include "controlsocket.h"
 #include "dnd.h"
--- a/audacious/playlist.c	Sat Dec 16 11:20:00 2006 -0800
+++ b/audacious/playlist.c	Sun Dec 17 08:52:31 2006 -0800
@@ -45,7 +45,7 @@
 #include "mainwin.h"
 #include "libaudacious/util.h"
 #include "libaudacious/configdb.h"
-#include "libaudacious/vfs.h"
+#include "vfs.h"
 #include "libaudacious/urldecode.h"
 #include "equalizer.h"
 #include "playback.h"
--- a/audacious/plugin.h	Sat Dec 16 11:20:00 2006 -0800
+++ b/audacious/plugin.h	Sun Dec 17 08:52:31 2006 -0800
@@ -39,11 +39,7 @@
 
 
 #include <glib.h>
-#ifdef _AUDACIOUS_CORE
-# include "libaudacious/vfs.h"
-#else
-# include "audacious/vfs.h"
-#endif
+#include "audacious/vfs.h"
 #include "audacious/titlestring.h"
 
 #define INPUT_PLUGIN(x)   ((InputPlugin *)(x))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audacious/vfs.c	Sun Dec 17 08:52:31 2006 -0800
@@ -0,0 +1,351 @@
+/*  Audacious
+ *  Copyright (c) 2006 William Pitcock
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "vfs.h"
+#include <stdio.h>
+
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "audacious/urldecode.h"
+
+static GList *vfs_transports = NULL;
+
+#ifdef VFS_DEBUG
+# define DBG(x, args...) g_print(x, ## args);
+#else
+# define DBG(x, args...)
+#endif
+
+/**
+ * vfs_register_transport:
+ * @vtable: The #VFSConstructor vtable to register.
+ *
+ * Registers a #VFSConstructor vtable with the VFS system.
+ *
+ * Return value: TRUE on success, FALSE on failure.
+ **/
+gboolean
+vfs_register_transport(VFSConstructor *vtable)
+{
+    vfs_transports = g_list_append(vfs_transports, vtable);
+
+    return TRUE;
+}
+
+/**
+ * vfs_fopen:
+ * @path: The path or URI to open.
+ * @mode: The preferred access privileges (not guaranteed).
+ *
+ * Opens a stream from a VFS transport using a #VFSConstructor.
+ *
+ * Return value: On success, a #VFSFile object representing the stream.
+ **/
+VFSFile *
+vfs_fopen(const gchar * path,
+          const gchar * mode)
+{
+    VFSFile *file;
+    gchar **vec;
+    VFSConstructor *vtable = NULL;
+    GList *node;
+    gchar *decpath;
+
+    if (!path || !mode)
+	return NULL;
+
+    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))
+        {
+            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;
+        }
+    }
+
+    /* 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);
+
+    if (file == NULL)
+    {
+        g_strfreev(vec);
+        return NULL;
+    }
+
+    file->uri = g_strdup(path);
+    file->base = vtable;
+
+    g_strfreev(vec);
+    g_free(decpath);
+
+    return file;
+}
+
+/**
+ * vfs_fclose:
+ * @file: A #VFSFile object to destroy.
+ *
+ * Closes a VFS stream and destroys a #VFSFile object.
+ *
+ * Return value: -1 on failure, 0 on success.
+ **/
+gint
+vfs_fclose(VFSFile * file)
+{
+    gint ret = 0;
+
+    if (file == NULL)
+        return -1;
+
+    if (file->base->vfs_fclose_impl(file) != 0)
+        ret = -1;
+
+    if (file->uri != NULL)
+        g_free(file->uri);
+
+    g_free(file);
+
+    return ret;
+}
+
+/**
+ * vfs_fread:
+ * @ptr: A pointer to the destination buffer.
+ * @size: The size of each element to read.
+ * @nmemb: The number of elements to read.
+ * @file: #VFSFile object that represents the VFS stream.
+ *
+ * Reads from a VFS stream.
+ *
+ * Return value: The amount of elements succesfully read.
+ **/
+size_t
+vfs_fread(gpointer ptr,
+          size_t size,
+          size_t nmemb,
+          VFSFile * file)
+{
+    if (file == NULL)
+        return 0;
+
+    return file->base->vfs_fread_impl(ptr, size, nmemb, file);
+}
+
+/**
+ * vfs_fwrite:
+ * @ptr: A const pointer to the source buffer.
+ * @size: The size of each element to write.
+ * @nmemb: The number of elements to write.
+ * @file: #VFSFile object that represents the VFS stream.
+ *
+ * Writes to a VFS stream.
+ *
+ * Return value: The amount of elements succesfully written.
+ **/
+size_t
+vfs_fwrite(gconstpointer ptr,
+           size_t size,
+           size_t nmemb,
+           VFSFile * file)
+{
+    if (file == NULL)
+        return 0;
+
+    return file->base->vfs_fwrite_impl(ptr, size, nmemb, file);
+}
+
+/**
+ * vfs_getc:
+ * @stream: #VFSFile object that represents the VFS stream.
+ *
+ * Reads a character from a VFS stream.
+ *
+ * Return value: On success, a character. Otherwise, -1.
+ **/
+gint
+vfs_getc(VFSFile *stream)
+{
+    if (stream == NULL)
+        return -1;
+
+    return stream->base->vfs_getc_impl(stream);
+}
+
+/**
+ * vfs_ungetc:
+ * @c: The character to push back.
+ * @stream: #VFSFile object that represents the VFS stream.
+ *
+ * Pushes a character back to the VFS stream.
+ *
+ * Return value: On success, 0. Otherwise, -1.
+ **/
+gint
+vfs_ungetc(gint c, VFSFile *stream)
+{
+    if (stream == NULL)
+        return -1;
+
+    return stream->base->vfs_ungetc_impl(c, stream);
+}
+
+/**
+ * vfs_fseek:
+ * @file: #VFSFile object that represents the VFS stream.
+ * @offset: The offset to seek to.
+ * @whence: Whether or not the seek is absolute or not.
+ *
+ * Seeks through a VFS stream.
+ *
+ * Return value: On success, 1. Otherwise, 0.
+ **/
+gint
+vfs_fseek(VFSFile * file,
+          glong offset,
+          gint whence)
+{
+    if (file == NULL)
+        return 0;
+
+    return file->base->vfs_fseek_impl(file, offset, whence);
+}
+
+/**
+ * vfs_rewind:
+ * @file: #VFSFile object that represents the VFS stream.
+ *
+ * Rewinds a VFS stream.
+ **/
+void
+vfs_rewind(VFSFile * file)
+{
+    if (file == NULL)
+        return;
+
+    file->base->vfs_rewind_impl(file);
+}
+
+/**
+ * vfs_ftell:
+ * @file: #VFSFile object that represents the VFS stream.
+ *
+ * Returns the current position in the VFS stream's buffer.
+ *
+ * Return value: On success, the current position. Otherwise, -1.
+ **/
+glong
+vfs_ftell(VFSFile * file)
+{
+    if (file == NULL)
+        return -1;
+
+    return file->base->vfs_ftell_impl(file);
+}
+
+/**
+ * vfs_feof:
+ * @file: #VFSFile object that represents the VFS stream.
+ *
+ * Returns whether or not the VFS stream has reached EOF.
+ *
+ * Return value: On success, whether or not the VFS stream is at EOF. Otherwise, FALSE.
+ **/
+gboolean
+vfs_feof(VFSFile * file)
+{
+    if (file == NULL)
+        return FALSE;
+
+    return (gboolean) file->base->vfs_feof_impl(file);
+}
+
+/**
+ * vfs_truncate:
+ * @file: #VFSFile object that represents the VFS stream.
+ * @length: The length to truncate at.
+ *
+ * Truncates a VFS stream to a certain size.
+ *
+ * Return value: On success, 0. Otherwise, -1.
+ **/
+gint
+vfs_truncate(VFSFile * file, glong length)
+{
+    if (file == NULL)
+        return -1;
+
+    return file->base->vfs_truncate_impl(file, length);
+}
+
+/**
+ * vfs_file_test:
+ * @path: A path to test.
+ * @test: A GFileTest to run.
+ *
+ * Wrapper for g_file_test().
+ *
+ * Return value: The result of g_file_test().
+ **/
+gboolean
+vfs_file_test(const gchar * path, GFileTest test)
+{
+    return g_file_test(path, test);
+}
+
+/**
+ * vfs_is_writeable:
+ * @path: A path to test.
+ *
+ * Tests if a file is writeable.
+ *
+ * Return value: TRUE if the file is writeable, otherwise FALSE.
+ **/
+gboolean
+vfs_is_writeable(const gchar * path)
+{
+    struct stat info;
+
+    if (stat(path, &info) == -1)
+        return FALSE;
+
+    return (info.st_mode & S_IWUSR);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audacious/vfs.h	Sun Dec 17 08:52:31 2006 -0800
@@ -0,0 +1,122 @@
+/*
+ * Audacious
+ * Copyright (c) 2006 Audacious team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef VFS_H
+#define VFS_H
+
+#include <glib.h>
+#include <stdio.h>
+
+typedef struct _VFSFile VFSFile;
+typedef struct _VFSConstructor VFSConstructor;
+
+/**
+ * VFSFile:
+ * @uri: The URI of the stream.
+ * @handle: Opaque data used by the transport plugins.
+ * @base: The base vtable used for VFS functions.
+ *
+ * #VFSFile objects describe a VFS stream.
+ **/
+struct _VFSFile {
+	gchar *uri;
+	gpointer handle;
+	VFSConstructor *base;
+};
+
+/**
+ * VFSConstructor:
+ * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams.
+ * @vfs_fopen_impl: A function pointer which points to a fopen implementation.
+ * @vfs_fclose_impl: A function pointer which points to a fclose implementation.
+ * @vfs_fread_impl: A function pointer which points to a fread implementation.
+ * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation.
+ * @vfs_getc_impl: A function pointer which points to a getc implementation.
+ * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation.
+ * @vfs_fseek_impl: A function pointer which points to a fseek implementation.
+ * @vfs_rewind_impl: A function pointer which points to a rewind implementation.
+ * @vfs_ftell_impl: A function pointer which points to a ftell implementation.
+ * @vfs_feof_impl: A function pointer which points to a feof implementation.
+ * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation.
+ *
+ * #VFSConstructor objects contain the base vtables used for extrapolating
+ * a VFS stream. #VFSConstructor objects should be considered %virtual in
+ * nature. VFS base vtables are registered via vfs_register_transport().
+ **/
+struct _VFSConstructor {
+	gchar *uri_id;
+	VFSFile *(*vfs_fopen_impl)(const gchar *path,
+		const gchar *mode);
+	gint (*vfs_fclose_impl)(VFSFile * file);
+	size_t (*vfs_fread_impl)(gpointer ptr, size_t size,
+		size_t nmemb, VFSFile *file);
+	size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size,
+		size_t nmemb, VFSFile *file);
+	gint (*vfs_getc_impl)(VFSFile *stream);
+	gint (*vfs_ungetc_impl)(gint c, VFSFile *stream);
+	gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence);
+	void (*vfs_rewind_impl)(VFSFile *file);
+	glong (*vfs_ftell_impl)(VFSFile *file);
+	gboolean (*vfs_feof_impl)(VFSFile *file);
+	gboolean (*vfs_truncate_impl)(VFSFile *file, glong length);
+};
+
+G_BEGIN_DECLS
+
+extern VFSFile * vfs_fopen(const gchar * path,
+                    const gchar * mode);
+extern gint vfs_fclose(VFSFile * file);
+
+extern size_t vfs_fread(gpointer ptr,
+                 size_t size,
+                 size_t nmemb,
+                 VFSFile * file);
+extern size_t vfs_fwrite(gconstpointer ptr,
+                  size_t size,
+                  size_t nmemb,
+                  VFSFile *file);
+
+extern gint vfs_getc(VFSFile *stream);
+extern gint vfs_ungetc(gint c,
+                       VFSFile *stream);
+extern gchar *vfs_fgets(gchar *s,
+                        gint n,
+                        VFSFile *stream);
+
+extern gint vfs_fseek(VFSFile * file,
+               glong offset,
+               gint whence);
+extern void vfs_rewind(VFSFile * file);
+extern glong vfs_ftell(VFSFile * file);
+extern gboolean vfs_feof(VFSFile * file);
+
+extern gboolean vfs_file_test(const gchar * path,
+                       GFileTest test);
+
+extern gboolean vfs_is_writeable(const gchar * path);
+
+extern gboolean vfs_truncate(VFSFile * file, glong length);
+
+extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...)
+    __attribute__ ((__format__ (__printf__, 2, 3)));
+
+extern gboolean vfs_register_transport(VFSConstructor *vtable);
+
+G_END_DECLS
+
+#endif /* VFS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audacious/vfs_buffer.c	Sun Dec 17 08:52:31 2006 -0800
@@ -0,0 +1,229 @@
+/*  Audacious
+ *  Copyright (c) 2006 William Pitcock
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
+ *  02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "vfs.h"
+#include "vfs_buffer.h"
+
+VFSFile *
+buffer_vfs_fopen_impl(const gchar * path,
+          const gchar * mode)
+{
+    return NULL;
+}
+
+gint
+buffer_vfs_fclose_impl(VFSFile * file)
+{
+    g_return_val_if_fail(file != NULL, -1);
+
+    if (file->handle)
+        g_free(file->handle);
+
+    return 0;
+}
+
+size_t
+buffer_vfs_fread_impl(gpointer i_ptr,
+          size_t size,
+          size_t nmemb,
+          VFSFile * file)
+{
+    VFSBuffer *handle;
+    guchar *i;
+    size_t read = 0;
+    guchar *ptr = (guchar *) i_ptr;
+
+    if (file == NULL)
+        return 0;
+
+    handle = (VFSBuffer *) file->handle;
+
+    for (i = ptr; i - ptr <= nmemb * size && i - ptr <= handle->size; i++, handle->iter++)
+    {
+       *i = *handle->iter;
+       read++;
+    }
+
+    return (read / nmemb);
+}
+
+size_t
+buffer_vfs_fwrite_impl(gconstpointer i_ptr,
+           size_t size,
+           size_t nmemb,
+           VFSFile * file)
+{
+    VFSBuffer *handle;
+    const guchar *i;
+    size_t written = 0;
+    const guchar *ptr = (const guchar *) i_ptr;
+
+    if (file == NULL)
+        return 0;
+
+    handle = (VFSBuffer *) file->handle;
+
+    for (i = ptr; (i - ptr) <= nmemb * size && (i - ptr) <= handle->size; i++, handle->iter++)
+    {
+       *handle->iter = *i;
+       written++;
+    }
+
+    return (written / nmemb);
+}
+
+gint
+buffer_vfs_getc_impl(VFSFile *stream)
+{
+  VFSBuffer *handle = (VFSBuffer *) stream->handle;
+  gint c;
+
+  c = *handle->iter;
+  handle->iter++;
+
+  return c;
+}
+
+gint
+buffer_vfs_ungetc_impl(gint c, VFSFile *stream)
+{
+  return -1;
+}
+
+gint
+buffer_vfs_fseek_impl(VFSFile * file,
+          glong offset,
+          gint whence)
+{
+    VFSBuffer *handle;
+
+    if (file == NULL)
+        return 0;
+
+    handle = (VFSBuffer *) file->handle;
+
+    switch(whence)
+    {
+       case SEEK_CUR:
+          handle->iter = handle->iter + offset;
+          break;
+       case SEEK_END:
+          handle->iter = handle->end;
+          break;
+       case SEEK_SET:
+       default:
+          handle->iter = handle->data + offset;
+          break;
+    }
+
+    return 0;
+}
+
+void
+buffer_vfs_rewind_impl(VFSFile * file)
+{
+    VFSBuffer *handle;
+
+    if (file == NULL)
+        return;
+
+    handle = (VFSBuffer *) file->handle;
+
+    handle->iter = handle->data;
+}
+
+glong
+buffer_vfs_ftell_impl(VFSFile * file)
+{
+    VFSBuffer *handle;
+
+    if (file == NULL)
+        return 0;
+
+    handle = (VFSBuffer *) file->handle;
+
+    return handle->iter - handle->data;
+}
+
+gboolean
+buffer_vfs_feof_impl(VFSFile * file)
+{
+    VFSBuffer *handle;
+
+    if (file == NULL)
+        return FALSE;
+
+    handle = (VFSBuffer *) file->handle;
+
+    return (gboolean) (handle->iter == handle->end);
+}
+
+gint
+buffer_vfs_truncate_impl(VFSFile * file, glong size)
+{
+    return 0;
+}
+
+VFSConstructor buffer_const = {
+	NULL,			// not a normal VFS class
+	buffer_vfs_fopen_impl,
+	buffer_vfs_fclose_impl,
+	buffer_vfs_fread_impl,
+	buffer_vfs_fwrite_impl,
+	buffer_vfs_getc_impl,
+	buffer_vfs_ungetc_impl,
+	buffer_vfs_fseek_impl,
+	buffer_vfs_rewind_impl,
+	buffer_vfs_ftell_impl,
+	buffer_vfs_feof_impl,
+	buffer_vfs_truncate_impl
+};
+
+VFSFile *
+vfs_buffer_new(gpointer data, gsize size)
+{
+    VFSFile *handle;
+    VFSBuffer *buffer;
+
+    g_return_val_if_fail(data != NULL, NULL);
+    g_return_val_if_fail(size > 0, NULL);
+
+    handle = g_new0(VFSFile, 1);
+    handle->uri == NULL;
+
+    buffer = g_new0(VFSBuffer, 1);
+    buffer->data = data;
+    buffer->iter = data;
+    buffer->end = data + size;
+    buffer->size = size;
+
+    handle->handle = buffer;
+    handle->base = &buffer_const;
+
+    return handle;
+}
+
+VFSFile *
+vfs_buffer_new_from_string(gchar *str)
+{
+    g_return_val_if_fail(str != NULL, NULL);
+
+    return vfs_buffer_new(str, strlen(str));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audacious/vfs_buffer.h	Sun Dec 17 08:52:31 2006 -0800
@@ -0,0 +1,70 @@
+/*  Audacious
+ *  Copyright (c) 2006 William Pitcock
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
+ *  02110-1301, USA.
+ */
+
+#ifndef AUDACIOUS_VFS_BUFFER_H
+#define AUDACIOUS_VFS_BUFFER_H
+
+#include <glib.h>
+#include "vfs.h"
+
+G_BEGIN_DECLS
+
+/**
+ * VFSBuffer:
+ * @data: The data inside the VFSBuffer.
+ * @iter: The current position of the VFS buffer iterator.
+ * @begin: The beginning of the memory segment that the VFS buffer uses.
+ * @end: The end of the memory segment that the VFS buffer uses.
+ * @size: The size of the memory segment.
+ *
+ * Private data for the VFS memorybuffer class.
+ **/
+
+typedef struct {
+	guchar *data;
+	guchar *iter;
+	guchar *end;
+	gsize   size;
+} VFSBuffer;
+
+/**
+ * vfs_buffer_new:
+ * @data: Pointer to data to use.
+ * @size: Size of data to use.
+ *
+ * Creates a VFS buffer for reading/writing to a memory segment.
+ *
+ * Return value: A VFSFile handle for the memory segment's stream 
+ *               representation.
+ **/
+VFSFile *vfs_buffer_new(gpointer data, gsize size);
+
+/**
+ * vfs_buffer_new_from_string:
+ * @str: String to use.
+ *
+ * Creates a VFS buffer for reading/writing to a string.
+ *
+ * Return value: A VFSFile handle for the memory segment's stream 
+ *               representation.
+ **/
+VFSFile *vfs_buffer_new_from_string(gchar *str);
+
+G_END_DECLS
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audacious/vfs_common.c	Sun Dec 17 08:52:31 2006 -0800
@@ -0,0 +1,132 @@
+/*  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "vfs.h"
+#include <string.h>
+#include <stdlib.h>
+#include <glib/gprintf.h>
+
+/**
+ * vfs_fputc:
+ * @c: A character to write to the stream.
+ * @stream: A #VFSFile object representing the stream.
+ *
+ * Writes a character to a stream.
+ *
+ * Return value: The character on success, or EOF.
+ **/
+gint vfs_fputc(gint c, VFSFile *stream)
+{
+    guchar uc = (guchar) c;
+
+    if (! vfs_fwrite(&uc, 1, 1, stream)) {
+        return EOF;
+    }
+
+    return uc;
+}
+
+/**
+ * vfs_fgets:
+ * @s: A buffer to put the string in.
+ * @n: The amount of characters to read.
+ * @stream: A #VFSFile object representing the stream.
+ *
+ * Reads a set of characters from a stream.
+ *
+ * Return value: The string on success, or NULL.
+ **/
+gchar *vfs_fgets(gchar *s, gint n, VFSFile *stream)
+{
+    gint c;
+    register gchar *p;
+
+    if(n<=0) return NULL;
+
+    p = s;
+
+    while (--n) {
+        if ((c = vfs_getc(stream))== EOF) {
+            break;
+        }
+        if ((*p++ = c) == '\n') {
+            break;
+        }
+    }
+    if (p > s) {
+        *p = 0;
+        return s;
+    }
+
+    return NULL;
+}
+
+/**
+ * vfs_fputc:
+ * @s: A string to write to the stream.
+ * @stream: A #VFSFile object representing the stream.
+ *
+ * Writes a string to a VFS stream.
+ *
+ * Return value: The amount of bytes written.
+ **/
+int vfs_fputs(const gchar *s, VFSFile *stream)
+{
+	size_t n = strlen(s);
+
+	return ((vfs_fwrite(s, 1, n, stream) == n) ? n : EOF);
+}
+
+/**
+ * vfs_vfprintf:
+ * @stream: A #VFSFile object representing the stream.
+ * @format: A printf-style format string.
+ * @args: A va_list of args to use.
+ *
+ * Writes a formatted string to a VFS stream via a va_list of args.
+ *
+ * Return value: The amount of bytes written.
+ **/
+int vfs_vfprintf(VFSFile *stream, gchar const *format, va_list args)
+{
+    gchar *string;
+    gint rv = g_vasprintf(&string, format, args);
+    if (rv<0) return rv;
+    rv = vfs_fputs(string, stream);
+    free (string);
+    return rv;
+}
+
+/**
+ * vfs_fprintf:
+ * @stream: A #VFSFile object representing the stream.
+ * @format: A printf-style format string.
+ * @...: A list of args to use.
+ *
+ * Writes a formatted string to a VFS stream.
+ *
+ * Return value: The amount of bytes written.
+ **/
+int vfs_fprintf(VFSFile *stream, gchar const *format, ...)
+{
+    va_list arg;
+    gint rv;
+
+    va_start(arg, format);
+    rv = vfs_vfprintf(stream, format, arg);
+    va_end(arg);
+
+    return rv;
+}
--- a/libaudacious/Makefile	Sat Dec 16 11:20:00 2006 -0800
+++ b/libaudacious/Makefile	Sun Dec 17 08:52:31 2006 -0800
@@ -20,12 +20,10 @@
 	-I../intl
 
 CONF_SRC = configdb_$(CONFIGDB_BACKEND).c
-VFS_SRC = vfs.c vfs_common.c vfs_buffer.c
 
 SOURCES = \
 	$(CONF_SRC) \
 	rcfile.c \
-	$(VFS_SRC) \
 	beepctrl.c \
 	dirbrowser.c \
 	util.c \
--- a/libaudacious/vfs.c	Sat Dec 16 11:20:00 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,351 +0,0 @@
-/*  Audacious
- *  Copyright (c) 2006 William Pitcock
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 2 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "vfs.h"
-#include <stdio.h>
-
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "urldecode.h"
-
-static GList *vfs_transports = NULL;
-
-#ifdef VFS_DEBUG
-# define DBG(x, args...) g_print(x, ## args);
-#else
-# define DBG(x, args...)
-#endif
-
-/**
- * vfs_register_transport:
- * @vtable: The #VFSConstructor vtable to register.
- *
- * Registers a #VFSConstructor vtable with the VFS system.
- *
- * Return value: TRUE on success, FALSE on failure.
- **/
-gboolean
-vfs_register_transport(VFSConstructor *vtable)
-{
-    vfs_transports = g_list_append(vfs_transports, vtable);
-
-    return TRUE;
-}
-
-/**
- * vfs_fopen:
- * @path: The path or URI to open.
- * @mode: The preferred access privileges (not guaranteed).
- *
- * Opens a stream from a VFS transport using a #VFSConstructor.
- *
- * Return value: On success, a #VFSFile object representing the stream.
- **/
-VFSFile *
-vfs_fopen(const gchar * path,
-          const gchar * mode)
-{
-    VFSFile *file;
-    gchar **vec;
-    VFSConstructor *vtable = NULL;
-    GList *node;
-    gchar *decpath;
-
-    if (!path || !mode)
-	return NULL;
-
-    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))
-        {
-            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;
-        }
-    }
-
-    /* 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);
-
-    if (file == NULL)
-    {
-        g_strfreev(vec);
-        return NULL;
-    }
-
-    file->uri = g_strdup(path);
-    file->base = vtable;
-
-    g_strfreev(vec);
-    g_free(decpath);
-
-    return file;
-}
-
-/**
- * vfs_fclose:
- * @file: A #VFSFile object to destroy.
- *
- * Closes a VFS stream and destroys a #VFSFile object.
- *
- * Return value: -1 on failure, 0 on success.
- **/
-gint
-vfs_fclose(VFSFile * file)
-{
-    gint ret = 0;
-
-    if (file == NULL)
-        return -1;
-
-    if (file->base->vfs_fclose_impl(file) != 0)
-        ret = -1;
-
-    if (file->uri != NULL)
-        g_free(file->uri);
-
-    g_free(file);
-
-    return ret;
-}
-
-/**
- * vfs_fread:
- * @ptr: A pointer to the destination buffer.
- * @size: The size of each element to read.
- * @nmemb: The number of elements to read.
- * @file: #VFSFile object that represents the VFS stream.
- *
- * Reads from a VFS stream.
- *
- * Return value: The amount of elements succesfully read.
- **/
-size_t
-vfs_fread(gpointer ptr,
-          size_t size,
-          size_t nmemb,
-          VFSFile * file)
-{
-    if (file == NULL)
-        return 0;
-
-    return file->base->vfs_fread_impl(ptr, size, nmemb, file);
-}
-
-/**
- * vfs_fwrite:
- * @ptr: A const pointer to the source buffer.
- * @size: The size of each element to write.
- * @nmemb: The number of elements to write.
- * @file: #VFSFile object that represents the VFS stream.
- *
- * Writes to a VFS stream.
- *
- * Return value: The amount of elements succesfully written.
- **/
-size_t
-vfs_fwrite(gconstpointer ptr,
-           size_t size,
-           size_t nmemb,
-           VFSFile * file)
-{
-    if (file == NULL)
-        return 0;
-
-    return file->base->vfs_fwrite_impl(ptr, size, nmemb, file);
-}
-
-/**
- * vfs_getc:
- * @stream: #VFSFile object that represents the VFS stream.
- *
- * Reads a character from a VFS stream.
- *
- * Return value: On success, a character. Otherwise, -1.
- **/
-gint
-vfs_getc(VFSFile *stream)
-{
-    if (stream == NULL)
-        return -1;
-
-    return stream->base->vfs_getc_impl(stream);
-}
-
-/**
- * vfs_ungetc:
- * @c: The character to push back.
- * @stream: #VFSFile object that represents the VFS stream.
- *
- * Pushes a character back to the VFS stream.
- *
- * Return value: On success, 0. Otherwise, -1.
- **/
-gint
-vfs_ungetc(gint c, VFSFile *stream)
-{
-    if (stream == NULL)
-        return -1;
-
-    return stream->base->vfs_ungetc_impl(c, stream);
-}
-
-/**
- * vfs_fseek:
- * @file: #VFSFile object that represents the VFS stream.
- * @offset: The offset to seek to.
- * @whence: Whether or not the seek is absolute or not.
- *
- * Seeks through a VFS stream.
- *
- * Return value: On success, 1. Otherwise, 0.
- **/
-gint
-vfs_fseek(VFSFile * file,
-          glong offset,
-          gint whence)
-{
-    if (file == NULL)
-        return 0;
-
-    return file->base->vfs_fseek_impl(file, offset, whence);
-}
-
-/**
- * vfs_rewind:
- * @file: #VFSFile object that represents the VFS stream.
- *
- * Rewinds a VFS stream.
- **/
-void
-vfs_rewind(VFSFile * file)
-{
-    if (file == NULL)
-        return;
-
-    file->base->vfs_rewind_impl(file);
-}
-
-/**
- * vfs_ftell:
- * @file: #VFSFile object that represents the VFS stream.
- *
- * Returns the current position in the VFS stream's buffer.
- *
- * Return value: On success, the current position. Otherwise, -1.
- **/
-glong
-vfs_ftell(VFSFile * file)
-{
-    if (file == NULL)
-        return -1;
-
-    return file->base->vfs_ftell_impl(file);
-}
-
-/**
- * vfs_feof:
- * @file: #VFSFile object that represents the VFS stream.
- *
- * Returns whether or not the VFS stream has reached EOF.
- *
- * Return value: On success, whether or not the VFS stream is at EOF. Otherwise, FALSE.
- **/
-gboolean
-vfs_feof(VFSFile * file)
-{
-    if (file == NULL)
-        return FALSE;
-
-    return (gboolean) file->base->vfs_feof_impl(file);
-}
-
-/**
- * vfs_truncate:
- * @file: #VFSFile object that represents the VFS stream.
- * @length: The length to truncate at.
- *
- * Truncates a VFS stream to a certain size.
- *
- * Return value: On success, 0. Otherwise, -1.
- **/
-gint
-vfs_truncate(VFSFile * file, glong length)
-{
-    if (file == NULL)
-        return -1;
-
-    return file->base->vfs_truncate_impl(file, length);
-}
-
-/**
- * vfs_file_test:
- * @path: A path to test.
- * @test: A GFileTest to run.
- *
- * Wrapper for g_file_test().
- *
- * Return value: The result of g_file_test().
- **/
-gboolean
-vfs_file_test(const gchar * path, GFileTest test)
-{
-    return g_file_test(path, test);
-}
-
-/**
- * vfs_is_writeable:
- * @path: A path to test.
- *
- * Tests if a file is writeable.
- *
- * Return value: TRUE if the file is writeable, otherwise FALSE.
- **/
-gboolean
-vfs_is_writeable(const gchar * path)
-{
-    struct stat info;
-
-    if (stat(path, &info) == -1)
-        return FALSE;
-
-    return (info.st_mode & S_IWUSR);
-}
--- a/libaudacious/vfs.h	Sat Dec 16 11:20:00 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * Audacious
- * Copyright (c) 2006 Audacious team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef VFS_H
-#define VFS_H
-
-#include <glib.h>
-#include <stdio.h>
-
-typedef struct _VFSFile VFSFile;
-typedef struct _VFSConstructor VFSConstructor;
-
-/**
- * VFSFile:
- * @uri: The URI of the stream.
- * @handle: Opaque data used by the transport plugins.
- * @base: The base vtable used for VFS functions.
- *
- * #VFSFile objects describe a VFS stream.
- **/
-struct _VFSFile {
-	gchar *uri;
-	gpointer handle;
-	VFSConstructor *base;
-};
-
-/**
- * VFSConstructor:
- * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams.
- * @vfs_fopen_impl: A function pointer which points to a fopen implementation.
- * @vfs_fclose_impl: A function pointer which points to a fclose implementation.
- * @vfs_fread_impl: A function pointer which points to a fread implementation.
- * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation.
- * @vfs_getc_impl: A function pointer which points to a getc implementation.
- * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation.
- * @vfs_fseek_impl: A function pointer which points to a fseek implementation.
- * @vfs_rewind_impl: A function pointer which points to a rewind implementation.
- * @vfs_ftell_impl: A function pointer which points to a ftell implementation.
- * @vfs_feof_impl: A function pointer which points to a feof implementation.
- * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation.
- *
- * #VFSConstructor objects contain the base vtables used for extrapolating
- * a VFS stream. #VFSConstructor objects should be considered %virtual in
- * nature. VFS base vtables are registered via vfs_register_transport().
- **/
-struct _VFSConstructor {
-	gchar *uri_id;
-	VFSFile *(*vfs_fopen_impl)(const gchar *path,
-		const gchar *mode);
-	gint (*vfs_fclose_impl)(VFSFile * file);
-	size_t (*vfs_fread_impl)(gpointer ptr, size_t size,
-		size_t nmemb, VFSFile *file);
-	size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size,
-		size_t nmemb, VFSFile *file);
-	gint (*vfs_getc_impl)(VFSFile *stream);
-	gint (*vfs_ungetc_impl)(gint c, VFSFile *stream);
-	gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence);
-	void (*vfs_rewind_impl)(VFSFile *file);
-	glong (*vfs_ftell_impl)(VFSFile *file);
-	gboolean (*vfs_feof_impl)(VFSFile *file);
-	gboolean (*vfs_truncate_impl)(VFSFile *file, glong length);
-};
-
-G_BEGIN_DECLS
-
-extern VFSFile * vfs_fopen(const gchar * path,
-                    const gchar * mode);
-extern gint vfs_fclose(VFSFile * file);
-
-extern size_t vfs_fread(gpointer ptr,
-                 size_t size,
-                 size_t nmemb,
-                 VFSFile * file);
-extern size_t vfs_fwrite(gconstpointer ptr,
-                  size_t size,
-                  size_t nmemb,
-                  VFSFile *file);
-
-extern gint vfs_getc(VFSFile *stream);
-extern gint vfs_ungetc(gint c,
-                       VFSFile *stream);
-extern gchar *vfs_fgets(gchar *s,
-                        gint n,
-                        VFSFile *stream);
-
-extern gint vfs_fseek(VFSFile * file,
-               glong offset,
-               gint whence);
-extern void vfs_rewind(VFSFile * file);
-extern glong vfs_ftell(VFSFile * file);
-extern gboolean vfs_feof(VFSFile * file);
-
-extern gboolean vfs_file_test(const gchar * path,
-                       GFileTest test);
-
-extern gboolean vfs_is_writeable(const gchar * path);
-
-extern gboolean vfs_truncate(VFSFile * file, glong length);
-
-extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
-
-extern gboolean vfs_register_transport(VFSConstructor *vtable);
-
-G_END_DECLS
-
-#endif /* VFS_H */
--- a/libaudacious/vfs_buffer.c	Sat Dec 16 11:20:00 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*  Audacious
- *  Copyright (c) 2006 William Pitcock
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 2 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
- *  02110-1301, USA.
- */
-
-#include <glib.h>
-#include <string.h>
-#include "vfs.h"
-#include "vfs_buffer.h"
-
-VFSFile *
-buffer_vfs_fopen_impl(const gchar * path,
-          const gchar * mode)
-{
-    return NULL;
-}
-
-gint
-buffer_vfs_fclose_impl(VFSFile * file)
-{
-    g_return_val_if_fail(file != NULL, -1);
-
-    if (file->handle)
-        g_free(file->handle);
-
-    return 0;
-}
-
-size_t
-buffer_vfs_fread_impl(gpointer i_ptr,
-          size_t size,
-          size_t nmemb,
-          VFSFile * file)
-{
-    VFSBuffer *handle;
-    guchar *i;
-    size_t read = 0;
-    guchar *ptr = (guchar *) i_ptr;
-
-    if (file == NULL)
-        return 0;
-
-    handle = (VFSBuffer *) file->handle;
-
-    for (i = ptr; i - ptr <= nmemb * size && i - ptr <= handle->size; i++, handle->iter++)
-    {
-       *i = *handle->iter;
-       read++;
-    }
-
-    return (read / nmemb);
-}
-
-size_t
-buffer_vfs_fwrite_impl(gconstpointer i_ptr,
-           size_t size,
-           size_t nmemb,
-           VFSFile * file)
-{
-    VFSBuffer *handle;
-    const guchar *i;
-    size_t written = 0;
-    const guchar *ptr = (const guchar *) i_ptr;
-
-    if (file == NULL)
-        return 0;
-
-    handle = (VFSBuffer *) file->handle;
-
-    for (i = ptr; (i - ptr) <= nmemb * size && (i - ptr) <= handle->size; i++, handle->iter++)
-    {
-       *handle->iter = *i;
-       written++;
-    }
-
-    return (written / nmemb);
-}
-
-gint
-buffer_vfs_getc_impl(VFSFile *stream)
-{
-  VFSBuffer *handle = (VFSBuffer *) stream->handle;
-  gint c;
-
-  c = *handle->iter;
-  handle->iter++;
-
-  return c;
-}
-
-gint
-buffer_vfs_ungetc_impl(gint c, VFSFile *stream)
-{
-  return -1;
-}
-
-gint
-buffer_vfs_fseek_impl(VFSFile * file,
-          glong offset,
-          gint whence)
-{
-    VFSBuffer *handle;
-
-    if (file == NULL)
-        return 0;
-
-    handle = (VFSBuffer *) file->handle;
-
-    switch(whence)
-    {
-       case SEEK_CUR:
-          handle->iter = handle->iter + offset;
-          break;
-       case SEEK_END:
-          handle->iter = handle->end;
-          break;
-       case SEEK_SET:
-       default:
-          handle->iter = handle->data + offset;
-          break;
-    }
-
-    return 0;
-}
-
-void
-buffer_vfs_rewind_impl(VFSFile * file)
-{
-    VFSBuffer *handle;
-
-    if (file == NULL)
-        return;
-
-    handle = (VFSBuffer *) file->handle;
-
-    handle->iter = handle->data;
-}
-
-glong
-buffer_vfs_ftell_impl(VFSFile * file)
-{
-    VFSBuffer *handle;
-
-    if (file == NULL)
-        return 0;
-
-    handle = (VFSBuffer *) file->handle;
-
-    return handle->iter - handle->data;
-}
-
-gboolean
-buffer_vfs_feof_impl(VFSFile * file)
-{
-    VFSBuffer *handle;
-
-    if (file == NULL)
-        return FALSE;
-
-    handle = (VFSBuffer *) file->handle;
-
-    return (gboolean) (handle->iter == handle->end);
-}
-
-gint
-buffer_vfs_truncate_impl(VFSFile * file, glong size)
-{
-    return 0;
-}
-
-VFSConstructor buffer_const = {
-	NULL,			// not a normal VFS class
-	buffer_vfs_fopen_impl,
-	buffer_vfs_fclose_impl,
-	buffer_vfs_fread_impl,
-	buffer_vfs_fwrite_impl,
-	buffer_vfs_getc_impl,
-	buffer_vfs_ungetc_impl,
-	buffer_vfs_fseek_impl,
-	buffer_vfs_rewind_impl,
-	buffer_vfs_ftell_impl,
-	buffer_vfs_feof_impl,
-	buffer_vfs_truncate_impl
-};
-
-VFSFile *
-vfs_buffer_new(gpointer data, gsize size)
-{
-    VFSFile *handle;
-    VFSBuffer *buffer;
-
-    g_return_val_if_fail(data != NULL, NULL);
-    g_return_val_if_fail(size > 0, NULL);
-
-    handle = g_new0(VFSFile, 1);
-    handle->uri == NULL;
-
-    buffer = g_new0(VFSBuffer, 1);
-    buffer->data = data;
-    buffer->iter = data;
-    buffer->end = data + size;
-    buffer->size = size;
-
-    handle->handle = buffer;
-    handle->base = &buffer_const;
-
-    return handle;
-}
-
-VFSFile *
-vfs_buffer_new_from_string(gchar *str)
-{
-    g_return_val_if_fail(str != NULL, NULL);
-
-    return vfs_buffer_new(str, strlen(str));
-}
--- a/libaudacious/vfs_buffer.h	Sat Dec 16 11:20:00 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*  Audacious
- *  Copyright (c) 2006 William Pitcock
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 2 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
- *  02110-1301, USA.
- */
-
-#ifndef AUDACIOUS_VFS_BUFFER_H
-#define AUDACIOUS_VFS_BUFFER_H
-
-#include <glib.h>
-#include "vfs.h"
-
-G_BEGIN_DECLS
-
-/**
- * VFSBuffer:
- * @data: The data inside the VFSBuffer.
- * @iter: The current position of the VFS buffer iterator.
- * @begin: The beginning of the memory segment that the VFS buffer uses.
- * @end: The end of the memory segment that the VFS buffer uses.
- * @size: The size of the memory segment.
- *
- * Private data for the VFS memorybuffer class.
- **/
-
-typedef struct {
-	guchar *data;
-	guchar *iter;
-	guchar *end;
-	gsize   size;
-} VFSBuffer;
-
-/**
- * vfs_buffer_new:
- * @data: Pointer to data to use.
- * @size: Size of data to use.
- *
- * Creates a VFS buffer for reading/writing to a memory segment.
- *
- * Return value: A VFSFile handle for the memory segment's stream 
- *               representation.
- **/
-VFSFile *vfs_buffer_new(gpointer data, gsize size);
-
-/**
- * vfs_buffer_new_from_string:
- * @str: String to use.
- *
- * Creates a VFS buffer for reading/writing to a string.
- *
- * Return value: A VFSFile handle for the memory segment's stream 
- *               representation.
- **/
-VFSFile *vfs_buffer_new_from_string(gchar *str);
-
-G_END_DECLS
-
-#endif
--- a/libaudacious/vfs_common.c	Sat Dec 16 11:20:00 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software Foundation,
- *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "vfs.h"
-#include <string.h>
-#include <stdlib.h>
-#include <glib/gprintf.h>
-
-/**
- * vfs_fputc:
- * @c: A character to write to the stream.
- * @stream: A #VFSFile object representing the stream.
- *
- * Writes a character to a stream.
- *
- * Return value: The character on success, or EOF.
- **/
-gint vfs_fputc(gint c, VFSFile *stream)
-{
-    guchar uc = (guchar) c;
-
-    if (! vfs_fwrite(&uc, 1, 1, stream)) {
-        return EOF;
-    }
-
-    return uc;
-}
-
-/**
- * vfs_fgets:
- * @s: A buffer to put the string in.
- * @n: The amount of characters to read.
- * @stream: A #VFSFile object representing the stream.
- *
- * Reads a set of characters from a stream.
- *
- * Return value: The string on success, or NULL.
- **/
-gchar *vfs_fgets(gchar *s, gint n, VFSFile *stream)
-{
-    gint c;
-    register gchar *p;
-
-    if(n<=0) return NULL;
-
-    p = s;
-
-    while (--n) {
-        if ((c = vfs_getc(stream))== EOF) {
-            break;
-        }
-        if ((*p++ = c) == '\n') {
-            break;
-        }
-    }
-    if (p > s) {
-        *p = 0;
-        return s;
-    }
-
-    return NULL;
-}
-
-/**
- * vfs_fputc:
- * @s: A string to write to the stream.
- * @stream: A #VFSFile object representing the stream.
- *
- * Writes a string to a VFS stream.
- *
- * Return value: The amount of bytes written.
- **/
-int vfs_fputs(const gchar *s, VFSFile *stream)
-{
-	size_t n = strlen(s);
-
-	return ((vfs_fwrite(s, 1, n, stream) == n) ? n : EOF);
-}
-
-/**
- * vfs_vfprintf:
- * @stream: A #VFSFile object representing the stream.
- * @format: A printf-style format string.
- * @args: A va_list of args to use.
- *
- * Writes a formatted string to a VFS stream via a va_list of args.
- *
- * Return value: The amount of bytes written.
- **/
-int vfs_vfprintf(VFSFile *stream, gchar const *format, va_list args)
-{
-    gchar *string;
-    gint rv = g_vasprintf(&string, format, args);
-    if (rv<0) return rv;
-    rv = vfs_fputs(string, stream);
-    free (string);
-    return rv;
-}
-
-/**
- * vfs_fprintf:
- * @stream: A #VFSFile object representing the stream.
- * @format: A printf-style format string.
- * @...: A list of args to use.
- *
- * Writes a formatted string to a VFS stream.
- *
- * Return value: The amount of bytes written.
- **/
-int vfs_fprintf(VFSFile *stream, gchar const *format, ...)
-{
-    va_list arg;
-    gint rv;
-
-    va_start(arg, format);
-    rv = vfs_vfprintf(stream, format, arg);
-    va_end(arg);
-
-    return rv;
-}