playlist: exclude end of range

In a range "start:end", "end" itself should not be included.  Use the
same semantics as other languages implementing ranges, e.g. Python.
This commit is contained in:
Max Kellermann
2009-01-10 17:05:03 +01:00
parent 6f0781f039
commit b7c4b78846
2 changed files with 2 additions and 2 deletions

View File

@@ -425,7 +425,7 @@ enum playlist_result playlistInfo(struct client *client, int song, int max)
if (song >= (int)playlist.length)
return PLAYLIST_RESULT_BAD_RANGE;
if (max > 0) {
end = MIN((unsigned)(max + 1), playlist.length);
end = MIN((unsigned)max, playlist.length);
if (end <= begin)
return PLAYLIST_RESULT_BAD_RANGE;
}