1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dave Hooper 2009-07-08 00:30:23 +00:00
parent be0cd7310a
commit 008f611bca

View file

@ -3093,16 +3093,18 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
sizeof(filename)) < 0) sizeof(filename)) < 0)
return -1; return -1;
/* We want to insert the track at the position that was specified by
new_index. This may be different then new_index because of the
shifting that will occur after the delete.
We calculate this before we do the remove as it depends on the
size of the playlist before the track removal */
r = rotate_index(playlist, new_index);
/* Delete track from original position */ /* Delete track from original position */
result = remove_track_from_playlist(playlist, index, true); result = remove_track_from_playlist(playlist, index, true);
if (result != -1) if (result != -1)
{ {
/* We want to insert the track at the position that was specified by
new_index. This may be different then new_index because of the
shifting that occurred after the delete */
r = rotate_index(playlist, new_index);
if (r == 0) if (r == 0)
/* First index */ /* First index */
new_index = PLAYLIST_PREPEND; new_index = PLAYLIST_PREPEND;