mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-26 02:36:32 +11:00
Null terminate wchar string
This commit is contained in:
parent
b05fb33fb3
commit
474e6db31d
1 changed files with 2 additions and 2 deletions
|
@ -187,7 +187,8 @@ pub enum MinifbError {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_wstring(str: &str) -> *const u16 {
|
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()
|
v.as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +204,6 @@ impl Window {
|
||||||
fn open_window(name: &str, width: usize, height: usize, _: Scale, _: Vsync) -> Option<HWND> {
|
fn open_window(name: &str, width: usize, height: usize, _: Scale, _: Vsync) -> Option<HWND> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let class_name = to_wstring("minifb_window");
|
let class_name = to_wstring("minifb_window");
|
||||||
|
|
||||||
let class = WNDCLASSW {
|
let class = WNDCLASSW {
|
||||||
style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC,
|
style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC,
|
||||||
lpfnWndProc: Some(wnd_proc),
|
lpfnWndProc: Some(wnd_proc),
|
||||||
|
|
Loading…
Add table
Reference in a new issue