Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Sep 14, 2023
1 parent b675223 commit 34ccede
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions crates/tests/component/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ pub mod Nested {
Method: Method::<Identity, Impl, OFFSET>,
}
}
pub fn matches(iid: &::windows_core::GUID) -> bool {
iid == &<IThing as ::windows_core::ComInterface>::IID
pub unsafe fn matches(iid: *const ::windows_core::GUID) -> bool {
*iid == <IThing as ::windows_core::ComInterface>::IID
}
}
}
Expand Down Expand Up @@ -382,13 +382,13 @@ impl<F: FnMut(i32) -> ::windows_core::Result<i32> + ::core::marker::Send + 'stat
};
unsafe extern "system" fn QueryInterface(
this: *mut ::core::ffi::c_void,
iid: &::windows_core::GUID,
interface: *mut *const ::core::ffi::c_void,
iid: *const ::windows_core::GUID,
interface: *mut *mut ::core::ffi::c_void,
) -> ::windows_core::HRESULT {
let this = this as *mut *mut ::core::ffi::c_void as *mut Self;
*interface = if iid == &<Callback as ::windows_core::ComInterface>::IID
|| iid == &<::windows_core::IUnknown as ::windows_core::ComInterface>::IID
|| iid == &<::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID
*interface = if *iid == <Callback as ::windows_core::ComInterface>::IID
|| *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID
|| *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID
{
&mut (*this).vtable as *mut _ as _
} else {
Expand Down Expand Up @@ -643,7 +643,7 @@ impl IClass_Vtbl {
Input: Input::<Identity, Impl, OFFSET>,
}
}
pub fn matches(iid: &::windows_core::GUID) -> bool {
iid == &<IClass as ::windows_core::ComInterface>::IID
pub unsafe fn matches(iid: *const ::windows_core::GUID) -> bool {
*iid == <IClass as ::windows_core::ComInterface>::IID
}
}
10 changes: 5 additions & 5 deletions crates/tests/component_client/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ impl<F: FnMut(i32) -> ::windows_core::Result<i32> + ::core::marker::Send + 'stat
};
unsafe extern "system" fn QueryInterface(
this: *mut ::core::ffi::c_void,
iid: &::windows_core::GUID,
interface: *mut *const ::core::ffi::c_void,
iid: *const ::windows_core::GUID,
interface: *mut *mut ::core::ffi::c_void,
) -> ::windows_core::HRESULT {
let this = this as *mut *mut ::core::ffi::c_void as *mut Self;
*interface = if iid == &<Callback as ::windows_core::ComInterface>::IID
|| iid == &<::windows_core::IUnknown as ::windows_core::ComInterface>::IID
|| iid == &<::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID
*interface = if *iid == <Callback as ::windows_core::ComInterface>::IID
|| *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID
|| *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID
{
&mut (*this).vtable as *mut _ as _
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/implement/tests/class_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl IClassFactory_Impl for Factory {
) -> Result<()> {
assert!(outer.is_none());
let unknown: IInspectable = Object().into();
unsafe { unknown.query(&*iid, object as *mut _).ok() }
unsafe { unknown.query(iid, object).ok() }
}

fn LockServer(&self, lock: BOOL) -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/implement/tests/from_raw_borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl IServiceProvider_Impl for Borrowed {
) -> Result<()> {
unsafe {
let unknown: IUnknown = self.cast()?;
unknown.query(&*iid, object as _).ok()
unknown.query(iid, object).ok()
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions crates/tests/weak_ref/tests/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ use windows::Win32::System::WinRT::IWeakReferenceSource;
fn test() {
// Ref count starts at 1
let count = WeakRefCount::new();