diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2023-11-01 16:06:47 +0100 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2023-11-01 15:35:58 -0400 |
commit | 332a0fa9686b2272b018bc2846a8b3a7dde198fd (patch) | |
tree | 068dc334b9548e365003436e433db17b5403c6d8 | |
parent | 63f75d22b4a87b545e49f13beffe23c723aa9712 (diff) | |
download | rockbox-332a0fa968.tar.gz rockbox-332a0fa968.zip |
Playlist sort/shuffle: Fix data type
I noticed that setting first_index to the
current track when shuffling a playlist
could fail in the Simulator.
Change-Id: Ic9467bd46a93aa2d2b765271110b0baee7058208
-rw-r--r-- | apps/playlist.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 972d0ea755..b0007e49bd 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1417,7 +1417,7 @@ static int remove_track_unlocked(struct playlist_info* playlist, * to make sure the current index is still pointing to correct track. */ static void find_and_set_playlist_index_unlocked(struct playlist_info* playlist, - unsigned int seek) + unsigned long seek) { int i; @@ -1443,7 +1443,7 @@ static int randomise_playlist_unlocked(struct playlist_info* playlist, { int count; int candidate; - unsigned int current = playlist->indices[playlist->index]; + unsigned long current = playlist->indices[playlist->index]; /* seed 0 is used to identify sorted playlist for resume purposes */ if (seed == 0) @@ -1459,7 +1459,7 @@ static int randomise_playlist_unlocked(struct playlist_info* playlist, candidate = rand() % (count + 1); /* now swap the values at the 'count' and 'candidate' positions */ - int indextmp = playlist->indices[candidate]; + unsigned long indextmp = playlist->indices[candidate]; playlist->indices[candidate] = playlist->indices[count]; playlist->indices[count] = indextmp; #ifdef HAVE_DIRCACHE @@ -1525,7 +1525,7 @@ static int sort_compare_fn(const void* p1, const void* p2) static int sort_playlist_unlocked(struct playlist_info* playlist, bool start_current, bool write) { - unsigned int current = playlist->indices[playlist->index]; + unsigned long current = playlist->indices[playlist->index]; if (playlist->amount > 0) qsort((void*)playlist->indices, playlist->amount, |