mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Removed as_slice_with_nul as CString now derefs to a CStr
This commit is contained in:
parent
0389c834e4
commit
1055eed078
|
@ -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 ()
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ fn init(title: Vec<u16>, 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
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -8,7 +8,7 @@ use super::ffi;
|
|||
fn with_c_str<F, T>(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 {
|
||||
|
|
|
@ -39,7 +39,7 @@ fn ensure_thread_init() {
|
|||
fn with_c_str<F, T>(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 {
|
||||
|
|
Loading…
Reference in a new issue