[vlc-commits] demux: subtitle: fix sami constness

Francois Cartegnie git at videolan.org
Mon Sep 11 10:51:41 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 11 00:00:20 2017 +0200| [3ae569f116c0148eb51acf7d28950453203ff4a8] | committer: Francois Cartegnie

demux: subtitle: fix sami constness

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

 modules/demux/subtitle.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index fbd6ef4b6d..72d0fe1027 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1373,22 +1373,22 @@ static int ParseVplayer( vlc_object_t *p_obj, subs_properties_t *p_props,
 
 /* ParseSami
  */
-static char *ParseSamiSearch( text_t *txt,
-                              char *psz_start, const char *psz_str )
+static const char *ParseSamiSearch( text_t *txt,
+                                    const char *psz_start, const char *psz_str )
 {
     if( psz_start && strcasestr( psz_start, psz_str ) )
     {
-        char *s = strcasestr( psz_start, psz_str );
+        const char *s = strcasestr( psz_start, psz_str );
         return &s[strlen( psz_str )];
     }
 
     for( ;; )
     {
-        char *p = TextGetLine( txt );
+        const char *p = TextGetLine( txt );
         if( !p )
             return NULL;
 
-        char *s = strcasestr( p, psz_str );
+        const char *s = strcasestr( p, psz_str );
         if( s != NULL )
             return &s[strlen( psz_str )];
     }
@@ -1399,7 +1399,7 @@ static int ParseSami( vlc_object_t *p_obj, subs_properties_t *p_props,
     VLC_UNUSED(p_obj);
     VLC_UNUSED(p_props);
     VLC_UNUSED( i_idx );
-    char *s;
+    const char *s;
     int64_t i_start;
 
     unsigned int i_text;
@@ -1410,7 +1410,9 @@ static int ParseSami( vlc_object_t *p_obj, subs_properties_t *p_props,
         return VLC_EGENERIC;
 
     /* get start value */
-    i_start = strtol( s, &s, 0 );
+    char *psz_end;
+    i_start = strtol( s, &psz_end, 0 );
+    s = psz_end;
 
     /* search <P */
     if( !( s = ParseSamiSearch( txt, s, "<P" ) ) )



More information about the vlc-commits mailing list