]> git.sesse.net Git - vlc/commitdiff
Don't rely on scanf when parsing floats from files
authorRémi Denis-Courmont <rem@videolan.org>
Wed, 21 May 2008 19:07:22 +0000 (22:07 +0300)
committerRémi Denis-Courmont <rem@videolan.org>
Wed, 21 May 2008 19:12:24 +0000 (22:12 +0300)
(well, you _can_ but you'd need to use uselocale() then)

modules/demux/subtitle.c

index f65575f31fb0f49536266637a676f187d87dd2f4..d1e142f688d48f1a5a1ba4569793ba8533fc9436 100644 (file)
@@ -1468,8 +1468,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
             free( psz_temp );
         }
         /* Data Lines */
-        if( sscanf (s, "%f %f", &f1, &f2 ) == 2 )
+        f1 = us_strtod( s, &psz_temp );
+        if( *psz_temp )
         {
+            f2 = us_strtod( psz_temp, NULL );
             mpsub_total += f1 * mpsub_factor;
             p_subtitle->i_start = (int64_t)(10000.0 * mpsub_total);
             mpsub_total += f2 * mpsub_factor;