[vlc-commits] ttml: simplify tt_time_Compare()

Steve Lhomme git at videolan.org
Fri May 4 10:38:00 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May  3 10:18:33 2018 +0200| [4a604f3173a4f48db26f47469f5e82bbe3d03374] | committer: Rémi Denis-Courmont

ttml: simplify tt_time_Compare()

The case where one of the values is invalid is still not handled.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/codec/ttml/ttml.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/codec/ttml/ttml.h b/modules/codec/ttml/ttml.h
index 8978ff660b..07b6117ad6 100644
--- a/modules/codec/ttml/ttml.h
+++ b/modules/codec/ttml/ttml.h
@@ -129,10 +129,11 @@ static inline mtime_t tt_time_Convert( const tt_time_t *t )
 
 static inline int tt_time_Compare( const tt_time_t *t1, const tt_time_t *t2 )
 {
-    if( tt_time_Convert( t1 ) < tt_time_Convert( t2 ) )
+    mtime_t ttt1 = tt_time_Convert( t1 );
+    mtime_t ttt2 = tt_time_Convert( t2 );
+    if (ttt1 < ttt2)
         return -1;
-    else
-        return ( tt_time_Convert( t1 ) > tt_time_Convert( t2 ) );
+    return ttt1 > ttt2;
 }
 
 static inline tt_time_t tt_time_Add( tt_time_t t1, tt_time_t t2 )



More information about the vlc-commits mailing list