Commit 54bcbe13 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use var_GetNonEmptyString were applicable

parent 00aa3ff1
...@@ -53,7 +53,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf, ...@@ -53,7 +53,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf,
if( p_object == NULL ) if( p_object == NULL )
return; return;
psz_string = var_GetString( p_object, "audio-filter" ); psz_string = var_GetNonEmptyString( p_object, "audio-filter" );
if( !psz_string ) psz_string = strdup( "" ); if( !psz_string ) psz_string = strdup( "" );
...@@ -117,7 +117,7 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf, ...@@ -117,7 +117,7 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf,
if( p_object == NULL ) if( p_object == NULL )
return VLC_FALSE; return VLC_FALSE;
psz_string = var_GetString( p_object, "audio-filter" ); psz_string = var_GetNonEmptyString( p_object, "audio-filter" );
vlc_object_release( p_object ); vlc_object_release( p_object );
...@@ -192,9 +192,9 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf, ...@@ -192,9 +192,9 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf,
VLC_VAR_DOINHERIT ); VLC_VAR_DOINHERIT );
f_preamp = var_GetFloat( p_object, "equalizer-preamp" ); f_preamp = var_GetFloat( p_object, "equalizer-preamp" );
psz_bands = var_GetString( p_object, "equalizer-bands" ); psz_bands = var_GetNonEmptyString( p_object, "equalizer-bands" );
if( !strcmp( psz_bands, "" ) ) if( psz_bands == NULL )
psz_bands = strdup( "0 0 0 0 0 0 0 0 0 0" ); psz_bands = strdup( "0 0 0 0 0 0 0 0 0 0" );
b_2p = var_GetBool( p_object, "equalizer-2pass" ); b_2p = var_GetBool( p_object, "equalizer-2pass" );
...@@ -404,12 +404,13 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf, ...@@ -404,12 +404,13 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf,
var_Create( p_object, "equalizer-preset", VLC_VAR_STRING | var_Create( p_object, "equalizer-preset", VLC_VAR_STRING |
VLC_VAR_DOINHERIT ); VLC_VAR_DOINHERIT );
psz_preset = var_GetString( p_object, "equalizer-preset" ); psz_preset = var_GetNonEmptyString( p_object, "equalizer-preset" );
for( i = 0 ; i < 18 ; i++ ) for( i = 0 ; (psz_preset != NULL) && (i < 18) ; i++ )
{
if( !strcmp( preset_list[i], psz_preset ) )
{ {
if( strcmp( preset_list[i], psz_preset ) )
continue;
[o_popup_presets selectItemAtIndex: i]; [o_popup_presets selectItemAtIndex: i];
[o_slider_preamp setFloatValue: eqz_preset_10b[i]->f_preamp]; [o_slider_preamp setFloatValue: eqz_preset_10b[i]->f_preamp];
...@@ -431,9 +432,9 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf, ...@@ -431,9 +432,9 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf,
if( strcmp( psz_preset, "flat" ) ) if( strcmp( psz_preset, "flat" ) )
{ {
char psz_bands[100]; char psz_bands[100];
memset( psz_bands, 0, 100 );
sprintf( psz_bands, "%.1f %.1f %.1f %.1f %.1f %.1f %.1f " snprintf( psz_bands, sizeof( psz_bands ),
"%.1f %.1f %.1f %.1f %.1f %.1f %.1f "
"%.1f %.1f %.1f", "%.1f %.1f %.1f",
eqz_preset_10b[i]->f_amp[0], eqz_preset_10b[i]->f_amp[0],
eqz_preset_10b[i]->f_amp[1], eqz_preset_10b[i]->f_amp[1],
...@@ -455,7 +456,6 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf, ...@@ -455,7 +456,6 @@ static vlc_bool_t GetFiltersStatus( intf_thread_t *p_intf,
var_SetString( p_object, "equalizer-bands", psz_bands ); var_SetString( p_object, "equalizer-bands", psz_bands );
} }
} }
}
free( psz_preset ); free( psz_preset );
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
......
...@@ -544,10 +544,10 @@ wxPanel *ExtraPanel::EqzPanel( wxWindow *parent ) ...@@ -544,10 +544,10 @@ wxPanel *ExtraPanel::EqzPanel( wxWindow *parent )
aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find(p_intf, aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find(p_intf,
VLC_OBJECT_AOUT, FIND_ANYWHERE); VLC_OBJECT_AOUT, FIND_ANYWHERE);
char *psz_af = NULL; char *psz_af;
if( p_aout ) if( p_aout )
{ {
psz_af = var_GetString( p_aout, "audio-filter" ); psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
if( var_GetBool( p_aout, "equalizer-2pass" ) ) if( var_GetBool( p_aout, "equalizer-2pass" ) )
eq_2p_chkbox->SetValue( true ); eq_2p_chkbox->SetValue( true );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
...@@ -558,7 +558,7 @@ wxPanel *ExtraPanel::EqzPanel( wxWindow *parent ) ...@@ -558,7 +558,7 @@ wxPanel *ExtraPanel::EqzPanel( wxWindow *parent )
if( config_GetInt( p_intf, "equalizer-2pass" ) ) if( config_GetInt( p_intf, "equalizer-2pass" ) )
eq_2p_chkbox->SetValue( true ); eq_2p_chkbox->SetValue( true );
} }
if( psz_af != NULL ? strstr( psz_af, "equalizer" ) != NULL : VLC_FALSE ) if( psz_af != NULL && strstr( psz_af, "equalizer" ) )
{ {
eq_chkbox->SetValue( true ); eq_chkbox->SetValue( true );
} else { } else {
...@@ -1114,7 +1114,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf, ...@@ -1114,7 +1114,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf,
if( p_aout ) if( p_aout )
{ {
psz_string = var_GetString( p_aout, "audio-filter" ); psz_string = var_GetNonEmptyString( p_aout, "audio-filter" );
} }
else else
{ {
......
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