mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
Pass is_html to Simplify.simplify() as bool
This commit is contained in:
committed by
holger krekel
parent
e3269616bd
commit
b7174783f1
@@ -1192,7 +1192,7 @@ unsafe fn dc_mimeparser_add_single_part_if_known(
|
|||||||
let simplified_txt = simplifier.unwrap().simplify(
|
let simplified_txt = simplifier.unwrap().simplify(
|
||||||
decoded_data,
|
decoded_data,
|
||||||
decoded_data_bytes as libc::c_int,
|
decoded_data_bytes as libc::c_int,
|
||||||
if mime_type == 70i32 { 1i32 } else { 0i32 },
|
mime_type == 70i32,
|
||||||
is_msgrmsg,
|
is_msgrmsg,
|
||||||
);
|
);
|
||||||
if !simplified_txt.is_null()
|
if !simplified_txt.is_null()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ impl 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: bool,
|
||||||
is_msgrmsg: libc::c_int,
|
is_msgrmsg: libc::c_int,
|
||||||
) -> *mut libc::c_char {
|
) -> *mut libc::c_char {
|
||||||
if in_bytes <= 0 {
|
if in_bytes <= 0 {
|
||||||
@@ -45,7 +45,7 @@ impl Simplify {
|
|||||||
if out.is_null() {
|
if out.is_null() {
|
||||||
return dc_strdup(b"\x00" as *const u8 as *const libc::c_char);
|
return dc_strdup(b"\x00" as *const u8 as *const libc::c_char);
|
||||||
}
|
}
|
||||||
if 0 != is_html {
|
if is_html {
|
||||||
temp = dc_dehtml(out);
|
temp = dc_dehtml(out);
|
||||||
if !temp.is_null() {
|
if !temp.is_null() {
|
||||||
free(out as *mut libc::c_void);
|
free(out as *mut libc::c_void);
|
||||||
@@ -271,7 +271,7 @@ mod tests {
|
|||||||
let html: *const libc::c_char =
|
let html: *const libc::c_char =
|
||||||
b"\r\r\nline1<br>\r\n\r\n\r\rline2\n\r\x00" as *const u8 as *const libc::c_char;
|
b"\r\r\nline1<br>\r\n\r\n\r\rline2\n\r\x00" as *const u8 as *const libc::c_char;
|
||||||
let plain: *mut libc::c_char =
|
let plain: *mut libc::c_char =
|
||||||
simplify.simplify(html, strlen(html) as libc::c_int, 1, 0);
|
simplify.simplify(html, strlen(html) as libc::c_int, true, 0);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
CStr::from_ptr(plain as *const libc::c_char)
|
CStr::from_ptr(plain as *const libc::c_char)
|
||||||
@@ -291,7 +291,7 @@ mod tests {
|
|||||||
let html: *const libc::c_char =
|
let html: *const libc::c_char =
|
||||||
b"<a href=url>text</a\x00" as *const u8 as *const libc::c_char;
|
b"<a href=url>text</a\x00" as *const u8 as *const libc::c_char;
|
||||||
let plain: *mut libc::c_char =
|
let plain: *mut libc::c_char =
|
||||||
simplify.simplify(html, strlen(html) as libc::c_int, 1, 0);
|
simplify.simplify(html, strlen(html) as libc::c_int, true, 0);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
CStr::from_ptr(plain as *const libc::c_char)
|
CStr::from_ptr(plain as *const libc::c_char)
|
||||||
@@ -312,7 +312,7 @@ mod tests {
|
|||||||
b"<!DOCTYPE name [<!DOCTYPE ...>]><!-- comment -->text <b><?php echo ... ?>bold</b><![CDATA[<>]]>\x00"
|
b"<!DOCTYPE name [<!DOCTYPE ...>]><!-- comment -->text <b><?php echo ... ?>bold</b><![CDATA[<>]]>\x00"
|
||||||
as *const u8 as *const libc::c_char;
|
as *const u8 as *const libc::c_char;
|
||||||
let plain: *mut libc::c_char =
|
let plain: *mut libc::c_char =
|
||||||
simplify.simplify(html, strlen(html) as libc::c_int, 1, 0);
|
simplify.simplify(html, strlen(html) as libc::c_int, true, 0);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
CStr::from_ptr(plain as *const libc::c_char)
|
CStr::from_ptr(plain as *const libc::c_char)
|
||||||
@@ -333,7 +333,7 @@ mod tests {
|
|||||||
b"<>"'& äÄöÖüÜß fooÆçÇ ♦&noent;‎‏‌‍\x00"
|
b"<>"'& äÄöÖüÜß fooÆçÇ ♦&noent;‎‏‌‍\x00"
|
||||||
as *const u8 as *const libc::c_char;
|
as *const u8 as *const libc::c_char;
|
||||||
let plain: *mut libc::c_char =
|
let plain: *mut libc::c_char =
|
||||||
simplify.simplify(html, strlen(html) as libc::c_int, 1, 0);
|
simplify.simplify(html, strlen(html) as libc::c_int, true, 0);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
strcmp(plain,
|
strcmp(plain,
|
||||||
|
|||||||
Reference in New Issue
Block a user