Commit a4c19fb2 authored by Akash Mehrotra's avatar Akash Mehrotra Committed by Jean-Baptiste Kempf

luahttp, equalizer: Fix warnings

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent ee1e329e
...@@ -171,15 +171,17 @@ static int vlclua_equalizer_get( lua_State *L ) ...@@ -171,15 +171,17 @@ static int vlclua_equalizer_get( lua_State *L )
{ {
level = strtof( psz_bands, &psz_bands); level = strtof( psz_bands, &psz_bands);
bands--; bands--;
asprintf( &str , "%f" , level ); if( asprintf( &str , "%f" , level ) == -1 )
return 0;
lua_pushstring( L, str ); lua_pushstring( L, str );
free(str); free(str);
asprintf( &str , "band_%d", i++ ); if( asprintf( &str , "band_%d", i++ ) == -1 )
return 0;
lua_setfield( L , -2 , str ); lua_setfield( L , -2 , str );
free( str ); free( str );
} }
free( psz_bands_origin ); free( psz_bands_origin );
if (loc != (locale_t)0) if( loc != (locale_t)0 )
{ {
uselocale (oldloc); uselocale (oldloc);
freelocale (loc); freelocale (loc);
...@@ -195,7 +197,7 @@ static int vlclua_equalizer_get( lua_State *L ) ...@@ -195,7 +197,7 @@ static int vlclua_equalizer_get( lua_State *L )
static int vlclua_equalizer_set( lua_State *L ) static int vlclua_equalizer_set( lua_State *L )
{ {
int bandid = luaL_checknumber( L, 1 ); int bandid = luaL_checknumber( L, 1 );
if ( bandid < 0 || bandid > 9) if( bandid < 0 || bandid > 9)
return 0; return 0;
input_thread_t *p_input = vlclua_get_input_internal( L ); input_thread_t *p_input = vlclua_get_input_internal( L );
if( !p_input ) if( !p_input )
...@@ -252,12 +254,12 @@ static int vlclua_equalizer_setpreset( lua_State *L ) ...@@ -252,12 +254,12 @@ static int vlclua_equalizer_setpreset( lua_State *L )
{ {
audio_output_t *p_aout = input_GetAout( p_input ); audio_output_t *p_aout = input_GetAout( p_input );
vlc_object_release( p_input ); vlc_object_release( p_input );
if ( !p_aout ) if( !p_aout )
{ {
return 0; return 0;
} }
char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" ); 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 ); vlc_object_release( p_aout );
return 0; return 0;
...@@ -267,7 +269,7 @@ static int vlclua_equalizer_setpreset( lua_State *L ) ...@@ -267,7 +269,7 @@ static int vlclua_equalizer_setpreset( lua_State *L )
return 0; return 0;
for ( int i = 1 ; i < 10 ; i++ ) 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; return 0;
} }
var_SetString( p_aout, "equalizer-bands",newstr ); var_SetString( p_aout, "equalizer-bands",newstr );
...@@ -300,7 +302,8 @@ static int vlclua_equalizer_get_presets( lua_State *L ) ...@@ -300,7 +302,8 @@ static int vlclua_equalizer_get_presets( lua_State *L )
for( int i = 0 ; i < NB_PRESETS ; i++ ) for( int i = 0 ; i < NB_PRESETS ; i++ )
{ {
lua_pushstring( L, preset_list_text[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 ); lua_setfield( L , -2 , str );
free(str); free(str);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment