Skip to content

Commit

Permalink
Merge branch 'master' into io_error
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Feb 12, 2024
2 parents e0573a1 + 71dcb5f commit f3fbf52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/libs/core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl<T: Interface> Drop for Array<T> {

/// A reference-counted buffer.
#[repr(C)]
#[repr(align(8))]
struct Buffer<T>(crate::imp::RefCount, std::marker::PhantomData<T>);

impl<T: Interface> Buffer<T> {
Expand Down
7 changes: 5 additions & 2 deletions crates/libs/core/src/hresult.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ impl HRESULT {

unsafe {
let size = crate::imp::FormatMessageW(crate::imp::FORMAT_MESSAGE_ALLOCATE_BUFFER | crate::imp::FORMAT_MESSAGE_FROM_SYSTEM | crate::imp::FORMAT_MESSAGE_IGNORE_INSERTS, std::ptr::null(), self.0 as u32, 0, &mut message.0 as *mut _ as *mut _, 0, std::ptr::null());

HSTRING::from_wide(crate::imp::wide_trim_end(std::slice::from_raw_parts(message.0 as *const u16, size as usize))).unwrap_or_default()
if !message.0.is_null() && size > 0 {
HSTRING::from_wide(crate::imp::wide_trim_end(std::slice::from_raw_parts(message.0 as *const u16, size as usize))).unwrap_or_default()
} else {
HSTRING::default()
}
}
}

Expand Down

0 comments on commit f3fbf52

Please sign in to comment.