diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-02-13 11:02:37 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-02-13 11:02:37 +0000 |
commit | efdf49668e1784400008062077f1335784818c9c (patch) | |
tree | 3ce720b575484fca1c3a85dc36a7994034d3994d /apps/buffering.c | |
parent | 78a71d4701bdcfdce3f1f744c02990a2c3b71dd0 (diff) | |
download | rockbox-efdf49668e1784400008062077f1335784818c9c.tar.gz rockbox-efdf49668e1784400008062077f1335784818c9c.zip |
Needed to do a few more things to have r29291 correct.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29294 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/buffering.c')
-rw-r--r-- | apps/buffering.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 213826fda0..85028dc8e6 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -250,7 +250,7 @@ static struct memory_handle *add_handle(size_t data_size, bool can_wrap, | |||
250 | /* gives each handle a unique id */ | 250 | /* gives each handle a unique id */ |
251 | static int cur_handle_id = 0; | 251 | static int cur_handle_id = 0; |
252 | size_t shift; | 252 | size_t shift; |
253 | size_t new_widx; | 253 | size_t widx, new_widx; |
254 | size_t len; | 254 | size_t len; |
255 | ssize_t overlap; | 255 | ssize_t overlap; |
256 | 256 | ||
@@ -260,7 +260,7 @@ static struct memory_handle *add_handle(size_t data_size, bool can_wrap, | |||
260 | mutex_lock(&llist_mutex); | 260 | mutex_lock(&llist_mutex); |
261 | mutex_lock(&llist_mod_mutex); | 261 | mutex_lock(&llist_mod_mutex); |
262 | 262 | ||
263 | new_widx = buf_widx; | 263 | widx = buf_widx; |
264 | 264 | ||
265 | if (cur_handle && cur_handle->filerem > 0) { | 265 | if (cur_handle && cur_handle->filerem > 0) { |
266 | /* the current handle hasn't finished buffering. We can only add | 266 | /* the current handle hasn't finished buffering. We can only add |
@@ -274,12 +274,12 @@ static struct memory_handle *add_handle(size_t data_size, bool can_wrap, | |||
274 | return NULL; | 274 | return NULL; |
275 | } else { | 275 | } else { |
276 | /* Allocate the remainder of the space for the current handle */ | 276 | /* Allocate the remainder of the space for the current handle */ |
277 | new_widx = ringbuf_add(cur_handle->widx, cur_handle->filerem); | 277 | widx = ringbuf_add(cur_handle->widx, cur_handle->filerem); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | /* align to 4 bytes up */ | 281 | /* align to 4 bytes up */ |
282 | new_widx = ringbuf_add(new_widx, 3) & ~3; | 282 | new_widx = ringbuf_add(widx, 3) & ~3; |
283 | 283 | ||
284 | len = data_size + sizeof(struct memory_handle); | 284 | len = data_size + sizeof(struct memory_handle); |
285 | 285 | ||
@@ -291,11 +291,11 @@ static struct memory_handle *add_handle(size_t data_size, bool can_wrap, | |||
291 | new_widx = 0; | 291 | new_widx = 0; |
292 | } | 292 | } |
293 | 293 | ||
294 | /* How far we shifted buf_widx to align things, must be < buffer_len */ | 294 | /* How far we shifted the new_widx to align things, must be < buffer_len */ |
295 | shift = ringbuf_sub(new_widx, buf_widx); | 295 | shift = ringbuf_sub(new_widx, widx); |
296 | 296 | ||
297 | /* How much space are we short in the actual ring buffer? */ | 297 | /* How much space are we short in the actual ring buffer? */ |
298 | overlap = ringbuf_add_cross(buf_widx, shift + len, buf_ridx); | 298 | overlap = ringbuf_add_cross(widx, shift + len, buf_ridx); |
299 | if (overlap >= 0 && (alloc_all || (size_t)overlap >= data_size)) { | 299 | if (overlap >= 0 && (alloc_all || (size_t)overlap >= data_size)) { |
300 | /* Not enough space for required allocations */ | 300 | /* Not enough space for required allocations */ |
301 | mutex_unlock(&llist_mod_mutex); | 301 | mutex_unlock(&llist_mod_mutex); |