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

View File

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