diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-11-08 13:28:13 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-11-08 13:28:13 +0000 |
commit | f56cb7e09f8c6c6c0c2b024d4e69a3febb0746a6 (patch) | |
tree | 40b4a70755631f5a4751617561168294b2f2237f /apps/buffering.c | |
parent | f87eb608a8fbb8eca629d080e8ef83dbcce6203e (diff) | |
download | rockbox-f56cb7e09f8c6c6c0c2b024d4e69a3febb0746a6.tar.gz rockbox-f56cb7e09f8c6c6c0c2b024d4e69a3febb0746a6.zip |
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
Diffstat (limited to 'apps/buffering.c')
-rw-r--r-- | apps/buffering.c | 10 |
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) | |||
974 | * actual amount of data available for reading. This function explicitly | 974 | * actual amount of data available for reading. This function explicitly |
975 | * does not check the validity of the input handle. It does do range checks | 975 | * does not check the validity of the input handle. It does do range checks |
976 | * on size and returns a valid (and explicit) amount of data for reading */ | 976 | * on size and returns a valid (and explicit) amount of data for reading */ |
977 | static size_t prep_bufdata(const struct memory_handle *h, size_t size) | 977 | static size_t prep_bufdata(const struct memory_handle *h, size_t size, |
978 | bool filechunk_limit) | ||
978 | { | 979 | { |
979 | size_t avail = RINGBUF_SUB(h->widx, h->ridx); | 980 | size_t avail = RINGBUF_SUB(h->widx, h->ridx); |
980 | 981 | ||
@@ -985,7 +986,8 @@ static size_t prep_bufdata(const struct memory_handle *h, size_t size) | |||
985 | if (size == 0 || size > avail + h->filerem) | 986 | if (size == 0 || size > avail + h->filerem) |
986 | size = avail + h->filerem; | 987 | size = avail + h->filerem; |
987 | 988 | ||
988 | if (h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK) | 989 | if (filechunk_limit && |
990 | h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK) | ||
989 | { | 991 | { |
990 | logf("data request > filechunk"); | 992 | logf("data request > filechunk"); |
991 | /* If more than a filechunk is requested, provide no more than the | 993 | /* 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) | |||
1020 | if (!h) | 1022 | if (!h) |
1021 | return ERR_HANDLE_NOT_FOUND; | 1023 | return ERR_HANDLE_NOT_FOUND; |
1022 | 1024 | ||
1023 | size = prep_bufdata(h, size); | 1025 | size = prep_bufdata(h, size, false); |
1024 | 1026 | ||
1025 | if (h->ridx + size > buffer_len) | 1027 | if (h->ridx + size > buffer_len) |
1026 | { | 1028 | { |
@@ -1052,7 +1054,7 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data) | |||
1052 | if (!h) | 1054 | if (!h) |
1053 | return ERR_HANDLE_NOT_FOUND; | 1055 | return ERR_HANDLE_NOT_FOUND; |
1054 | 1056 | ||
1055 | size = prep_bufdata(h, size); | 1057 | size = prep_bufdata(h, size, true); |
1056 | 1058 | ||
1057 | if (h->ridx + size > buffer_len) | 1059 | if (h->ridx + size > buffer_len) |
1058 | { | 1060 | { |