[vlc-commits] luahttp, equalizer: Fix warnings

Akash Mehrotra git at videolan.org
Wed Aug 31 01:27:04 CEST 2011


vlc | branch: master | Akash Mehrotra <mehrotra.akash at gmail.com> | Tue Aug 30 23:35:38 2011 +0530| [a4c19fb276bd818ba82fa159ba7affd5e40c1b34] | committer: Jean-Baptiste Kempf

luahttp, equalizer: Fix warnings

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/lua/libs/equalizer.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/lua/libs/equalizer.c b/modules/lua/libs/equalizer.c
index f365a8e..5a5eabd 100644
--- a/modules/lua/libs/equalizer.c
+++ b/modules/lua/libs/equalizer.c
@@ -171,15 +171,17 @@ static int vlclua_equalizer_get( lua_State *L )
     {
         level = strtof( psz_bands, &psz_bands);
         bands--;
-        asprintf( &str , "%f" , level );
+        if( asprintf( &str , "%f" , level ) == -1 )
+            return 0;
         lua_pushstring( L, str );
         free(str);
-        asprintf( &str , "band_%d", i++ );
+        if( asprintf( &str , "band_%d", i++ ) == -1 )
+            return 0;
         lua_setfield( L , -2 , str );
         free( str );
     }
     free( psz_bands_origin );
-    if (loc != (locale_t)0)
+    if( loc != (locale_t)0 )
     {
         uselocale (oldloc);
         freelocale (loc);
@@ -195,7 +197,7 @@ static int vlclua_equalizer_get( lua_State *L )
 static int vlclua_equalizer_set( lua_State *L )
 {
     int bandid = luaL_checknumber( L, 1 );
-    if ( bandid < 0 || bandid > 9)
+    if( bandid < 0 || bandid > 9)
         return 0;
     input_thread_t *p_input = vlclua_get_input_internal( L );
     if( !p_input )
@@ -252,12 +254,12 @@ static int vlclua_equalizer_setpreset( lua_State *L )
     {
         audio_output_t *p_aout = input_GetAout( p_input );
         vlc_object_release( p_input );
-        if ( !p_aout )
+        if( !p_aout )
         {
             return 0;
         }
         char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
-        if ( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
+        if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
         {
             vlc_object_release( p_aout );
             return 0;
@@ -267,7 +269,7 @@ static int vlclua_equalizer_setpreset( lua_State *L )
             return 0;
         for ( int i = 1 ; i < 10 ; i++ )
         {
-            if ( asprintf( &newstr, "%s%6.1f",newstr ,eqz_preset_10b[presetid].f_amp[i]) == -1 )
+            if( asprintf( &newstr, "%s%6.1f",newstr ,eqz_preset_10b[presetid].f_amp[i]) == -1 )
                 return 0;
         }
         var_SetString( p_aout, "equalizer-bands",newstr );
@@ -300,7 +302,8 @@ static int vlclua_equalizer_get_presets( lua_State *L )
     for( int i = 0 ; i < NB_PRESETS ; i++ )
     {
         lua_pushstring( L, preset_list_text[i] );
-        asprintf( &str , "id_%d",i );
+        if( asprintf( &str , "id_%d",i ) == -1 )
+            return 0;
         lua_setfield( L , -2 , str );
         free(str);
     }



More information about the vlc-commits mailing list