Playlist: fix bug in moving after current song

Moving songs using either 'move' or 'moveid' to position -1 (after the
current song) would fail for a song which is just before the current
song.
This patch corrects the check to see if the current song is in the range
to be moved. Since the range is from `start` up to `end` (exclusive) the
check was incorrect, but is now fixed.
This commit is contained in:
Maarten Sebregts 2011-12-19 21:15:00 +01:00 committed by Max Kellermann
parent 96ad5b8444
commit 3a9697adf2
2 changed files with 2 additions and 1 deletions

1
NEWS
View File

@ -2,6 +2,7 @@ ver 0.16.7 (2011/??/??)
* output: * output:
- httpd: fix excessive buffering - httpd: fix excessive buffering
- openal: force 16 bit playback, as 8 bit doesn't work - openal: force 16 bit playback, as 8 bit doesn't work
* fix moving after current song
ver 0.16.6 (2011/12/01) ver 0.16.6 (2011/12/01)

View File

@ -356,7 +356,7 @@ playlist_move_range(struct playlist *playlist,
playlist->current) playlist->current)
: -1; : -1;
if (to < 0 && playlist->current >= 0) { if (to < 0 && playlist->current >= 0) {
if (start <= (unsigned)currentSong && (unsigned)currentSong <= end) if (start <= (unsigned)currentSong && (unsigned)currentSong < end)
/* no-op, can't be moved to offset of itself */ /* no-op, can't be moved to offset of itself */
return PLAYLIST_RESULT_SUCCESS; return PLAYLIST_RESULT_SUCCESS;
to = (currentSong + abs(to)) % queue_length(&playlist->queue); to = (currentSong + abs(to)) % queue_length(&playlist->queue);