Skip to content

Commit 693fef2

Browse files
committed
Add missing null terminators
1 parent 6629e52 commit 693fef2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/platform_impl/windows/dark_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn should_apps_use_dark_mode() -> bool {
154154
unsafe {
155155
const UXTHEME_SHOULDAPPSUSEDARKMODE_ORDINAL: PSTR = PSTR(132 as *mut u8);
156156

157-
let module = LoadLibraryA(PSTR("uxtheme.dll".as_ptr() as *mut u8));
157+
let module = LoadLibraryA(PSTR("uxtheme.dll\0".as_ptr() as *mut u8));
158158

159159
if module.is_invalid() {
160160
return None;

src/platform_impl/windows/event_loop.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -599,51 +599,51 @@ lazy_static! {
599599
// WPARAM and LPARAM are unused.
600600
static ref USER_EVENT_MSG_ID: u32 = {
601601
unsafe {
602-
RegisterWindowMessageA(PSTR("Winit::WakeupMsg".as_ptr() as *mut u8))
602+
RegisterWindowMessageA(PSTR("Winit::WakeupMsg\0".as_ptr() as *mut u8))
603603
}
604604
};
605605
// Message sent when we want to execute a closure in the thread.
606606
// WPARAM contains a Box<Box<dyn FnMut()>> that must be retrieved with `Box::from_raw`,
607607
// and LPARAM is unused.
608608
static ref EXEC_MSG_ID: u32 = {
609609
unsafe {
610-
RegisterWindowMessageA(PSTR("Winit::ExecMsg".as_ptr() as *mut u8))
610+
RegisterWindowMessageA(PSTR("Winit::ExecMsg\0".as_ptr() as *mut u8))
611611
}
612612
};
613613
static ref PROCESS_NEW_EVENTS_MSG_ID: u32 = {
614614
unsafe {
615-
RegisterWindowMessageA(PSTR("Winit::ProcessNewEvents".as_ptr() as *mut u8))
615+
RegisterWindowMessageA(PSTR("Winit::ProcessNewEvents\0".as_ptr() as *mut u8))
616616
}
617617
};
618618
/// lparam is the wait thread's message id.
619619
static ref SEND_WAIT_THREAD_ID_MSG_ID: u32 = {
620620
unsafe {
621-
RegisterWindowMessageA(PSTR("Winit::SendWaitThreadId".as_ptr() as *mut u8))
621+
RegisterWindowMessageA(PSTR("Winit::SendWaitThreadId\0".as_ptr() as *mut u8))
622622
}
623623
};
624624
/// lparam points to a `Box<Instant>` signifying the time `PROCESS_NEW_EVENTS_MSG_ID` should
625625
/// be sent.
626626
static ref WAIT_UNTIL_MSG_ID: u32 = {
627627
unsafe {
628-
RegisterWindowMessageA(PSTR("Winit::WaitUntil".as_ptr() as *mut u8))
628+
RegisterWindowMessageA(PSTR("Winit::WaitUntil\0".as_ptr() as *mut u8))
629629
}
630630
};
631631
static ref CANCEL_WAIT_UNTIL_MSG_ID: u32 = {
632632
unsafe {
633-
RegisterWindowMessageA(PSTR("Winit::CancelWaitUntil".as_ptr() as *mut u8))
633+
RegisterWindowMessageA(PSTR("Winit::CancelWaitUntil\0".as_ptr() as *mut u8))
634634
}
635635
};
636636
// Message sent by a `Window` when it wants to be destroyed by the main thread.
637637
// WPARAM and LPARAM are unused.
638638
pub static ref DESTROY_MSG_ID: u32 = {
639639
unsafe {
640-
RegisterWindowMessageA(PSTR("Winit::DestroyMsg".as_ptr() as *mut u8))
640+
RegisterWindowMessageA(PSTR("Winit::DestroyMsg\0".as_ptr() as *mut u8))
641641
}
642642
};
643643
// WPARAM is a bool specifying the `WindowFlags::MARKER_RETAIN_STATE_ON_SIZE` flag. See the
644644
// documentation in the `window_state` module for more information.
645645
pub static ref SET_RETAIN_STATE_ON_SIZE_MSG_ID: u32 = unsafe {
646-
RegisterWindowMessageA(PSTR("Winit::SetRetainMaximized".as_ptr() as *mut u8))
646+
RegisterWindowMessageA(PSTR("Winit::SetRetainMaximized\0".as_ptr() as *mut u8))
647647
};
648648
static ref THREAD_EVENT_TARGET_WINDOW_CLASS: Vec<u16> = util::encode_wide("Winit Thread Event Target");
649649
}

0 commit comments

Comments
 (0)