From c0823762862498a87270009f287cbf6838e4f36f Mon Sep 17 00:00:00 2001 From: Andelf Date: Fri, 9 May 2014 10:18:28 +0800 Subject: [PATCH 1/2] remove usage of owned ptr in audio.rs --- src/sdl2/audio.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index c0abe468..22241dff 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -262,9 +262,9 @@ impl AudioDevice { } } - pub fn open(device: Option<&str>, iscapture: int, spec: &AudioSpec) -> Result<(AudioDevice, ~AudioSpec), ~str> { + pub fn open(device: Option<&str>, iscapture: int, spec: &AudioSpec) -> Result<(AudioDevice, AudioSpec), ~str> { //! SDL_OpenAudioDevice - let obtained = ~unsafe { mem::uninit::() }; + let obtained = unsafe { mem::uninit::() }; unsafe { let device_c_str = match device { None => ptr::null(), From 4eb5935b5543eb610c13a7496a26834db9350444 Mon Sep 17 00:00:00 2001 From: Andelf Date: Fri, 9 May 2014 12:36:41 +0800 Subject: [PATCH 2/2] add Option wrapper to AudioSpec field, fix #97 --- src/sdl2/audio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index 22241dff..5d800263 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -204,7 +204,7 @@ pub struct AudioSpec<'a > { pub padding: uint16_t, pub size: uint32_t, c_callback: ll::SDL_AudioCallback, - pub callback: &'a |&mut [u8]|:'a, // same size as *c_void + pub callback: Option<&'a |&mut [u8]|:'a>, // same size as *c_void } extern "C" fn c_audio_callback(userdata: *c_void, stream: *uint8_t, len: c_int) {