]> git.sesse.net Git - vlc/blobdiff - modules/demux/subtitle.c
Trailing ;
[vlc] / modules / demux / subtitle.c
index bd89fbae5818b2a5088e8b47d8c4ea138e65e5ac..1c4502552fc5b194ea51e0f34c67d2530e73115e 100644 (file)
@@ -70,25 +70,25 @@ static const char *const ppsz_sub_type[] =
     "subviewer1"
 };
 
-vlc_module_begin();
-    set_shortname( N_("Subtitles"));
-    set_description( N_("Text subtitles parser") );
-    set_capability( "demux", 0 );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_DEMUX );
+vlc_module_begin ()
+    set_shortname( N_("Subtitles"))
+    set_description( N_("Text subtitles parser") )
+    set_capability( "demux", 0 )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_DEMUX )
     add_float( "sub-fps", 0.0, NULL,
                N_("Frames per second"),
-               SUB_FPS_LONGTEXT, true );
+               SUB_FPS_LONGTEXT, true )
     add_integer( "sub-delay", 0, NULL,
                N_("Subtitles delay"),
-               SUB_DELAY_LONGTEXT, true );
+               SUB_DELAY_LONGTEXT, true )
     add_string( "sub-type", "auto", NULL, N_("Subtitles format"),
-                SUB_TYPE_LONGTEXT, true );
+                SUB_TYPE_LONGTEXT, true )
         change_string_list( ppsz_sub_type, NULL, NULL );
-    set_callbacks( Open, Close );
+    set_callbacks( Open, Close )
 
-    add_shortcut( "subtitle" );
-vlc_module_end();
+    add_shortcut( "subtitle" )
+vlc_module_end ()
 
 /*****************************************************************************
  * Prototypes:
@@ -442,7 +442,7 @@ static int Open ( vlc_object_t *p_this )
     /* Quit on unknown subtitles */
     if( p_sys->i_type == SUB_TYPE_UNKNOWN )
     {
-        msg_Err( p_demux, "failed to recognize subtitle type" );
+        msg_Warn( p_demux, "failed to recognize subtitle type" );
         free( p_sys );
         return VLC_EGENERIC;
     }
@@ -956,7 +956,7 @@ static int  ParseSubViewer( demux_t *p_demux, subtitle_t *p_subtitle,
 
     return ParseSubRipSubViewer( p_demux, p_subtitle,
                                  "%d:%d:%d.%d,%d:%d:%d.%d",
-                                 true );
+                                 true )
 }
 
 /* ParseSSA
@@ -1846,7 +1846,6 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
     demux_sys_t *p_sys = p_demux->p_sys;
     text_t      *txt = &p_sys->txt;
     char *psz_text = NULL;
-    char psz_end[12]= "", psz_begin[12] = "";
 
     for( ;; )
     {
@@ -1867,13 +1866,14 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
         char *psz_temp = strcasestr( s, "<time");
         if( psz_temp != NULL )
         {
+            char psz_end[12], psz_begin[12];
             /* Line has begin and end */
             if( ( sscanf( psz_temp,
-                  "<%*[t|T]ime %*[b|B]egin=\"%[^\"]\" %*[e|E]nd=\"%[^\"]%*[^>]%[^\n\r]",
+                  "<%*[t|T]ime %*[b|B]egin=\"%11[^\"]\" %*[e|E]nd=\"%11[^\"]%*[^>]%[^\n\r]",
                             psz_begin, psz_end, psz_text) != 3 ) &&
                     /* Line has begin and no end */
                     ( sscanf( psz_temp,
-                              "<%*[t|T]ime %*[b|B]egin=\"%[^\"]\"%*[^>]%[^\n\r]",
+                              "<%*[t|T]ime %*[b|B]egin=\"%11[^\"]\"%*[^>]%[^\n\r]",
                               psz_begin, psz_text ) != 2) )
                 /* Line is not recognized */
             {
@@ -2024,7 +2024,10 @@ static int ParseSubViewer1( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx
 
             s = TextGetLine( txt );
             if( !s )
+            {
+                free( psz_text );
                 return VLC_EGENERIC;
+            }
 
             if( sscanf( s, "[%d:%d:%d]", &h2, &m2, &s2 ) == 3 )
                 p_subtitle->i_stop  = ( (int64_t)h2 * 3600*1000 +