mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 14:26:30 +03:00
Remove unsafe CString::yolo from ffi
CString::yolo was still used in the ffi, this was an unsafe transitional thing. To remove it there were two choices: 1. make errors in creating CStrings hard errors or 2. try and be as lenient as possible. Given the to_string_lossy() convention adopted in the ffi this choose the lenient option and simply skips over embedded null bytes, leaving the rest of the strings intact. Thus now CString::new_lossy(). It's only used for .strdup() however so no longer a public trait. This also cleans up the public visibility of things in the strings.rs file: - Rename StrExt/OptStrExt traits to what they actually do: provide .strdup() -> Strdup/OptStrdup. - dc_strdup() should be an implementation detail, replace all usages with Strdup.strdup() method. - Only allow visibility inside the crate for all things. - Reduce visibility to only the module for things not used in lib.rs.
This commit is contained in:
committed by
Floris Bruynooghe
parent
a7afbf85ad
commit
50569f12f5
@@ -44,9 +44,9 @@ fn stress_functions(context: &Context) {
|
||||
// assert!(dc_is_configured(context) != 0, "Missing configured context");
|
||||
|
||||
// let setupcode = dc_create_setup_code(context);
|
||||
// let setupcode_c = CString::yolo(setupcode.clone());
|
||||
// let setupcode_c = CString::new(setupcode.clone()).unwrap();
|
||||
// let setupfile = dc_render_setup_file(context, &setupcode).unwrap();
|
||||
// let setupfile_c = CString::yolo(setupfile);
|
||||
// let setupfile_c = CString::new(setupfile).unwrap();
|
||||
// let mut headerline_2: *const libc::c_char = ptr::null();
|
||||
// let payload = dc_decrypt_setup_file(context, setupcode_c.as_ptr(), setupfile_c.as_ptr());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user