Skip to content

Commit

Permalink
Remap BOOLEAN to bool (#3376)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Dec 10, 2024
1 parent 1332b65 commit 2291719
Show file tree
Hide file tree
Showing 141 changed files with 3,942 additions and 4,041 deletions.
8 changes: 7 additions & 1 deletion crates/libs/bindgen/src/types/cpp_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,17 @@ impl CppConst {
value = format!("0x{:X}_u32 as _", signed).into();
}
}
} else if field_ty == Type::Bool {
value = match constant.value() {
Value::U8(1) => quote! { true },
Value::U8(0) => quote! { false },
_ => panic!(),
};
} else {
value = quote! { #value as _ };
}

if writer.config.sys {
if writer.config.sys || field_ty == Type::Bool {
quote! {
#cfg
pub const #name: #ty = #value;
Expand Down
3 changes: 1 addition & 2 deletions crates/libs/bindgen/src/types/cpp_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ impl CppMethod {
|| param.has_attribute("ReservedAttribute"))
{
*hint = ParamHint::Optional;
} else if !flags.contains(ParamAttributes::Out)
&& matches!(ty.type_name(), TypeName::BOOL | TypeName::BOOLEAN)
} else if !flags.contains(ParamAttributes::Out) && ty.type_name() == TypeName::BOOL
{
*hint = ParamHint::Bool;
} else if ty.is_primitive() && (!ty.is_pointer() || ty.deref().is_copyable()) {
Expand Down
1 change: 1 addition & 0 deletions crates/libs/bindgen/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl Type {
TypeName::BSTR => Remap::Type(Self::BSTR),
TypeName::IInspectable => Remap::Type(Self::Object),
TypeName::CHAR => Remap::Type(Self::I8),
TypeName::BOOLEAN => Remap::Type(Self::Bool),
TypeName::IUnknown => Remap::Type(Self::IUnknown),
TypeName::Type => Remap::Type(Self::Type),

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
windows_targets::link!("vhfum.dll" "system" fn VhfAsyncOperationComplete(vhfoperationhandle : *const core::ffi::c_void, completionstatus : super::super::super::Win32::Foundation:: NTSTATUS) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("vhfum.dll" "system" fn VhfCreate(vhfconfig : *const VHF_CONFIG, vhfhandle : *mut *mut core::ffi::c_void) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("vhfum.dll" "system" fn VhfDelete(vhfhandle : *const core::ffi::c_void, wait : super::super::super::Win32::Foundation:: BOOLEAN));
windows_targets::link!("vhfum.dll" "system" fn VhfDelete(vhfhandle : *const core::ffi::c_void, wait : bool));
windows_targets::link!("vhfum.dll" "system" fn VhfReadReportSubmit(vhfhandle : *const core::ffi::c_void, hidtransferpacket : *const HID_XFER_PACKET) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("vhfum.dll" "system" fn VhfStart(vhfhandle : *const core::ffi::c_void) -> super::super::super::Win32::Foundation:: NTSTATUS);
pub type EVT_VHF_ASYNC_OPERATION = Option<unsafe extern "system" fn(vhfclientcontext: *const core::ffi::c_void, vhfoperationhandle: *const core::ffi::c_void, vhfoperationcontext: *const core::ffi::c_void, hidtransferpacket: *const HID_XFER_PACKET)>;
Expand Down
86 changes: 43 additions & 43 deletions crates/libs/sys/src/Windows/Wdk/Foundation/mod.rs

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions crates/libs/sys/src/Windows/Wdk/Graphics/Direct3D/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ windows_targets::link!("gdi32.dll" "system" fn D3DKMTCancelPresents(param0 : *co
#[cfg(feature = "Win32_Graphics_Gdi")]
windows_targets::link!("gdi32.dll" "system" fn D3DKMTChangeSurfacePointer(param0 : *const D3DKMT_CHANGESURFACEPOINTER) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("gdi32.dll" "system" fn D3DKMTChangeVideoMemoryReservation(param0 : *const D3DKMT_CHANGEVIDEOMEMORYRESERVATION) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("gdi32.dll" "system" fn D3DKMTCheckExclusiveOwnership() -> super::super::super::Win32::Foundation:: BOOLEAN);
windows_targets::link!("gdi32.dll" "system" fn D3DKMTCheckExclusiveOwnership() -> bool);
windows_targets::link!("gdi32.dll" "system" fn D3DKMTCheckMonitorPowerState(param0 : *const D3DKMT_CHECKMONITORPOWERSTATE) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("gdi32.dll" "system" fn D3DKMTCheckMultiPlaneOverlaySupport(param0 : *mut D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT) -> super::super::super::Win32::Foundation:: NTSTATUS);
windows_targets::link!("gdi32.dll" "system" fn D3DKMTCheckMultiPlaneOverlaySupport2(param0 : *mut D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT2) -> super::super::super::Win32::Foundation:: NTSTATUS);
Expand Down Expand Up @@ -2258,7 +2258,7 @@ pub struct D3DKMDT_VIDEO_PRESENT_TARGET {
pub VideoOutputTechnology: D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY,
pub VideoOutputHpdAwareness: DXGK_CHILD_DEVICE_HPD_AWARENESS,
pub MonitorOrientationAwareness: D3DKMDT_MONITOR_ORIENTATION_AWARENESS,
pub SupportsSdtvModes: super::super::super::Win32::Foundation::BOOLEAN,
pub SupportsSdtvModes: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -2647,7 +2647,7 @@ pub const D3DKMT_AllocationPriorityClassNormal: D3DKMT_QUERYSTATISTICS_ALLOCATIO
#[repr(C)]
#[derive(Clone, Copy)]
pub struct D3DKMT_BDDFALLBACK_CTL {
pub ForceBddHeadlessNextFallback: super::super::super::Win32::Foundation::BOOLEAN,
pub ForceBddHeadlessNextFallback: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -2679,7 +2679,7 @@ pub union D3DKMT_BRIGHTNESS_INFO_0 {
pub BrightnessState: DXGK_BRIGHTNESS_STATE,
pub OptimizationLevel: DXGK_BACKLIGHT_OPTIMIZATION_LEVEL,
pub ReductionInfo: DXGK_BACKLIGHT_INFO,
pub VerboseLogging: super::super::super::Win32::Foundation::BOOLEAN,
pub VerboseLogging: bool,
pub NitRanges: DXGK_BRIGHTNESS_GET_NIT_RANGES_OUT,
pub GetBrightnessMillinits: DXGK_BRIGHTNESS_GET_OUT,
pub SetBrightnessMillinits: DXGK_BRIGHTNESS_SET_IN,
Expand Down Expand Up @@ -2892,9 +2892,9 @@ pub struct D3DKMT_COMPOSITION_PRESENTHISTORYTOKEN {
pub struct D3DKMT_CONFIGURESHAREDRESOURCE {
pub hDevice: u32,
pub hResource: u32,
pub IsDwm: super::super::super::Win32::Foundation::BOOLEAN,
pub IsDwm: bool,
pub hProcess: super::super::super::Win32::Foundation::HANDLE,
pub AllowAccess: super::super::super::Win32::Foundation::BOOLEAN,
pub AllowAccess: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -3338,7 +3338,7 @@ pub struct D3DKMT_DEVICEPAGEFAULT_STATE {
#[derive(Clone, Copy)]
pub struct D3DKMT_DEVICEPRESENT_QUEUE_STATE {
pub VidPnSourceId: u32,
pub bQueuedPresentLimitReached: super::super::super::Win32::Foundation::BOOLEAN,
pub bQueuedPresentLimitReached: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -3602,7 +3602,7 @@ pub const D3DKMT_ESCAPE_VIDSCH: D3DKMT_ESCAPETYPE = 3i32;
pub struct D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE {
pub Type: D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE,
pub VidPnSourceId: u32,
pub ProcessBoostEligible: super::super::super::Win32::Foundation::BOOLEAN,
pub ProcessBoostEligible: bool,
pub VSyncMultiplier: u32,
pub BaseDesktopDuration: u32,
pub Reserved: [u8; 16],
Expand Down Expand Up @@ -3878,7 +3878,7 @@ pub struct D3DKMT_GETMULTISAMPLEMETHODLIST {
pub struct D3DKMT_GETOVERLAYSTATE {
pub hDevice: u32,
pub hOverlay: u32,
pub OverlayEnabled: super::super::super::Win32::Foundation::BOOLEAN,
pub OverlayEnabled: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand All @@ -3895,7 +3895,7 @@ pub const D3DKMT_GETPRESENTHISTORY_MAXTOKENS: u32 = 2048u32;
pub struct D3DKMT_GETPROCESSDEVICEREMOVALSUPPORT {
pub hProcess: super::super::super::Win32::Foundation::HANDLE,
pub AdapterLuid: super::super::super::Win32::Foundation::LUID,
pub Support: super::super::super::Win32::Foundation::BOOLEAN,
pub Support: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand All @@ -3910,7 +3910,7 @@ pub struct D3DKMT_GETRUNTIMEDATA {
pub struct D3DKMT_GETSCANLINE {
pub hAdapter: u32,
pub VidPnSourceId: u32,
pub InVerticalBlank: super::super::super::Win32::Foundation::BOOLEAN,
pub InVerticalBlank: bool,
pub ScanLine: u32,
}
#[repr(C)]
Expand Down Expand Up @@ -3939,7 +3939,7 @@ pub struct D3DKMT_GETVERTICALBLANKEVENT {
#[derive(Clone, Copy)]
pub struct D3DKMT_GET_DEVICE_VIDPN_OWNERSHIP_INFO {
pub hDevice: u32,
pub bFailedDwmAcquireVidPn: super::super::super::Win32::Foundation::BOOLEAN,
pub bFailedDwmAcquireVidPn: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -3973,7 +3973,7 @@ pub struct D3DKMT_GET_PTE {
pub PhysicalAdapterIndex: u32,
pub PageTableLevel: u32,
pub PageTableIndex: [u32; 6],
pub b64KBPte: super::super::super::Win32::Foundation::BOOLEAN,
pub b64KBPte: bool,
pub NumPtes: u32,
pub Pte: [DXGK_PTE; 64],
pub NumValidEntries: u32,
Expand Down Expand Up @@ -4025,13 +4025,13 @@ pub const D3DKMT_GPU_PREFERENCE_TYPE_USER_PREFERENCE: D3DKMT_GPU_PREFERENCE_QUER
#[repr(C)]
#[derive(Clone, Copy)]
pub struct D3DKMT_HISTORY_BUFFER_STATUS {
pub Enabled: super::super::super::Win32::Foundation::BOOLEAN,
pub Enabled: bool,
pub Reserved: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct D3DKMT_HWDRM_SUPPORT {
pub Supported: super::super::super::Win32::Foundation::BOOLEAN,
pub Supported: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -4149,9 +4149,9 @@ pub const D3DKMT_MIRACAST_DEVICE_STATUS_UNKOWN_PAIRING: D3DKMT_MIRACAST_DEVICE_S
#[repr(C)]
#[derive(Clone, Copy)]
pub struct D3DKMT_MIRACAST_DISPLAY_DEVICE_CAPS {
pub HdcpSupported: super::super::super::Win32::Foundation::BOOLEAN,
pub HdcpSupported: bool,
pub DefaultControlPort: u32,
pub UsesIhvSolution: super::super::super::Win32::Foundation::BOOLEAN,
pub UsesIhvSolution: bool,
}
pub type D3DKMT_MIRACAST_DISPLAY_DEVICE_STATE = i32;
#[repr(C)]
Expand Down Expand Up @@ -4776,7 +4776,7 @@ pub struct D3DKMT_PANELFITTER_SUPPORT {
#[repr(C)]
#[derive(Clone, Copy)]
pub struct D3DKMT_PARAVIRTUALIZATION {
pub SecureContainer: super::super::super::Win32::Foundation::BOOLEAN,
pub SecureContainer: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -4868,7 +4868,7 @@ pub struct D3DKMT_PRESENT {
pub BroadcastDstAllocation: *mut u32,
pub PrivateDriverDataSize: u32,
pub pPrivateDriverData: *mut core::ffi::c_void,
pub bOptimizeForComposition: super::super::super::Win32::Foundation::BOOLEAN,
pub bOptimizeForComposition: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -5916,8 +5916,8 @@ pub struct D3DKMT_SEGMENT_CAPS {
pub Size: u64,
pub PageSize: u32,
pub SegmentId: u32,
pub bAperture: super::super::super::Win32::Foundation::BOOLEAN,
pub bReservedSysMem: super::super::super::Win32::Foundation::BOOLEAN,
pub bAperture: bool,
pub bReservedSysMem: bool,
pub BudgetGroup: D3DKMT_MEMORY_SEGMENT_GROUP,
}
#[repr(C)]
Expand Down Expand Up @@ -8428,13 +8428,13 @@ pub const DXGK_ENGINE_TYPE_VIDEO_PROCESSING: DXGK_ENGINE_TYPE = 4i32;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct DXGK_ESCAPE_GPUMMUCAPS {
pub ReadOnlyMemorySupported: super::super::super::Win32::Foundation::BOOLEAN,
pub NoExecuteMemorySupported: super::super::super::Win32::Foundation::BOOLEAN,
pub ZeroInPteSupported: super::super::super::Win32::Foundation::BOOLEAN,
pub CacheCoherentMemorySupported: super::super::super::Win32::Foundation::BOOLEAN,
pub LargePageSupported: super::super::super::Win32::Foundation::BOOLEAN,
pub DualPteSupported: super::super::super::Win32::Foundation::BOOLEAN,
pub AllowNonAlignedLargePageAddress: super::super::super::Win32::Foundation::BOOLEAN,
pub ReadOnlyMemorySupported: bool,
pub NoExecuteMemorySupported: bool,
pub ZeroInPteSupported: bool,
pub CacheCoherentMemorySupported: bool,
pub LargePageSupported: bool,
pub DualPteSupported: bool,
pub AllowNonAlignedLargePageAddress: bool,
pub VirtualAddressBitCount: u32,
pub PageTableLevelCount: u32,
pub PageTableLevelDesk: [D3DKMT_PAGE_TABLE_LEVEL_DESC; 6],
Expand Down Expand Up @@ -8576,8 +8576,8 @@ pub struct DXGK_NODEMETADATA {
pub EngineType: DXGK_ENGINE_TYPE,
pub FriendlyName: [u16; 32],
pub Flags: DXGK_NODEMETADATA_FLAGS,
pub GpuMmuSupported: super::super::super::Win32::Foundation::BOOLEAN,
pub IoMmuSupported: super::super::super::Win32::Foundation::BOOLEAN,
pub GpuMmuSupported: bool,
pub IoMmuSupported: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -8821,13 +8821,13 @@ pub const OUTPUTDUPL_CONTEXT_DEBUG_STATUS_ACTIVE: OUTPUTDUPL_CONTEXT_DEBUG_STATU
pub const OUTPUTDUPL_CONTEXT_DEBUG_STATUS_INACTIVE: OUTPUTDUPL_CONTEXT_DEBUG_STATUS = 0i32;
pub const OUTPUTDUPL_CONTEXT_DEBUG_STATUS_PENDING_DESTROY: OUTPUTDUPL_CONTEXT_DEBUG_STATUS = 2i32;
pub const OUTPUTDUPL_CREATE_MAX_KEYEDMUTXES: u32 = 3u32;
pub type PDXGK_FSTATE_NOTIFICATION = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, componentindex: u32, newfstate: u32, prenotification: super::super::super::Win32::Foundation::BOOLEAN, privatehandle: *mut core::ffi::c_void)>;
pub type PDXGK_FSTATE_NOTIFICATION = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, componentindex: u32, newfstate: u32, prenotification: bool, privatehandle: *mut core::ffi::c_void)>;
pub type PDXGK_GRAPHICSPOWER_UNREGISTER = Option<unsafe extern "system" fn(devicehandle: *mut core::ffi::c_void, privatehandle: *mut core::ffi::c_void) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PDXGK_INITIAL_COMPONENT_STATE = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, privatehandle: *mut core::ffi::c_void, componentindex: u32, isblockingtype: super::super::super::Win32::Foundation::BOOLEAN, initialfstate: u32, componentguid: windows_sys::core::GUID, powercomponentmappingflag: u32)>;
pub type PDXGK_INITIAL_COMPONENT_STATE = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, privatehandle: *mut core::ffi::c_void, componentindex: u32, isblockingtype: bool, initialfstate: u32, componentguid: windows_sys::core::GUID, powercomponentmappingflag: u32)>;
#[cfg(feature = "Win32_System_Power")]
pub type PDXGK_POWER_NOTIFICATION = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, newgrfxpowerstate: super::super::super::Win32::System::Power::DEVICE_POWER_STATE, prenotification: super::super::super::Win32::Foundation::BOOLEAN, privatehandle: *mut core::ffi::c_void)>;
pub type PDXGK_POWER_NOTIFICATION = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, newgrfxpowerstate: super::super::super::Win32::System::Power::DEVICE_POWER_STATE, prenotification: bool, privatehandle: *mut core::ffi::c_void)>;
pub type PDXGK_REMOVAL_NOTIFICATION = Option<unsafe extern "system" fn(graphicsdevicehandle: *mut core::ffi::c_void, privatehandle: *mut core::ffi::c_void)>;
pub type PDXGK_SET_SHARED_POWER_COMPONENT_STATE = Option<unsafe extern "system" fn(devicehandle: *mut core::ffi::c_void, privatehandle: *mut core::ffi::c_void, componentindex: u32, active: super::super::super::Win32::Foundation::BOOLEAN) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PDXGK_SET_SHARED_POWER_COMPONENT_STATE = Option<unsafe extern "system" fn(devicehandle: *mut core::ffi::c_void, privatehandle: *mut core::ffi::c_void, componentindex: u32, active: bool) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_ACQUIREKEYEDMUTEX = Option<unsafe extern "system" fn(param0: *mut D3DKMT_ACQUIREKEYEDMUTEX) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_ACQUIREKEYEDMUTEX2 = Option<unsafe extern "system" fn(param0: *mut D3DKMT_ACQUIREKEYEDMUTEX2) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_ADJUSTFULLSCREENGAMMA = Option<unsafe extern "system" fn(param0: *const D3DKMT_ADJUSTFULLSCREENGAMMA) -> super::super::super::Win32::Foundation::NTSTATUS>;
Expand All @@ -8836,7 +8836,7 @@ pub type PFND3DKMT_CANCELPRESENTS = Option<unsafe extern "system" fn(param0: *co
#[cfg(feature = "Win32_Graphics_Gdi")]
pub type PFND3DKMT_CHANGESURFACEPOINTER = Option<unsafe extern "system" fn(param0: *const D3DKMT_CHANGESURFACEPOINTER) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_CHANGEVIDEOMEMORYRESERVATION = Option<unsafe extern "system" fn(param0: *const D3DKMT_CHANGEVIDEOMEMORYRESERVATION) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_CHECKEXCLUSIVEOWNERSHIP = Option<unsafe extern "system" fn() -> super::super::super::Win32::Foundation::BOOLEAN>;
pub type PFND3DKMT_CHECKEXCLUSIVEOWNERSHIP = Option<unsafe extern "system" fn() -> bool>;
pub type PFND3DKMT_CHECKMONITORPOWERSTATE = Option<unsafe extern "system" fn(param0: *const D3DKMT_CHECKMONITORPOWERSTATE) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT = Option<unsafe extern "system" fn(param0: *mut D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT) -> super::super::super::Win32::Foundation::NTSTATUS>;
pub type PFND3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT2 = Option<unsafe extern "system" fn(param0: *mut D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT2) -> super::super::super::Win32::Foundation::NTSTATUS>;
Expand Down
Loading

0 comments on commit 2291719

Please sign in to comment.