|
|
@ -50,14 +50,7 @@ impl SliceTransform { |
|
|
|
cb as *mut c_void, |
|
|
|
cb as *mut c_void, |
|
|
|
Some(slice_transform_destructor_callback), |
|
|
|
Some(slice_transform_destructor_callback), |
|
|
|
Some(transform_callback), |
|
|
|
Some(transform_callback), |
|
|
|
// this is ugly, but I can't get the compiler
|
|
|
|
Some(in_domain_callback), |
|
|
|
// not to barf with "expected fn pointer, found fn item"
|
|
|
|
|
|
|
|
// without this. sorry.
|
|
|
|
|
|
|
|
if in_domain_fn.is_some() { |
|
|
|
|
|
|
|
Some(in_domain_callback) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
None |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// this None points to the deprecated InRange callback
|
|
|
|
// this None points to the deprecated InRange callback
|
|
|
|
None, |
|
|
|
None, |
|
|
|
Some(slice_transform_name_callback), |
|
|
|
Some(slice_transform_name_callback), |
|
|
@ -118,6 +111,9 @@ pub unsafe extern "C" fn in_domain_callback( |
|
|
|
) -> u8 { |
|
|
|
) -> u8 { |
|
|
|
let cb = &mut *(raw_cb as *mut TransformCallback); |
|
|
|
let cb = &mut *(raw_cb as *mut TransformCallback); |
|
|
|
let key = slice::from_raw_parts(raw_key as *const u8, key_len as usize); |
|
|
|
let key = slice::from_raw_parts(raw_key as *const u8, key_len as usize); |
|
|
|
let in_domain = cb.in_domain_fn.unwrap(); |
|
|
|
if let Some(in_domain) = cb.in_domain_fn { |
|
|
|
in_domain(key) as u8 |
|
|
|
in_domain(key) as u8 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
0xff |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|