[vlc-commits] ttml demux: Refactor a loop to be able to continue in case of error

Hugo Beauzée-Luyssen git at videolan.org
Wed Sep 14 18:39:46 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Sep 14 16:05:43 2016 +0200| [4ed089f86330c63c348f6e928ce2ab5d86703e95] | committer: Hugo Beauzée-Luyssen

ttml demux: Refactor a loop to be able to continue in case of error

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

 modules/demux/ttml.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index f5d07ba..c4c8708 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -422,13 +422,14 @@ static int ParseTimeOnSpan( demux_sys_t* p_sys, char* psz_text )
     int i_nb_span = 0;
     int ret = VLC_ENOMEM;
 
-    int i_type = xml_ReaderNextNode( p_reader, &psz_node_name );
     /*
     * This loop will parse the current p tag and the
     * spans inside, and will store every span text and times
     * inside a subtitle_t structure.
     */
-    do
+    for( int i_type = XML_READER_STARTELEM;
+         i_type != XML_READER_ENDELEM || CompareTagName( psz_node_name, "p" );
+         i_type = xml_ReaderNextNode( p_reader, &psz_node_name ) )
     {
         if( i_type == XML_READER_STARTELEM && !strcasecmp( psz_node_name, "metadata" ) )
         {
@@ -487,9 +488,7 @@ static int ParseTimeOnSpan( demux_sys_t* p_sys, char* psz_text )
 
             pp_subtitles = pp_tmp;
         }
-        i_type = xml_ReaderNextNode( p_reader, &psz_node_name );
-
-    } while( i_type != XML_READER_ENDELEM || CompareTagName( psz_node_name, "p" ) );
+    }
 
     /*
     * To split the timeline of the current subtitle, we take every



More information about the vlc-commits mailing list