Skip to content

Commit e05da62

Browse files
authored
Merge pull request #43 from ldm0/main
Add `FSEventStreamSetDispatchQueue`, clippy fix
2 parents 9c259f7 + 5031204 commit e05da62

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

fsevent-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repository = "https://github.com/octplane/fsevent-rust/tree/master/fsevent-sys"
88
edition = "2018"
99

1010
[dependencies]
11+
dispatch2 = { version = "0.2.0", default-features = false, features = ["alloc"] }
1112
libc = "0.2.68"
1213

1314
[package.metadata.docs.rs]

fsevent-sys/src/core_foundation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ extern "C" {
148148

149149
pub unsafe fn str_path_to_cfstring_ref(source: &str, err: &mut CFErrorRef) -> CFStringRef {
150150
let c_path = CString::new(source).unwrap();
151-
let c_len = libc::strlen(c_path.as_ptr());
151+
let c_len = c_path.as_bytes().len();
152152
let mut url = CFURLCreateFromFileSystemRepresentation(
153153
kCFAllocatorDefault,
154154
c_path.as_ptr(),

fsevent-sys/src/fsevent.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::core_foundation::{
55
CFAllocatorReleaseCallBack, CFAllocatorRetainCallBack, CFArrayRef, CFIndex, CFRunLoopRef,
66
CFStringRef, CFTimeInterval,
77
};
8+
use dispatch2::ffi::dispatch_queue_t;
89
use libc::dev_t;
910
use std::os::raw::{c_uint, c_void};
1011

@@ -74,7 +75,7 @@ pub struct FSEventStreamContext {
7475

7576
// https://developer.apple.com/documentation/coreservices/file_system_events
7677
#[link(name = "CoreServices", kind = "framework")]
77-
extern "C" {
78+
unsafe extern "C" {
7879
pub fn FSEventStreamCopyDescription(stream_ref: ConstFSEventStreamRef) -> CFStringRef;
7980
pub fn FSEventStreamCopyPathsBeingWatched(streamRef: ConstFSEventStreamRef) -> CFArrayRef;
8081
pub fn FSEventStreamCreate(
@@ -109,7 +110,7 @@ extern "C" {
109110
run_loop: CFRunLoopRef,
110111
run_loop_mode: CFStringRef,
111112
);
112-
// pub fn FSEventStreamSetDispatchQueue(streamRef: FSEventStreamRef, q: DispatchQueue);
113+
pub fn FSEventStreamSetDispatchQueue(stream_ref: FSEventStreamRef, q: dispatch_queue_t);
113114
pub fn FSEventStreamSetExclusionPaths(
114115
stream_ref: FSEventStreamRef,
115116
paths_to_exclude: CFArrayRef,

fsevent-sys/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![cfg(target_os = "macos")]
2-
#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
32

43
pub mod core_foundation;
54
mod fsevent;

0 commit comments

Comments
 (0)