[vlc-commits] Wav: cosmetics (alignment, unlikely, locality)

Jean-Baptiste Kempf git at videolan.org
Thu Apr 5 12:17:44 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Apr  5 11:17:26 2012 +0200| [98be9ffa8924c8b345da75bd310e497ea88131ff] | committer: Jean-Baptiste Kempf

Wav: cosmetics (alignment, unlikely, locality)

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

 modules/demux/wav.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index 18e65b2..6909744 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -100,9 +100,9 @@ static int Open( vlc_object_t * p_this )
     demux_sys_t *p_sys;
 
     const uint8_t *p_peek;
-    unsigned int i_size;
-    unsigned int i_extended;
-    const char        *psz_name;
+    unsigned int   i_size;
+    unsigned int   i_extended;
+    const char    *psz_name;
 
     WAVEFORMATEXTENSIBLE *p_wf_ext = NULL;
     WAVEFORMATEX         *p_wf = NULL;
@@ -116,13 +116,13 @@ 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( *p_sys ) );
-    if( p_sys == NULL )
+    p_demux->pf_demux     = Demux;
+    p_demux->pf_control   = Control;
+    p_demux->p_sys        = p_sys = malloc( sizeof( *p_sys ) );
+    if( unlikely(!p_sys) )
         return VLC_ENOMEM;
 
-    p_sys->p_es         = NULL;
+    p_sys->p_es           = NULL;
     p_sys->b_chan_reorder = false;
     p_sys->i_channel_mask = 0;
 
@@ -148,12 +148,12 @@ static int Open( vlc_object_t * p_this )
 
     /* load waveformatex */
     p_wf_ext = malloc( i_size );
-    if( p_wf_ext == NULL )
+    if( unlikely( !p_wf_ext ) )
          goto error;
 
-    p_wf = &p_wf_ext->Format;
+    p_wf         = &p_wf_ext->Format;
     p_wf->cbSize = 0;
-    i_size -= 2;
+    i_size      -= 2;
     if( stream_Read( p_demux->s, p_wf, i_size ) != (int)i_size ||
         ( ( i_size & 1 ) && stream_Read( p_demux->s, NULL, 1 ) != 1 ) )
     {
@@ -164,10 +164,10 @@ static int Open( vlc_object_t * p_this )
     es_format_Init( &p_sys->fmt, AUDIO_ES, 0 );
     wf_tag_to_fourcc( GetWLE( &p_wf->wFormatTag ), &p_sys->fmt.i_codec,
                       &psz_name );
-    p_sys->fmt.audio.i_channels = GetWLE ( &p_wf->nChannels );
-    p_sys->fmt.audio.i_rate = GetDWLE( &p_wf->nSamplesPerSec );
-    p_sys->fmt.audio.i_blockalign = GetWLE( &p_wf->nBlockAlign );
-    p_sys->fmt.i_bitrate = GetDWLE( &p_wf->nAvgBytesPerSec ) * 8;
+    p_sys->fmt.audio.i_channels      = GetWLE ( &p_wf->nChannels );
+    p_sys->fmt.audio.i_rate          = GetDWLE( &p_wf->nSamplesPerSec );
+    p_sys->fmt.audio.i_blockalign    = GetWLE( &p_wf->nBlockAlign );
+    p_sys->fmt.i_bitrate             = GetDWLE( &p_wf->nAvgBytesPerSec ) * 8;
     p_sys->fmt.audio.i_bitspersample = GetWLE( &p_wf->wBitsPerSample );
     if( i_size >= sizeof(WAVEFORMATEX) )
         p_sys->fmt.i_extra = __MIN( GetWLE( &p_wf->cbSize ), i_size - sizeof(WAVEFORMATEX) );
@@ -181,7 +181,7 @@ static int Open( vlc_object_t * p_this )
         ( p_sys->fmt.i_extra + sizeof( WAVEFORMATEX )
             >= sizeof( WAVEFORMATEXTENSIBLE ) ) )
     {
-        unsigned i, i_channel_mask;
+        unsigned i_channel_mask;
         GUID guid_subformat;
 
         guid_subformat = p_wf_ext->SubFormat;
@@ -198,7 +198,7 @@ static int Open( vlc_object_t * p_this )
         if( i_channel_mask )
         {
             int i_match = 0;
-            for( i = 0; i < sizeof(pi_channels_src)/sizeof(*pi_channels_src); i++ )
+            for( unsigned i = 0; i < sizeof(pi_channels_src)/sizeof(*pi_channels_src); i++ )
             {
                 if( i_channel_mask & pi_channels_src[i] )
                 {
@@ -286,7 +286,7 @@ static int Open( vlc_object_t * p_this )
     if( p_sys->fmt.i_extra > 0 )
     {
         p_sys->fmt.p_extra = malloc( p_sys->fmt.i_extra );
-        if( !p_sys->fmt.p_extra )
+        if( unlikely(!p_sys->fmt.p_extra) )
         {
             p_sys->fmt.i_extra = 0;
             goto error;
@@ -444,7 +444,7 @@ static int Demux( demux_t *p_demux )
 static void Close ( vlc_object_t * p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
-    demux_sys_t *p_sys  = p_demux->p_sys;
+    demux_sys_t *p_sys   = p_demux->p_sys;
 
     free( p_sys );
 }



More information about the vlc-commits mailing list