Merge pull request #189 from ozkriff/master

android: Updated for Rust ea6f65c5f 2015-01-06
This commit is contained in:
tomaka 2015-01-08 19:02:22 +01:00
commit 9d7dbf7eb0

View file

@ -1,6 +1,7 @@
extern crate android_glue; extern crate android_glue;
use libc; use libc;
use std::ffi::{CString};
use std::sync::mpsc::{Receiver, channel}; use std::sync::mpsc::{Receiver, channel};
use {CreationError, Event, WindowBuilder}; use {CreationError, Event, WindowBuilder};
use CreationError::OsError; use CreationError::OsError;
@ -257,12 +258,9 @@ impl Window {
} }
pub fn get_proc_address(&self, addr: &str) -> *const () { pub fn get_proc_address(&self, addr: &str) -> *const () {
use std::c_str::ToCStr; let addr = CString::from_slice(addr.as_bytes()).as_slice_with_nul().as_ptr();
unsafe { unsafe {
addr.with_c_str(|s| { ffi::egl::GetProcAddress(addr) as *const ()
ffi::egl::GetProcAddress(s) as *const ()
})
} }
} }