From ed41ba0ca75c792e5a1ce9d88a4970882ac8c228 Mon Sep 17 00:00:00 2001 From: Hardeep Sidhu Date: Fri, 5 May 2006 08:32:07 +0000 Subject: Fixed bug with playlist_skip_entry when track to be skipped was less then current index git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9879 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index 8c208687c8..7942bac1ca 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1020,13 +1020,15 @@ void playlist_skip_entry(struct playlist_info *playlist, int steps) if (playlist == NULL) playlist = ¤t_playlist; - index = rotate_index(playlist, playlist->index); - /* We should also skip already skipped entries before the entry to be skipepd. */ - index += calculate_step_count(playlist, steps); - if (index < 0 || index >= playlist->amount) - return ; - - index = (index+playlist->first_index) % playlist->amount; + /* need to account for already skipped tracks */ + steps = calculate_step_count(playlist, steps); + + index = playlist->index + steps; + if (index < 0) + index += playlist->amount; + else if (index >= playlist->amount) + index -= playlist->amount; + playlist->indices[index] |= PLAYLIST_SKIPPED; } -- cgit v1.2.3