diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-01-08 09:28:22 +0100 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-01-08 09:28:22 +0100 |
commit | dbdb43f077f4fa016e9f3f65345c4a947eceaa77 (patch) | |
tree | 0f29c680b0e088e74d51be759ad566f15022a80c /src/win32 | |
parent | 25b261975c6756a3e0f9ee36107f185103b35292 (diff) | |
download | glutin-dbdb43f077f4fa016e9f3f65345c4a947eceaa77.tar.gz glutin-dbdb43f077f4fa016e9f3f65345c4a947eceaa77.zip |
Update for Rustc
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/init.rs | 8 | ||||
-rw-r--r-- | src/win32/mod.rs | 12 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs index d3341fe..77965ea 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -6,6 +6,7 @@ use {CreationError, Event}; use CreationError::OsError; use std::cell::RefCell; +use std::ffi::CString; use std::rc::Rc; use std::sync::mpsc::{Sender, Receiver, channel}; @@ -224,11 +225,12 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin // loading the extra WGL functions let extra_functions = gl::wgl_extra::Wgl::load_with(|addr| { use libc; - use std::c_str::ToCStr; + + let addr = CString::from_slice(addr.as_bytes()); + let addr = addr.as_slice_with_nul().as_ptr(); unsafe { - let addr = addr.to_c_str(); - gl::wgl::GetProcAddress(addr.as_ptr()) as *const libc::c_void + gl::wgl::GetProcAddress(addr) as *const libc::c_void } }); diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 9c78a8a..168771d 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -1,5 +1,6 @@ use std::sync::atomic::AtomicBool; use std::ptr; +use std::ffi::CString; use std::collections::RingBuf; use std::sync::mpsc::Receiver; use libc; @@ -256,14 +257,13 @@ impl Window { /// See the docs in the crate root file. pub fn get_proc_address(&self, addr: &str) -> *const () { - use std::c_str::ToCStr; + let addr = CString::from_slice(addr.as_bytes()); + let addr = addr.as_slice_with_nul().as_ptr(); unsafe { - addr.with_c_str(|s| { - let p = gl::wgl::GetProcAddress(s) as *const (); - if !p.is_null() { return p; } - winapi::GetProcAddress(self.gl_library, s) as *const () - }) + let p = gl::wgl::GetProcAddress(addr) as *const (); + if !p.is_null() { return p; } + winapi::GetProcAddress(self.gl_library, addr) as *const () } } |