Open aboseley opened 2 years ago
The ffi interface in the snappy examples doesn't match the c-library types in snappy-c.h.
Should the ffi interface use libc::c_char instead of u8
libc::c_char
u8
https://github.com/google/snappy/blob/main/snappy-c.h#L71
snappy_status snappy_compress(const char* input, size_t input_length, char* compressed, size_t* compressed_length);
example here https://doc.rust-lang.org/nomicon/ffi.html#calling-foreign-functions
fn snappy_compress(input: *const u8, input_length: size_t, compressed: *mut u8, compressed_length: *mut size_t) -> c_int;
Would it be clearer to have these function definition match then cast the pointer inside the rust function.
The ffi interface in the snappy examples doesn't match the c-library types in snappy-c.h.
Should the ffi interface use
libc::c_char
instead ofu8
https://github.com/google/snappy/blob/main/snappy-c.h#L71
example here https://doc.rust-lang.org/nomicon/ffi.html#calling-foreign-functions
Would it be clearer to have these function definition match then cast the pointer inside the rust function.