From 332a0fa9686b2272b018bc2846a8b3a7dde198fd Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Wed, 1 Nov 2023 16:06:47 +0100 Subject: 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 --- apps/playlist.c | 8 ++++---- 1 file 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, -- cgit v1.2.3