diff options
author | Dave Hooper <dave@beermex.com> | 2009-07-08 00:30:23 +0000 |
---|---|---|
committer | Dave Hooper <dave@beermex.com> | 2009-07-08 00:30:23 +0000 |
commit | 008f611bca3173e21027a568540281c0d7d03ef2 (patch) | |
tree | 225d3368ceb0fb3a7273eafadb1efcbed6c815fb /apps | |
parent | be0cd7310a5dc9e3e058e4c8235faad2bb11b220 (diff) | |
download | rockbox-008f611bca3173e21027a568540281c0d7d03ef2.tar.gz rockbox-008f611bca3173e21027a568540281c0d7d03ef2.zip |
Fix bug in playlist_move where the track would end up one place too early / too late if the move wrapped from one end of the playlist indices to the other end
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21708 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 58e0042646..1d291cf6d0 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -3093,16 +3093,18 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) | |||
3093 | sizeof(filename)) < 0) | 3093 | sizeof(filename)) < 0) |
3094 | return -1; | 3094 | return -1; |
3095 | 3095 | ||
3096 | /* We want to insert the track at the position that was specified by | ||
3097 | new_index. This may be different then new_index because of the | ||
3098 | shifting that will occur after the delete. | ||
3099 | We calculate this before we do the remove as it depends on the | ||
3100 | size of the playlist before the track removal */ | ||
3101 | r = rotate_index(playlist, new_index); | ||
3102 | |||
3096 | /* Delete track from original position */ | 3103 | /* Delete track from original position */ |
3097 | result = remove_track_from_playlist(playlist, index, true); | 3104 | result = remove_track_from_playlist(playlist, index, true); |
3098 | 3105 | ||
3099 | if (result != -1) | 3106 | if (result != -1) |
3100 | { | 3107 | { |
3101 | /* We want to insert the track at the position that was specified by | ||
3102 | new_index. This may be different then new_index because of the | ||
3103 | shifting that occurred after the delete */ | ||
3104 | r = rotate_index(playlist, new_index); | ||
3105 | |||
3106 | if (r == 0) | 3108 | if (r == 0) |
3107 | /* First index */ | 3109 | /* First index */ |
3108 | new_index = PLAYLIST_PREPEND; | 3110 | new_index = PLAYLIST_PREPEND; |