cargo fmt

This commit is contained in:
Alexander Krotov
2019-07-25 20:29:28 +03:00
committed by holger krekel
parent 2f204fd2aa
commit c7ebf6de09
2 changed files with 265 additions and 273 deletions

View File

@@ -1178,14 +1178,10 @@ unsafe fn dc_mimeparser_add_single_part_if_known(
let charset: *const libc::c_char =
mailmime_content_charset_get((*mime).mm_content_type);
if !charset.is_null()
&& strcmp(
charset,
b"utf-8\x00" as *const u8 as *const libc::c_char,
) != 0i32
&& strcmp(
charset,
b"UTF-8\x00" as *const u8 as *const libc::c_char,
) != 0i32
&& strcmp(charset, b"utf-8\x00" as *const u8 as *const libc::c_char)
!= 0i32
&& strcmp(charset, b"UTF-8\x00" as *const u8 as *const libc::c_char)
!= 0i32
{
if let Some(encoding) = Charset::for_label(
CStr::from_ptr(charset).to_str().unwrap().as_bytes(),
@@ -1221,11 +1217,9 @@ unsafe fn dc_mimeparser_add_single_part_if_known(
8795901732489102124 => {}
_ => {
/* check header directly as is_send_by_messenger is not yet set up */
let is_msgrmsg: libc::c_int =
(dc_mimeparser_lookup_optional_field(
let is_msgrmsg: libc::c_int = (dc_mimeparser_lookup_optional_field(
&mimeparser,
b"Chat-Version\x00" as *const u8
as *const libc::c_char,
b"Chat-Version\x00" as *const u8 as *const libc::c_char,
) != 0 as *mut libc::c_void
as *mut mailimf_optional_field)
as libc::c_int;
@@ -1243,10 +1237,8 @@ unsafe fn dc_mimeparser_add_single_part_if_known(
(*part).type_0 = 10i32;
(*part).int_mimetype = mime_type;
(*part).msg = simplified_txt;
(*part).msg_raw = strndup(
decoded_data,
decoded_data_bytes as libc::c_ulong,
);
(*part).msg_raw =
strndup(decoded_data, decoded_data_bytes as libc::c_ulong);
do_add_single_part(mimeparser, part);
part = 0 as *mut dc_mimepart_t
} else {

View File

@@ -20,13 +20,13 @@ impl dc_simplify_t {
}
}
pub unsafe fn simplify(
pub unsafe fn simplify(
&mut self,
in_unterminated: *const libc::c_char,
in_bytes: libc::c_int,
is_html: libc::c_int,
is_msgrmsg: libc::c_int,
) -> *mut libc::c_char {
) -> *mut libc::c_char {
/* create a copy of the given buffer */
let mut out: *mut libc::c_char;
let mut temp: *mut libc::c_char;
@@ -56,16 +56,16 @@ pub unsafe fn simplify(
dc_remove_cr_chars(out);
out
}
}
/**
/**
* Simplify Plain Text
*/
unsafe fn simplify_plain_text(
unsafe fn simplify_plain_text(
&mut self,
buf_terminated: *const libc::c_char,
is_msgrmsg: libc::c_int,
) -> *mut libc::c_char {
) -> *mut libc::c_char {
/* This function ...
... removes all text after the line `-- ` (footer mark)
... removes full quotes at the beginning and at the end of the text -
@@ -229,7 +229,7 @@ unsafe fn simplify_plain_text(
dc_free_splitted_lines(lines);
to_cstring(ret)
}
}
}
/* Simplify and normalise text: Remove quotes, signatures, unnecessary