changeset 32494:288e5d438772

Fix bd:// with -cache, the bd_read function does not work when more than 1 sector is requested at once.
author reimar
date Sat, 06 Nov 2010 15:11:21 +0000
parents 59b6fef90241
children cfa30cde4b69
files stream/stream_bd.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_bd.c	Sat Nov 06 14:57:44 2010 +0000
+++ b/stream/stream_bd.c	Sat Nov 06 15:11:21 2010 +0000
@@ -276,6 +276,9 @@
 static off_t bd_read(struct bd_priv *bd, uint8_t *buf, int len)
 {
     int read_len;
+    // TODO: would be nicer if this function also worked for larger reads
+    int max_len = BD_UNIT_SIZE - (bd->pos % BD_UNIT_SIZE);
+    len = FFMIN(len, max_len);
     len &= ~15;
     if (!len)
         return 0;