Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to fsevent-sys 4.0.0 #322

Merged
merged 1 commit into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update to fsevent-sys 4.0.0
  • Loading branch information
erickt committed May 19, 2021
commit f9f318757e0387c67b7d0d7cbfce767b0631e160
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inotify = { version = "0.9", default-features = false }
mio = { version = "0.7.7", features = ["os-ext"] }

[target.'cfg(target_os="macos")'.dependencies]
fsevent-sys = "~3.1"
fsevent-sys = "4"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.8", features = ["fileapi", "handleapi", "ioapiset", "minwinbase", "synchapi", "winbase", "winnt"] }
Expand Down
19 changes: 9 additions & 10 deletions src/fsevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ impl FsEventWatcher {
extern "C" fn callback(
stream_ref: fs::FSEventStreamRef,
info: *mut libc::c_void,
num_events: libc::size_t, // size_t numEvents
event_paths: *mut libc::c_void, // void *eventPaths
event_flags: *const libc::c_void, // const FSEventStreamEventFlags eventFlags[]
event_ids: *const libc::c_void, // const FSEventStreamEventId eventIds[]
num_events: libc::size_t, // size_t numEvents
event_paths: *mut libc::c_void, // void *eventPaths
event_flags: *const fs::FSEventStreamEventFlags, // const FSEventStreamEventFlags eventFlags[]
event_ids: *const fs::FSEventStreamEventId, // const FSEventStreamEventId eventIds[]
) {
unsafe {
callback_impl(
Expand All @@ -489,13 +489,12 @@ extern "C" fn callback(
unsafe fn callback_impl(
_stream_ref: fs::FSEventStreamRef,
info: *mut libc::c_void,
num_events: libc::size_t, // size_t numEvents
event_paths: *mut libc::c_void, // void *eventPaths
event_flags: *const libc::c_void, // const FSEventStreamEventFlags eventFlags[]
_event_ids: *const libc::c_void, // const FSEventStreamEventId eventIds[]
num_events: libc::size_t, // size_t numEvents
event_paths: *mut libc::c_void, // void *eventPaths
event_flags: *const fs::FSEventStreamEventFlags, // const FSEventStreamEventFlags eventFlags[]
_event_ids: *const fs::FSEventStreamEventId, // const FSEventStreamEventId eventIds[]
) {
let event_paths = event_paths as *const *const libc::c_char;
let e_ptr = event_flags as *mut u32;
let info = info as *const StreamContextInfo;
let event_fn = &(*info).event_fn;

Expand All @@ -505,7 +504,7 @@ unsafe fn callback_impl(
.expect("Invalid UTF8 string.");
let path = PathBuf::from(path);

let flag = *e_ptr.add(p);
let flag = *event_flags.add(p);
let flag = StreamFlags::from_bits(flag).unwrap_or_else(|| {
panic!("Unable to decode StreamFlags: {}", flag);
});
Expand Down