mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Added SdlResult and switched to StrBuf
This commit is contained in:
+3
-3
@@ -1,5 +1,6 @@
|
||||
use std::mem;
|
||||
use std::str;
|
||||
use std::c_str::CString;
|
||||
|
||||
// Setup linking for all targets.
|
||||
#[cfg(target_os="macos")]
|
||||
@@ -113,9 +114,8 @@ pub fn was_inited(flags: InitFlag) -> InitFlag {
|
||||
|
||||
pub fn get_error() -> String {
|
||||
unsafe {
|
||||
let cstr = ll::SDL_GetError();
|
||||
|
||||
str::raw::from_c_str(mem::transmute_copy(&cstr))
|
||||
let cstr = CString::new(ll::SDL_GetError(), false);
|
||||
cstr.as_str().to_strbuf()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user