[vlc-commits] Ogg: use calloc

Jean-Baptiste Kempf git at videolan.org
Mon Jan 14 11:28:44 CET 2013


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jan 14 11:28:00 2013 +0100| [988a7f86848b1ffa19eff39287ad0bfefacd5809] | committer: Jean-Baptiste Kempf

Ogg: use calloc

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

 modules/demux/ogg.c     |   22 ++++++----------------
 modules/demux/ogg.h     |    2 +-
 modules/demux/oggseek.h |    7 ++-----
 3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index c26fbd9..ec807dc 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -156,7 +156,6 @@ static int Open( vlc_object_t * p_this )
     demux_sys_t    *p_sys;
     const uint8_t  *p_peek;
 
-
     /* Check if we are dealing with an ogg stream */
     if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
     if( !p_demux->b_force && memcmp( p_peek, "OggS", 4 ) )
@@ -164,30 +163,21 @@ static int Open( vlc_object_t * p_this )
         return VLC_EGENERIC;
     }
 
-    /* Set exported functions */
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
+    /* */
+    p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
     if( !p_sys )
         return VLC_ENOMEM;
 
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
-    p_sys->i_bitrate = 0;
-    p_sys->pp_stream = NULL;
-    p_sys->p_old_stream = NULL;
-
-    /* Begnning of stream, tell the demux to look for elementary streams. */
-    p_sys->i_bos = 0;
-    p_sys->i_eos = 0;
-
     p_sys->i_length = -1;
 
+    /* Set exported functions */
+    p_demux->pf_demux = Demux;
+    p_demux->pf_control = Control;
+
     /* Initialize the Ogg physical bitstream parser */
     ogg_sync_init( &p_sys->oy );
-    p_sys->b_page_waiting = false;
 
     /* */
-    p_sys->p_meta = NULL;
     TAB_INIT( p_sys->i_seekpoints, p_sys->pp_seekpoints );
 
     return VLC_SUCCESS;
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index faff86a..a77809e 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -110,7 +110,7 @@ struct demux_sys_t
     mtime_t i_pcr;
 
     /* stream state */
-    int     i_bos;
+    int     i_bos; /* Begnning of stream, tell the demux to look for elementary streams. */
     int     i_eos;
 
     /* bitrate */
diff --git a/modules/demux/oggseek.h b/modules/demux/oggseek.h
index 800d7e9..88d22fa 100644
--- a/modules/demux/oggseek.h
+++ b/modules/demux/oggseek.h
@@ -49,11 +49,8 @@ struct oggseek_index_entry
     int64_t i_pagepos_end;
 };
 
-
-
-
-const demux_index_entry_t *oggseek_theora_index_entry_add ( logical_stream_t *, 
-                                                            int64_t i_granule, 
+const demux_index_entry_t *oggseek_theora_index_entry_add ( logical_stream_t *,
+                                                            int64_t i_granule,
                                                             int64_t i_pagepos );
 
 void oggseek_index_entries_free ( demux_index_entry_t * );



More information about the vlc-commits mailing list