From 1055eed078f674ad4cc657e99a247310183d635e Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 22 Feb 2015 01:17:47 +1100 Subject: Removed as_slice_with_nul as CString now derefs to a CStr --- src/android/mod.rs | 2 +- src/win32/init.rs | 2 +- src/win32/mod.rs | 2 +- src/x11/headless.rs | 2 +- src/x11/window/mod.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/android/mod.rs b/src/android/mod.rs index 563ca50..bcf08ad 100644 --- a/src/android/mod.rs +++ b/src/android/mod.rs @@ -313,7 +313,7 @@ impl Window { pub fn get_proc_address(&self, addr: &str) -> *const () { let addr = CString::from_slice(addr.as_bytes()); - let addr = addr.as_bytes_with_nul().as_ptr(); + let addr = addr.as_ptr(); unsafe { ffi::egl::GetProcAddress(addr) as *const () } diff --git a/src/win32/init.rs b/src/win32/init.rs index fd454d3..53fbc96 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -171,7 +171,7 @@ fn init(title: Vec, builder: BuilderAttribs<'static>, builder_sharelists: O use libc; let addr = CString::from_slice(addr.as_bytes()); - let addr = addr.as_bytes_with_nul().as_ptr(); + let addr = addr.as_ptr(); unsafe { gl::wgl::GetProcAddress(addr) as *const libc::c_void diff --git a/src/win32/mod.rs b/src/win32/mod.rs index e47c6eb..4846d59 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -192,7 +192,7 @@ impl Window { /// See the docs in the crate root file. pub fn get_proc_address(&self, addr: &str) -> *const () { let addr = CString::from_slice(addr.as_bytes()); - let addr = addr.as_bytes_with_nul().as_ptr(); + let addr = addr.as_ptr(); unsafe { let p = gl::wgl::GetProcAddress(addr) as *const (); diff --git a/src/x11/headless.rs b/src/x11/headless.rs index a0f0556..ca47414 100644 --- a/src/x11/headless.rs +++ b/src/x11/headless.rs @@ -8,7 +8,7 @@ use super::ffi; fn with_c_str(s: &str, f: F) -> T where F: FnOnce(*const libc::c_char) -> T { use std::ffi::CString; let c_str = CString::from_slice(s.as_bytes()); - f(c_str.as_bytes_with_nul().as_ptr()) + f(c_str.as_ptr()) } pub struct HeadlessContext { diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index 0c6da4e..8664b4a 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -39,7 +39,7 @@ fn ensure_thread_init() { fn with_c_str(s: &str, f: F) -> T where F: FnOnce(*const libc::c_char) -> T { use std::ffi::CString; let c_str = CString::from_slice(s.as_bytes()); - f(c_str.as_bytes_with_nul().as_ptr()) + f(c_str.as_ptr()) } struct XWindow { -- cgit v1.2.3