mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
Make dc_msg_get_summarytext_by_raw safe (#316)
* Make dc_msg_get_summarytext_by_raw safe * use dc_truncate method in all places * Fix tests and add docs to dc_truncate() * Make text argument an AsRef<&str> and rename type_0 to viewtype * Fix too early return in dc_msg_get_summarytext_by_raw. Fixes https://github.com/deltachat/deltachat-core-rust/issues/313
This commit is contained in:
@@ -12,6 +12,7 @@ extern crate human_panic;
|
||||
extern crate num_traits;
|
||||
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
use std::convert::TryInto;
|
||||
use std::str::FromStr;
|
||||
|
||||
use deltachat::contact::Contact;
|
||||
@@ -1510,7 +1511,7 @@ pub unsafe extern "C" fn dc_msg_get_summarytext(
|
||||
) -> *mut libc::c_char {
|
||||
assert!(!msg.is_null());
|
||||
|
||||
dc_msg::dc_msg_get_summarytext(msg, approx_characters)
|
||||
dc_msg::dc_msg_get_summarytext(msg, approx_characters.try_into().unwrap())
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user