#endif
#include <vlc_common.h>
+#include <vlc_rand.h>
#define VLC_INTERNAL_PLAYLIST_SORT_FUNCTIONS
#include "vlc_playlist.h"
#include "playlist_internal.h"
for( i_position = i_items - 1; i_position > 0; i_position-- )
{
- i_new = rand() % i_position;
+ i_new = ((unsigned)vlc_mrand48()) % (i_position+1);
p_temp = pp_items[i_position];
pp_items[i_position] = pp_items[i_new];
pp_items[i_new] = p_temp;
SORTFN( SORT_DURATION, first, second )
{
- return input_item_GetDuration( first->p_input ) -
- input_item_GetDuration( second->p_input );
+ mtime_t time1 = input_item_GetDuration( first->p_input );
+ mtime_t time2 = input_item_GetDuration( second->p_input );
+ int i_ret = time1 > time2 ? 1 :
+ ( time1 == time2 ? 0 : -1 );
+ return i_ret;
}
SORTFN( SORT_GENRE, first, second )