Commit 2064a856 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman Committed by Jean-Baptiste Kempf

macosx intf: Avoid using fixed sized buffer here.

(cherry picked from commit ca17039c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent fe06aba7
...@@ -240,23 +240,20 @@ static bool GetFiltersStatus( intf_thread_t *p_intf, ...@@ -240,23 +240,20 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
if( p_object == NULL ) if( p_object == NULL )
p_object = (vlc_object_t *)pl_Hold( p_intf ); p_object = (vlc_object_t *)pl_Hold( p_intf );
char psz_values[102]; NSString *preset;
memset( psz_values, 0, 102 ); const char *psz_values;
preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band1 floatValue] ];
/* Write the new bands values */ preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band2 floatValue] ];
/* TODO: write a generic code instead of ten times the same thing */ preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band3 floatValue] ];
preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band4 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band1 floatValue] ); preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band5 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band2 floatValue] ); preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band6 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band3 floatValue] ); preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band7 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band4 floatValue] ); preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band8 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band5 floatValue] ); preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band9 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band6 floatValue] ); preset = [NSString stringWithFormat:@"%@ %.1f", preset, [o_slider_band10 floatValue] ];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band7 floatValue] );
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band8 floatValue] ); psz_values = [preset UTF8String];
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band9 floatValue] );
sprintf( psz_values, "%s %.1f", psz_values, [o_slider_band10 floatValue] );
var_SetString( p_object, "equalizer-bands", psz_values ); var_SetString( p_object, "equalizer-bands", psz_values );
if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES ) if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES )
...@@ -280,13 +277,15 @@ static bool GetFiltersStatus( intf_thread_t *p_intf, ...@@ -280,13 +277,15 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
if( p_object == NULL ) if( p_object == NULL )
p_object = (vlc_object_t *)pl_Hold( p_intf ); p_object = (vlc_object_t *)pl_Hold( p_intf );
char psz_values[102];
memset( psz_values, 0, 102 );
var_SetString( p_object , "equalizer-preset" , preset_list[[sender indexOfSelectedItem]] ); var_SetString( p_object , "equalizer-preset" , preset_list[[sender indexOfSelectedItem]] );
NSString *preset;
const char *psz_values;
for( i = 0; i < 10; i++ ) for( i = 0; i < 10; i++ )
sprintf( psz_values, "%s %.1f", psz_values, eqz_preset_10b[[sender indexOfSelectedItem]]->f_amp[i] ); {
preset = [NSString stringWithFormat:@"%@ %.1f", preset, eqz_preset_10b[[sender indexOfSelectedItem]]->f_amp[i] ];
}
psz_values = [preset UTF8String];
var_SetString( p_object, "equalizer-bands", psz_values ); var_SetString( p_object, "equalizer-bands", psz_values );
var_SetFloat( p_object, "equalizer-preamp", eqz_preset_10b[[sender indexOfSelectedItem]]->f_preamp); var_SetFloat( p_object, "equalizer-preamp", eqz_preset_10b[[sender indexOfSelectedItem]]->f_preamp);
......
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