diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index 0569c469..9bb548b7 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -1,8 +1,7 @@ //! Audio Functions use std::ptr; use std::mem; -use std::c_str::{CString, ToCStr}; -use std::c_vec::CVec; +use std::ffi::CString; use std::borrow::ToOwned; use std::num::FromPrimitive; use libc; @@ -237,7 +236,6 @@ impl, CB: AudioCallback> AudioSpecDesired { pub fn open_audio_device(self, device: Option<&str>, iscapture: bool) -> SdlResult> { use std::mem::uninitialized; use std::ptr::null; - use std::c_str::CString; use libc::c_char; let mut userdata = AudioSpecDesired::callback_to_userdata(self.callback); diff --git a/src/sdl2/clipboard.rs b/src/sdl2/clipboard.rs index 46500310..e7303e7d 100644 --- a/src/sdl2/clipboard.rs +++ b/src/sdl2/clipboard.rs @@ -1,6 +1,7 @@ +use std::ffi::CString; + use SdlResult; use get_error; -use std::c_str::ToCStr; pub use sys::clipboard as ll; diff --git a/src/sdl2/filesystem.rs b/src/sdl2/filesystem.rs index 70b120b7..42c32a5d 100644 --- a/src/sdl2/filesystem.rs +++ b/src/sdl2/filesystem.rs @@ -1,5 +1,4 @@ -use std::c_str::ToCStr; - +use std::ffi::CString; use SdlResult; use get_error; diff --git a/src/sdl2/keyboard.rs b/src/sdl2/keyboard.rs index 91d7a888..eab52d5a 100644 --- a/src/sdl2/keyboard.rs +++ b/src/sdl2/keyboard.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; +use std::ffi::CString; use std::num::FromPrimitive; use std::ptr; -use std::c_str::ToCStr; use keycode::KeyCode; use rect::Rect; diff --git a/src/sdl2/messagebox.rs b/src/sdl2/messagebox.rs index c73d3f0e..9aab85da 100644 --- a/src/sdl2/messagebox.rs +++ b/src/sdl2/messagebox.rs @@ -1,5 +1,5 @@ +use std::ffi::CString; use std::ptr; -use std::c_str::ToCStr; use video::Window; use get_error; diff --git a/src/sdl2/render.rs b/src/sdl2/render.rs index 2a841e7d..504d7d32 100644 --- a/src/sdl2/render.rs +++ b/src/sdl2/render.rs @@ -12,7 +12,6 @@ use rect::Point; use rect::Rect; use std::num::FromPrimitive; use std::vec::Vec; -use std::c_vec::CVec; use std::borrow::ToOwned; pub use sys::render as ll; diff --git a/src/sdl2/rwops.rs b/src/sdl2/rwops.rs index 35b3f295..b9049155 100644 --- a/src/sdl2/rwops.rs +++ b/src/sdl2/rwops.rs @@ -1,6 +1,6 @@ +use std::ffi::CString; use std::io; use std::io::IoResult; -use std::c_str::ToCStr; use libc::{c_void, c_int, size_t}; use get_error; use SdlResult; @@ -20,7 +20,7 @@ impl_owned_accessors!(RWops, close_on_drop); impl RWops { pub fn from_file(path: &Path, mode: &str) -> SdlResult { let raw = unsafe { - ll::SDL_RWFromFile(path.to_c_str().into_inner(), mode.to_c_str().into_inner()) + ll::SDL_RWFromFile(CString::from_slice(path), CString::from_slice(mode)) }; if raw.is_null() { Err(get_error()) } else { Ok(RWops{raw: raw, close_on_drop: true}) } diff --git a/src/sdl2/sdl.rs b/src/sdl2/sdl.rs index d2e71c17..17bb77d8 100644 --- a/src/sdl2/sdl.rs +++ b/src/sdl2/sdl.rs @@ -1,5 +1,5 @@ -use std::c_str::{CString, ToCStr}; use std::borrow::ToOwned; +use std::ffi::CString; use sys::sdl as ll; diff --git a/src/sdl2/version.rs b/src/sdl2/version.rs index 73171c40..8da7bb08 100644 --- a/src/sdl2/version.rs +++ b/src/sdl2/version.rs @@ -2,8 +2,8 @@ Querying SDL Version */ +use std::ffi::CString; use std::fmt; -use std::c_str::CString; use std::borrow::ToOwned; pub use sys::version as ll; diff --git a/src/sdl2/video.rs b/src/sdl2/video.rs index 573b1902..9099da1b 100644 --- a/src/sdl2/video.rs +++ b/src/sdl2/video.rs @@ -1,7 +1,7 @@ use libc::{c_int, c_float, uint32_t}; +use std::ffi::CString; use std::ptr; use std::vec::Vec; -use std::c_str::ToCStr; use rect::Rect; use surface::Surface;