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

git version control git at videolan.org
Tue Mar 2 18:29:22 CET 2010


vlc/vlc-1.0 | branch: master | Jakob Leben <jakob.leben at gmail.com> | Tue Mar  2 18:24:36 2010 +0100| [b2aafe0f436262a26e862e68b6539c45be9157f6] | committer: Jean-Baptiste Kempf 

Playlist: fix faulty duration sorting due to integer overflow

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/src/playlist/sort.c b/src/playlist/sort.c
index dd477fb..9eb940f 100644
--- a/src/playlist/sort.c
+++ b/src/playlist/sort.c
@@ -209,8 +209,10 @@ static int playlist_cmp(const void *first, const void *second)
     }
     else if( sort_mode == SORT_DURATION )
     {
-        i_test = input_item_GetDuration( (*(playlist_item_t **)first)->p_input ) -
-                 input_item_GetDuration( (*(playlist_item_t **)second)->p_input );
+        mtime_t time1 = input_item_GetDuration( (*(playlist_item_t **)first)->p_input );
+        mtime_t time2 = input_item_GetDuration( (*(playlist_item_t **)second)->p_input );
+        i_test = time1 > time2 ? 1 :
+                    ( time1 == time2 ? 0 : -1 );
     }
     else if( sort_mode == SORT_ARTIST )
     {



More information about the vlc-commits mailing list