changeset 2371:3b8b7d4dc10b trunk

[svn] - possible fix for VFSBufferedFile crash
author nenolod
date Sat, 20 Jan 2007 03:07:30 -0800
parents ebe01d05f1dc
children d68e6f302855
files ChangeLog src/audacious/vfs_buffered_file.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 19 21:26:43 2007 -0800
+++ b/ChangeLog	Sat Jan 20 03:07:30 2007 -0800
@@ -1,3 +1,11 @@
+2007-01-20 05:26:43 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [3750]
+  - turn off VFS debugging notices
+  
+  trunk/src/audacious/vfs.c |    4 ----
+  1 file changed, 4 deletions(-)
+
+
 2007-01-20 05:25:46 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [3748]
   - new headless event loop
--- a/src/audacious/vfs_buffered_file.c	Fri Jan 19 21:26:43 2007 -0800
+++ b/src/audacious/vfs_buffered_file.c	Sat Jan 20 03:07:30 2007 -0800
@@ -74,6 +74,13 @@
 {
     VFSBufferedFile *handle = (VFSBufferedFile *) stream->handle;
 
+    /* is this request within the buffered area, or should we switch to 
+     * an FD? --nenolod
+     */
+    if ((vfs_ftell(handle->buffer)) + (size * nmemb) >= 
+	((VFSBuffer *) handle->buffer->handle)->size)
+        handle->which = TRUE;
+
     return vfs_getc(handle->which == TRUE ? handle->fd : handle->buffer);
 }