forked from len0rd/rockbox
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
This commit is contained in:
parent
63f75d22b4
commit
332a0fa968
1 changed files with 4 additions and 4 deletions
|
@ -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.
|
* to make sure the current index is still pointing to correct track.
|
||||||
*/
|
*/
|
||||||
static void find_and_set_playlist_index_unlocked(struct playlist_info* playlist,
|
static void find_and_set_playlist_index_unlocked(struct playlist_info* playlist,
|
||||||
unsigned int seek)
|
unsigned long seek)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1443,7 +1443,7 @@ static int randomise_playlist_unlocked(struct playlist_info* playlist,
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
int candidate;
|
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 */
|
/* seed 0 is used to identify sorted playlist for resume purposes */
|
||||||
if (seed == 0)
|
if (seed == 0)
|
||||||
|
@ -1459,7 +1459,7 @@ static int randomise_playlist_unlocked(struct playlist_info* playlist,
|
||||||
candidate = rand() % (count + 1);
|
candidate = rand() % (count + 1);
|
||||||
|
|
||||||
/* now swap the values at the 'count' and 'candidate' positions */
|
/* 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[candidate] = playlist->indices[count];
|
||||||
playlist->indices[count] = indextmp;
|
playlist->indices[count] = indextmp;
|
||||||
#ifdef HAVE_DIRCACHE
|
#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,
|
static int sort_playlist_unlocked(struct playlist_info* playlist,
|
||||||
bool start_current, bool write)
|
bool start_current, bool write)
|
||||||
{
|
{
|
||||||
unsigned int current = playlist->indices[playlist->index];
|
unsigned long current = playlist->indices[playlist->index];
|
||||||
|
|
||||||
if (playlist->amount > 0)
|
if (playlist->amount > 0)
|
||||||
qsort((void*)playlist->indices, playlist->amount,
|
qsort((void*)playlist->indices, playlist->amount,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue