summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-08 13:28:13 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-08 13:28:13 +0000
commitf56cb7e09f8c6c6c0c2b024d4e69a3febb0746a6 (patch)
tree40b4a70755631f5a4751617561168294b2f2237f
parentf87eb608a8fbb8eca629d080e8ef83dbcce6203e (diff)
Fix the bug where MPC files would be skipped by disabling the check of the requested size against the default filechunk size in prep_bufdata when the caller is bufread.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15528 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/buffering.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 8d44bbec27..f4316fe5af 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -974,7 +974,8 @@ int bufadvance(int handle_id, off_t offset)
* actual amount of data available for reading. This function explicitly
* does not check the validity of the input handle. It does do range checks
* on size and returns a valid (and explicit) amount of data for reading */
-static size_t prep_bufdata(const struct memory_handle *h, size_t size)
+static size_t prep_bufdata(const struct memory_handle *h, size_t size,
+ bool filechunk_limit)
{
size_t avail = RINGBUF_SUB(h->widx, h->ridx);
@@ -985,7 +986,8 @@ static size_t prep_bufdata(const struct memory_handle *h, size_t size)
if (size == 0 || size > avail + h->filerem)
size = avail + h->filerem;
- if (h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK)
+ if (filechunk_limit &&
+ h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK)
{
logf("data request > filechunk");
/* If more than a filechunk is requested, provide no more than the
@@ -1020,7 +1022,7 @@ ssize_t bufread(int handle_id, size_t size, void *dest)
if (!h)
return ERR_HANDLE_NOT_FOUND;
- size = prep_bufdata(h, size);
+ size = prep_bufdata(h, size, false);
if (h->ridx + size > buffer_len)
{
@@ -1052,7 +1054,7 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data)
if (!h)
return ERR_HANDLE_NOT_FOUND;
- size = prep_bufdata(h, size);
+ size = prep_bufdata(h, size, true);
if (h->ridx + size > buffer_len)
{