beast r4484 - trunk/bse



Author: stw
Date: Sat Apr 11 08:47:18 2009
New Revision: 4484
URL: http://svn.gnome.org/viewvc/beast?rev=4484&view=rev

Log:
Thu Mar 19 16:40:17 2009  Stefan Westerfeld  <stefan space twc de>

	* gsldatahandle-vorbis.c: Modified the vfile read function so that no
	data beyond the end of the virtual file is read. This fixes the
	problems BEAST sometimes has to read its own .bse files.
	Fixes #575977 - Some .bse files written by BEAST cannot be loaded again



Modified:
   trunk/bse/ChangeLog
   trunk/bse/gsldatahandle-vorbis.c

Modified: trunk/bse/gsldatahandle-vorbis.c
==============================================================================
--- trunk/bse/gsldatahandle-vorbis.c	(original)
+++ trunk/bse/gsldatahandle-vorbis.c	Sat Apr 11 08:47:18 2009
@@ -93,7 +93,9 @@
 	    void  *datasource)
 {
   VFile *vfile = datasource;
-  return gsl_rfile_read (vfile->rfile, size * nmemb, ptr);
+  size_t bytes = size * nmemb;
+  size_t bytes_to_eof = vfile->byte_length - (gsl_rfile_position (vfile->rfile) - vfile->byte_offset);
+  return gsl_rfile_read (vfile->rfile, MIN (bytes, bytes_to_eof), ptr);
 }
 
 static int



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]