[vlc-commits] Vobsub: cosmetics and warnings fixes

Jean-Baptiste Kempf git at videolan.org
Fri Aug 12 23:20:06 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Aug 12 23:19:01 2011 +0200| [2b4b4a32cdf866b6068be54bbe701ad02cc9cdc9] | committer: Jean-Baptiste Kempf

Vobsub: cosmetics and warnings fixes

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

 modules/demux/ps.h     |    6 ++--
 modules/demux/vobsub.c |   65 +++++++++++++++++++++--------------------------
 2 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/modules/demux/ps.h b/modules/demux/ps.h
index 23bcead..674c365 100644
--- a/modules/demux/ps.h
+++ b/modules/demux/ps.h
@@ -577,7 +577,7 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
 {
     int i_buffer = p_pkt->i_buffer;
     uint8_t *p_buffer = p_pkt->p_buffer;
-    int i_length, i_version, i_info_length, i_esm_length, i_es_base;
+    int i_length, i_version, i_info_length, i_es_base;
 
     if( !p_psm || p_buffer[3] != 0xbc ) return VLC_EGENERIC;
 
@@ -595,8 +595,8 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
     if( i_info_length + 10 > i_length ) return VLC_EGENERIC;
 
     /* Elementary stream map */
-    i_esm_length = (uint16_t)(p_buffer[ 10 + i_info_length ] << 8) +
-        p_buffer[ 11 + i_info_length];
+    /* int i_esm_length = (uint16_t)(p_buffer[ 10 + i_info_length ] << 8) +
+        p_buffer[ 11 + i_info_length]; */
     i_es_base = 12 + i_info_length;
 
     while( i_es_base + 4 < i_length )
diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index d39d685..86423ad 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -25,23 +25,20 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-
-#include <sys/types.h>
 #include <limits.h>
 
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_demux.h>
 
 #include "ps.h"
 #include "vobsub.h"
 
-#define MAX_LINE 8192
-
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -69,8 +66,6 @@ typedef struct
     int     i_line;
     char    **line;
 } text_t;
-static int  TextLoad( text_t *, stream_t *s );
-static void TextUnload( text_t * );
 
 typedef struct
 {
@@ -93,25 +88,28 @@ typedef struct
 
 struct demux_sys_t
 {
-    int64_t     i_next_demux_date;
-    int64_t     i_length;
+    int64_t        i_next_demux_date;
+    int64_t        i_length;
 
-    text_t      txt;
-    stream_t    *p_vobsub_stream;
+    text_t         txt;
+    stream_t       *p_vobsub_stream;
 
     /* all tracks */
     int            i_tracks;
     vobsub_track_t *track;
 
-    int         i_original_frame_width;
-    int         i_original_frame_height;
-    bool  b_palette;
-    uint32_t    palette[16];
+    int            i_original_frame_width;
+    int            i_original_frame_height;
+    bool           b_palette;
+    uint32_t       palette[16];
 };
 
+
 static int Demux( demux_t * );
 static int Control( demux_t *, int, va_list );
 
+static int  TextLoad( text_t *, stream_t *s );
+static void TextUnload( text_t * );
 static int ParseVobSubIDX( demux_t * );
 static int DemuxVobSub( demux_t *, block_t *);
 
@@ -138,7 +136,6 @@ static int Open ( vlc_object_t *p_this )
             return VLC_EGENERIC;
         }
         free( s );
-
     }
     else
     {
@@ -146,11 +143,11 @@ static int Open ( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
+    /* */
     p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
     if( unlikely( !p_sys ) )
         return VLC_ENOMEM;
+
     p_sys->i_length = 0;
     p_sys->p_vobsub_stream = NULL;
     p_sys->i_tracks = 0;
@@ -174,8 +171,7 @@ static int Open ( vlc_object_t *p_this )
     /* Find the total length of the vobsubs */
     if( p_sys->i_tracks > 0 )
     {
-        int i;
-        for( i = 0; i < p_sys->i_tracks; i++ )
+        for( int i = 0; i < p_sys->i_tracks; i++ )
         {
             if( p_sys->track[i].i_subtitles > 1 )
             {
@@ -185,8 +181,7 @@ static int Open ( vlc_object_t *p_this )
         }
     }
 
-    if( asprintf( &psz_vobname, "%s://%s", p_demux->psz_access,
-                  p_demux->psz_location ) == -1 )
+    if( asprintf( &psz_vobname, "%s://%s", p_demux->psz_access, p_demux->psz_location ) == -1 )
         goto error;
 
     i_len = strlen( psz_vobname );
@@ -203,6 +198,9 @@ static int Open ( vlc_object_t *p_this )
     }
     free( psz_vobname );
 
+    p_demux->pf_demux = Demux;
+    p_demux->pf_control = Control;
+
     return VLC_SUCCESS;
 
 error:
@@ -220,19 +218,16 @@ error:
  *****************************************************************************/
 static void Close( vlc_object_t *p_this )
 {
-    int i;
     demux_t *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    /* Clean all subs from all tracks */
-    for( i = 0; i < p_sys->i_tracks; i++ )
-        free( p_sys->track[i].p_subtitles );
-
-    free( p_sys->track );
-
     if( p_sys->p_vobsub_stream )
         stream_Delete( p_sys->p_vobsub_stream );
 
+    /* Clean all subs from all tracks */
+    for( int i = 0; i < p_sys->i_tracks; i++ )
+        free( p_sys->track[i].p_subtitles );
+    free( p_sys->track );
     free( p_sys );
 }
 
@@ -354,9 +349,9 @@ static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
     int64_t i_maxdate;
-    int i, i_read;
+    int i_read;
 
-    for( i = 0; i < p_sys->i_tracks; i++ )
+    for( int i = 0; i < p_sys->i_tracks; i++ )
     {
 #define tk p_sys->track[i]
         if( tk.i_current_subtitle >= tk.i_subtitles )
@@ -459,12 +454,10 @@ static int TextLoad( text_t *txt, stream_t *s )
 
 static void TextUnload( text_t *txt )
 {
-    int i;
-
-    for( i = 0; i < txt->i_line_count; i++ )
+    for( int i = 0; i < txt->i_line_count; i++ )
         free( txt->line[i] );
-
     free( txt->line );
+
     txt->i_line       = 0;
     txt->i_line_count = 0;
 }



More information about the vlc-commits mailing list