# HG changeset patch # User ertzing # Date 1177076947 25200 # Node ID ac22b2cb60134fa70ad5de5db45df42fe173537b # Parent fcc497f51c16f85d0f021190a61cac9d2465fe42 [svn] - Add a vfs_fsize() call to the VFS layer diff -r fcc497f51c16 -r ac22b2cb6013 ChangeLog --- a/ChangeLog Fri Apr 20 04:49:29 2007 -0700 +++ b/ChangeLog Fri Apr 20 06:49:07 2007 -0700 @@ -1,3 +1,10 @@ +2007-04-20 11:49:29 +0000 Ralf Ertzinger + revision [4400] + Some more bad escapes + trunk/po/sr@Latn.po | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-04-20 11:45:22 +0000 Ralf Ertzinger revision [4398] Fix some wrong escape sequences diff -r fcc497f51c16 -r ac22b2cb6013 src/audacious/build_stamp.c --- a/src/audacious/build_stamp.c Fri Apr 20 04:49:29 2007 -0700 +++ b/src/audacious/build_stamp.c Fri Apr 20 06:49:07 2007 -0700 @@ -1,2 +1,2 @@ #include -const gchar *svn_stamp = "20070420-4398"; +const gchar *svn_stamp = "20070420-4400"; diff -r fcc497f51c16 -r ac22b2cb6013 src/audacious/vfs.c --- a/src/audacious/vfs.c Fri Apr 20 04:49:29 2007 -0700 +++ b/src/audacious/vfs.c Fri Apr 20 06:49:07 2007 -0700 @@ -303,6 +303,24 @@ } /** + * vfs_fsize: + * @file: #VFSFile object that represents the VFS stream. + * + * Returns te size of the file + * + * Return value: On success, the size of the file in bytes. + * Otherwise, -1. + */ +off_t +vfs_fsize(VFSFile * file) +{ + if (file == NULL) + return -1; + + return file->base->vfs_fsize_impl(file); +} + +/** * vfs_get_metadata: * @file: #VFSFile object that represents the VFS stream. * @field: The string constant field name to get. diff -r fcc497f51c16 -r ac22b2cb6013 src/audacious/vfs.h --- a/src/audacious/vfs.h Fri Apr 20 04:49:29 2007 -0700 +++ b/src/audacious/vfs.h Fri Apr 20 06:49:07 2007 -0700 @@ -21,6 +21,7 @@ #include #include +#include typedef struct _VFSFile VFSFile; typedef struct _VFSConstructor VFSConstructor; @@ -76,6 +77,7 @@ glong (*vfs_ftell_impl)(VFSFile *file); gboolean (*vfs_feof_impl)(VFSFile *file); gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); + off_t (*vfs_fsize_impl)(VFSFile *file); gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field); }; @@ -117,6 +119,8 @@ extern gboolean vfs_truncate(VFSFile * file, glong length); +extern off_t vfs_fsize(VFSFile * file); + extern gchar *vfs_get_metadata(VFSFile * file, const gchar * field); extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) diff -r fcc497f51c16 -r ac22b2cb6013 src/audacious/vfs_buffer.c --- a/src/audacious/vfs_buffer.c Fri Apr 20 04:49:29 2007 -0700 +++ b/src/audacious/vfs_buffer.c Fri Apr 20 06:49:07 2007 -0700 @@ -185,6 +185,19 @@ return 0; } +off_t +buffer_vfs_fsize_impl(VFSFile * file) +{ + VFSBuffer *handle; + + if (file == NULL) + return -1; + + handle = (VFSBuffer *) file->handle; + + return (off_t)handle->end; +} + VFSConstructor buffer_const = { NULL, // not a normal VFS class buffer_vfs_fopen_impl, @@ -198,6 +211,7 @@ buffer_vfs_ftell_impl, buffer_vfs_feof_impl, buffer_vfs_truncate_impl, + buffer_vfs_fsize_impl, NULL }; diff -r fcc497f51c16 -r ac22b2cb6013 src/audacious/vfs_buffered_file.c --- a/src/audacious/vfs_buffered_file.c Fri Apr 20 04:49:29 2007 -0700 +++ b/src/audacious/vfs_buffered_file.c Fri Apr 20 06:49:07 2007 -0700 @@ -157,6 +157,14 @@ return 0; } +off_t +buffered_file_vfs_fsize_impl(VFSFile * file) +{ + VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; + + return vfs_fsize(handle->which == TRUE ? handle->fd : handle->buffer); +} + gchar * buffered_file_vfs_metadata_impl(VFSFile * file, const gchar * field) { @@ -178,6 +186,7 @@ buffered_file_vfs_ftell_impl, buffered_file_vfs_feof_impl, buffered_file_vfs_truncate_impl, + buffered_file_vfs_fsize_impl, buffered_file_vfs_metadata_impl };