mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-11 11:31:32 +11:00
Null terminate wchar string
This commit is contained in:
parent
b05fb33fb3
commit
474e6db31d
|
@ -187,7 +187,8 @@ pub enum MinifbError {
|
|||
}
|
||||
|
||||
fn to_wstring(str: &str) -> *const u16 {
|
||||
let v: Vec<u16> = OsStr::new(str).encode_wide().chain(Some(0).into_iter()).collect();
|
||||
let mut v: Vec<u16> = OsStr::new(str).encode_wide().chain(Some(0).into_iter()).collect();
|
||||
v.push(0u16);
|
||||
v.as_ptr()
|
||||
}
|
||||
|
||||
|
@ -203,7 +204,6 @@ impl Window {
|
|||
fn open_window(name: &str, width: usize, height: usize, _: Scale, _: Vsync) -> Option<HWND> {
|
||||
unsafe {
|
||||
let class_name = to_wstring("minifb_window");
|
||||
|
||||
let class = WNDCLASSW {
|
||||
style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC,
|
||||
lpfnWndProc: Some(wnd_proc),
|
||||
|
|
Loading…
Reference in a new issue