[vlc-commits] demux/ttml: Convert_time: refactor redundant call to sscanf

Filip Roséen git at videolan.org
Wed Jul 27 11:35:18 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Jul 27 07:42:03 2016 +0200| [03ea0eb50fa808d37104ec559d6fb8d3aad5796e] | committer: Hugo Beauzée-Luyssen

demux/ttml: Convert_time: refactor redundant call to sscanf

Given that the only difference between "%d:%d:%d,%d" and "%d:%d:%d.%d"
is the delimiter used between s1 and d1, a common format has replaced
the two that will accept both.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/demux/ttml.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index c6e0616..0113923 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -165,8 +165,7 @@ static int Convert_time( int64_t *timing_value, const char *s )
     int d1 = 0;
 
     if ( sscanf( s, "%d.%ds", &s1, &d1) == 2 ||
-         sscanf( s, "%d:%d:%d,%d", &h1, &m1, &s1, &d1 ) == 4 ||
-         sscanf( s, "%d:%d:%d.%d", &h1, &m1, &s1, &d1 ) == 4 ||
+         sscanf( s, "%d:%d:%d%*[,.]%d", &h1, &m1, &s1, &d1 ) == 4 ||
          sscanf( s, "%d:%d:%d", &h1, &m1, &s1) == 3 )
     {
         (*timing_value) = ( (int64_t)h1 * 3600 * 1000 +



More information about the vlc-commits mailing list