]> git.sesse.net Git - vlc/commitdiff
* macosx: simplify volume update method for scrollfield usage.
authorDerk-Jan Hartman <hartman@videolan.org>
Mon, 14 Mar 2005 23:53:58 +0000 (23:53 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Mon, 14 Mar 2005 23:53:58 +0000 (23:53 +0000)
modules/gui/macosx/controls.m

index 6f738d571d3d1ec888ee74b010dc17b616ca6067..78de7cddd3f65b1b3e959e9947cb0b71e8fca734 100644 (file)
 - (void)updateVolumeSlider
 {
     NSString * o_text;
-    char * psz_text;
     intf_thread_t * p_intf = VLCIntf;
     audio_volume_t i_volume;
 
     aout_VolumeGet( p_intf, &i_volume );
-    psz_text = malloc( 32 * sizeof( char ) );
-/*FIXME: do we really need to work with a char * before NSString ? */
-    if( psz_text )
-    {
-        sprintf( psz_text, "Volume: %d", i_volume * 200 / AOUT_VOLUME_MAX );
-        o_text = [[NSString alloc] initWithCString:psz_text];
-        [o_main setScrollField:o_text stopAfter:1000000];
-        free( psz_text );
-    }
+
+    o_text = [NSString stringWithFormat: @"Volume: %d", i_volume * 200 / AOUT_VOLUME_MAX];
+    [o_main setScrollField:o_text stopAfter:1000000];
+    
     [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
 }