mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
f53630a168
commit
0055f13707
1 changed files with 3 additions and 9 deletions
|
@ -251,17 +251,11 @@ static struct memory_handle *add_handle(size_t data_size, bool can_wrap,
|
||||||
len = data_size + sizeof(struct memory_handle);
|
len = data_size + sizeof(struct memory_handle);
|
||||||
|
|
||||||
/* First, will the handle wrap? */
|
/* First, will the handle wrap? */
|
||||||
overlap = RINGBUF_ADD_CROSS(new_widx, sizeof(struct memory_handle),
|
|
||||||
buffer_len - 1);
|
|
||||||
/* If the handle would wrap, move to the beginning of the buffer,
|
/* If the handle would wrap, move to the beginning of the buffer,
|
||||||
* otherwise check if the data can/would wrap and move it to the
|
* or if the data must not but would wrap, move it to the beginning */
|
||||||
* beginning if needed */
|
if( (new_widx + sizeof(struct memory_handle) > buffer_len) ||
|
||||||
if (overlap > 0) {
|
(!can_wrap && (new_widx + len > buffer_len)) ) {
|
||||||
new_widx = 0;
|
new_widx = 0;
|
||||||
} else if (!can_wrap) {
|
|
||||||
overlap = RINGBUF_ADD_CROSS(new_widx, len, buffer_len - 1);
|
|
||||||
if (overlap > 0)
|
|
||||||
new_widx += data_size - overlap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* How far we shifted buf_widx to align things, must be < buffer_len */
|
/* How far we shifted buf_widx to align things, must be < buffer_len */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue