[vlc-devel] commit: Playlist: fix faulty duration sorting due to integer overflow ( Jakob Leben )

git version control git at videolan.org
Tue Mar 2 11:29:31 CET 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Tue Mar  2 11:12:03 2010 +0100| [41bf4c46cb6c9f30a621ebb3d68bc8844c35a9be] | committer: Jakob Leben 

Playlist: fix faulty duration sorting due to integer overflow

close #3361

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41bf4c46cb6c9f30a621ebb3d68bc8844c35a9be
---

 src/playlist/sort.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/playlist/sort.c b/src/playlist/sort.c
index 95abbbe..d6e5c3f 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 )




More information about the vlc-devel mailing list