diff options
-rw-r--r-- | examples/fullscreen.rs | 4 | ||||
-rw-r--r-- | examples/multiwindow.rs | 4 | ||||
-rw-r--r-- | examples/support/mod.rs | 8 | ||||
-rw-r--r-- | examples/window.rs | 4 | ||||
-rw-r--r-- | src/win32/init.rs | 8 | ||||
-rw-r--r-- | src/win32/mod.rs | 12 | ||||
-rw-r--r-- | tests/headless.rs | 2 |
7 files changed, 16 insertions, 26 deletions
diff --git a/examples/fullscreen.rs b/examples/fullscreen.rs index 6a2af2c..c77569f 100644 --- a/examples/fullscreen.rs +++ b/examples/fullscreen.rs @@ -1,7 +1,5 @@ -#![feature(phase)] - #[cfg(target_os = "android")] -#[phase(plugin, link)] +#[macro_use] extern crate android_glue; extern crate glutin; diff --git a/examples/multiwindow.rs b/examples/multiwindow.rs index 1f390cd..fc01ef0 100644 --- a/examples/multiwindow.rs +++ b/examples/multiwindow.rs @@ -1,7 +1,5 @@ -#![feature(phase)] - #[cfg(target_os = "android")] -#[phase(plugin, link)] +#[macro_use] extern crate android_glue; extern crate glutin; diff --git a/examples/support/mod.rs b/examples/support/mod.rs index 02079fd..7144952 100644 --- a/examples/support/mod.rs +++ b/examples/support/mod.rs @@ -1,8 +1,5 @@ #![cfg(feature = "window")] -#[no_link] -extern crate gl_generator; - use glutin; #[cfg(not(target_os = "android"))] @@ -24,9 +21,8 @@ pub fn load(window: &glutin::Window) -> Context { let gl = gl::Gl::load(window); let version = unsafe { - use std::ffi::c_str_to_bytes; - let ref version = gl.GetString(gl::VERSION) as *const i8; - String::from_utf8_lossy(c_str_to_bytes(version)).into_owned() + use std::ffi; + ffi::c_str_to_bytes(&(gl.GetString(gl::VERSION) as *const i8)).to_string() }; println!("OpenGL version {}", version); diff --git a/examples/window.rs b/examples/window.rs index 910d6e6..9cb59c8 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -1,7 +1,5 @@ -#![feature(phase)] - #[cfg(target_os = "android")] -#[phase(plugin, link)] +#[macro_use] extern crate android_glue; extern crate glutin; 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 () } } diff --git a/tests/headless.rs b/tests/headless.rs index 23a337d..542445e 100644 --- a/tests/headless.rs +++ b/tests/headless.rs @@ -1,5 +1,3 @@ -#[no_link] -extern crate gl_generator; extern crate glutin; extern crate libc; |