From: Jakob Leben Date: Tue, 2 Mar 2010 10:12:03 +0000 (+0100) Subject: Playlist: fix faulty duration sorting due to integer overflow X-Git-Tag: 1.1.0-pre1~577 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=41bf4c46cb6c9f30a621ebb3d68bc8844c35a9be;p=vlc Playlist: fix faulty duration sorting due to integer overflow close #3361 --- 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 )