Skip to content

Commit

Permalink
Simple fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Narsil committed Jan 7, 2025
1 parent 08fc326 commit 34ed39c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ native-tls = { version = "0.2.12", optional = true }

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.59"
features = ["Win32_Foundation", "Win32_Storage_FileSystem"]
features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_IO"]
optional = true

[target.'cfg(unix)'.dependencies.libc]
Expand Down
6 changes: 2 additions & 4 deletions src/api/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mod windows {

pub(crate) fn lock(file: &std::fs::File) -> i32 {
unsafe {
let mut overlapped = mem::zeroed();
let mut overlapped = std::mem::zeroed();
let flags = LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY;
LockFileEx(
file.as_raw_handle() as HANDLE,
Expand All @@ -135,9 +135,7 @@ mod windows {
}
}
pub(crate) fn unlock(file: &std::fs::File) -> i32 {
unsafe {
UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0);
}
unsafe { UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0) }
}
}
#[cfg(target_family = "windows")]
Expand Down
6 changes: 2 additions & 4 deletions src/api/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mod windows {

pub(crate) fn lock(file: &tokio::fs::File) -> i32 {
unsafe {
let mut overlapped = mem::zeroed();
let mut overlapped = std::mem::zeroed();
let flags = LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY;
LockFileEx(
file.as_raw_handle() as HANDLE,
Expand All @@ -129,9 +129,7 @@ mod windows {
}
}
pub(crate) fn unlock(file: &tokio::fs::File) -> i32 {
unsafe {
UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0);
}
unsafe { UnlockFile(file.as_raw_handle() as HANDLE, 0, 0, !0, !0) }
}
}
#[cfg(target_family = "windows")]
Expand Down

0 comments on commit 34ed39c

Please sign in to comment.