diff options
author | Antonius Hellmann <toni@rockbox.org> | 2009-02-22 10:12:34 +0000 |
---|---|---|
committer | Antonius Hellmann <toni@rockbox.org> | 2009-02-22 10:12:34 +0000 |
commit | 0055f13707bdeeca5893c57541d73a84b6069f9f (patch) | |
tree | c5721ebf19612cdb7b72a40350f31273cff3c9b6 | |
parent | f53630a168a6793da9fb8e5d1318c03a78cf0cb6 (diff) | |
download | rockbox-0055f13707bdeeca5893c57541d73a84b6069f9f.tar.gz rockbox-0055f13707bdeeca5893c57541d73a84b6069f9f.zip |
This should fix the occasional data aborts mainly in conjunction with AlbumArt on PP targets. See FS#9827 for details.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20081 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/buffering.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index d715456efb..ba9ed5e57e 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -251,17 +251,11 @@ static struct memory_handle *add_handle(size_t data_size, bool can_wrap, | |||
251 | len = data_size + sizeof(struct memory_handle); | 251 | len = data_size + sizeof(struct memory_handle); |
252 | 252 | ||
253 | /* First, will the handle wrap? */ | 253 | /* First, will the handle wrap? */ |
254 | overlap = RINGBUF_ADD_CROSS(new_widx, sizeof(struct memory_handle), | ||
255 | buffer_len - 1); | ||
256 | /* If the handle would wrap, move to the beginning of the buffer, | 254 | /* If the handle would wrap, move to the beginning of the buffer, |
257 | * otherwise check if the data can/would wrap and move it to the | 255 | * or if the data must not but would wrap, move it to the beginning */ |
258 | * beginning if needed */ | 256 | if( (new_widx + sizeof(struct memory_handle) > buffer_len) || |
259 | if (overlap > 0) { | 257 | (!can_wrap && (new_widx + len > buffer_len)) ) { |
260 | new_widx = 0; | 258 | new_widx = 0; |
261 | } else if (!can_wrap) { | ||
262 | overlap = RINGBUF_ADD_CROSS(new_widx, len, buffer_len - 1); | ||
263 | if (overlap > 0) | ||
264 | new_widx += data_size - overlap; | ||
265 | } | 259 | } |
266 | 260 | ||
267 | /* How far we shifted buf_widx to align things, must be < buffer_len */ | 261 | /* How far we shifted buf_widx to align things, must be < buffer_len */ |