Mercurial > audlegacy
changeset 926:3d4af4890339 trunk
[svn] Conversion of file operations to VFS. Needs stress testing, especially on Gnome-VFS.
author | chainsaw |
---|---|
date | Wed, 12 Apr 2006 13:35:24 -0700 |
parents | 25963e82c40f |
children | afd83c152cfd |
files | Plugins/Input/wma/libffwma/Makefile.in Plugins/Input/wma/libffwma/file.c |
diffstat | 2 files changed, 25 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/wma/libffwma/Makefile.in Wed Apr 12 11:07:10 2006 -0700 +++ b/Plugins/Input/wma/libffwma/Makefile.in Wed Apr 12 13:35:24 2006 -0700 @@ -13,6 +13,6 @@ parser.c simple_idct.c simple_idct.h \ utils.h utils.c wmadata.h wmadec.c -CFLAGS+= -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -I../../../.. -I../../../../intl +CFLAGS+= -fPIC -DPIC $(GTK_CFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -I../../../.. -I../../../../intl OBJECTS=${SOURCES:.c=.o}
--- a/Plugins/Input/wma/libffwma/file.c Wed Apr 12 11:07:10 2006 -0700 +++ b/Plugins/Input/wma/libffwma/file.c Wed Apr 12 13:35:24 2006 -0700 @@ -22,52 +22,61 @@ #include <unistd.h> #include <sys/ioctl.h> #include <sys/time.h> +#include "libaudacious/vfs.h" /* standard file protocol */ static int file_open(URLContext *h, const char *filename, int flags) { - int access; - int fd; + VFSFile *file; strstart(filename, "file:", &filename); if (flags & URL_WRONLY) { - access = O_CREAT | O_TRUNC | O_WRONLY; + file = vfs_fopen(filename, "wb"); } else { - access = O_RDONLY; + file = vfs_fopen(filename, "rb"); } - fd = open(filename, access, 0666); - if (fd < 0) + if (file == NULL) return -ENOENT; - h->priv_data = (void *)(long)fd; + h->priv_data = file; return 0; } static int file_read(URLContext *h, unsigned char *buf, int size) { - int fd = (int)(long)h->priv_data; - return read(fd, buf, size); + VFSFile *file; + file = h->priv_data; + return vfs_fread(buf, 1, size, file); } static int file_write(URLContext *h, unsigned char *buf, int size) { - int fd = (int)(long)h->priv_data; - return write(fd, buf, size); + VFSFile *file; + file = h->priv_data; + return vfs_fwrite(buf, 1, size, file); } /* XXX: use llseek */ static offset_t file_seek(URLContext *h, offset_t pos, int whence) { - int fd = (int)(long)h->priv_data; - return lseek(fd, pos, whence); + int result = 0; + VFSFile *file; + file = h->priv_data; + result = vfs_fseek(file, pos, whence); + if (result == 0) + result = vfs_ftell(file); + else + result = -1; + return result; } static int file_close(URLContext *h) { - int fd = (int)(long)h->priv_data; - return close(fd); + VFSFile *file; + file = h->priv_data; + return vfs_fclose(file); } URLProtocol file_protocol = {