Skip to content

Commit

Permalink
pcsc,pcsc-sys: make ctl_code const fn
Browse files Browse the repository at this point in the history
  • Loading branch information
unlimitedsola authored and bluetech committed Dec 12, 2024
1 parent 836ffab commit f2cd1ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pcsc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@ pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME: DWORD = SCARD_ATTR_DEVICE_FRIENDLY_NA
pub const SCARD_ATTR_DEVICE_SYSTEM_NAME: DWORD = SCARD_ATTR_DEVICE_SYSTEM_NAME_A;

#[cfg(target_os = "windows")]
pub fn SCARD_CTL_CODE(code: DWORD) -> DWORD {
pub const fn SCARD_CTL_CODE(code: DWORD) -> DWORD {
0x0031_0000 | (code << 2)
}
#[cfg(not(target_os = "windows"))]
pub fn SCARD_CTL_CODE(code: DWORD) -> DWORD {
pub const fn SCARD_CTL_CODE(code: DWORD) -> DWORD {
0x4200_0000 + code
}

Expand Down
2 changes: 1 addition & 1 deletion pcsc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ pub fn PNP_NOTIFICATION() -> &'static CStr {
/// to this function.
///
/// This function wraps the `SCARD_CTL_CODE` macro.
pub fn ctl_code(code: DWORD) -> DWORD {
pub const fn ctl_code(code: DWORD) -> DWORD {
ffi::SCARD_CTL_CODE(code)
}

Expand Down

0 comments on commit f2cd1ba

Please sign in to comment.