From 41bf4c46cb6c9f30a621ebb3d68bc8844c35a9be Mon Sep 17 00:00:00 2001 From: Jakob Leben Date: Tue, 2 Mar 2010 11:12:03 +0100 Subject: [PATCH] Playlist: fix faulty duration sorting due to integer overflow close #3361 --- src/playlist/sort.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/playlist/sort.c b/src/playlist/sort.c index 95abbbea36..d6e5c3faea 100644 --- a/src/playlist/sort.c +++ b/src/playlist/sort.c @@ -240,8 +240,11 @@ SORTFN( SORT_DESCRIPTION, first, second ) 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 ) -- 2.39.5