Skip to content

Commit

Permalink
Update to fsevent-sys 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpr03 committed May 21, 2021
2 parents c071f0e + f9f3187 commit fb8a5cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
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

0 comments on commit fb8a5cb

Please sign in to comment.