File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,6 @@ use std::ops::{Deref, DerefMut};
60
60
use std:: path:: Path ;
61
61
use std:: marker:: PhantomData ;
62
62
use std:: mem;
63
- use std:: mem:: transmute;
64
63
use std:: ptr;
65
64
66
65
use AudioSubsystem ;
@@ -209,12 +208,16 @@ pub enum AudioStatus {
209
208
impl FromPrimitive for AudioStatus {
210
209
fn from_i64 ( n : i64 ) -> Option < AudioStatus > {
211
210
use self :: AudioStatus :: * ;
212
- let n = n as u32 ;
213
211
214
- Some ( match unsafe { transmute :: < u32 , sys:: SDL_AudioStatus > ( n) } {
215
- sys:: SDL_AudioStatus :: SDL_AUDIO_STOPPED => Stopped ,
216
- sys:: SDL_AudioStatus :: SDL_AUDIO_PLAYING => Playing ,
217
- sys:: SDL_AudioStatus :: SDL_AUDIO_PAUSED => Paused ,
212
+ const STOPPED : i64 = sys:: SDL_AudioStatus :: SDL_AUDIO_STOPPED as i64 ;
213
+ const PLAYING : i64 = sys:: SDL_AudioStatus :: SDL_AUDIO_PLAYING as i64 ;
214
+ const PAUSED : i64 = sys:: SDL_AudioStatus :: SDL_AUDIO_PAUSED as i64 ;
215
+
216
+ Some ( match n {
217
+ STOPPED => Stopped ,
218
+ PLAYING => Playing ,
219
+ PAUSED => Paused ,
220
+ _ => return None ,
218
221
} )
219
222
}
220
223
You can’t perform that action at this time.
0 commit comments