mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
Use bool for Simplify members
This commit is contained in:
committed by
holger krekel
parent
64051fca10
commit
e3269616bd
@@ -1208,7 +1208,7 @@ unsafe fn dc_mimeparser_add_single_part_if_known(
|
|||||||
} else {
|
} else {
|
||||||
free(simplified_txt as *mut libc::c_void);
|
free(simplified_txt as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
if 0 != simplifier.unwrap().is_forwarded {
|
if simplifier.unwrap().is_forwarded {
|
||||||
mimeparser.is_forwarded = 1i32
|
mimeparser.is_forwarded = 1i32
|
||||||
}
|
}
|
||||||
current_block = 10261677128829721533;
|
current_block = 10261677128829721533;
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ use crate::x::*;
|
|||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Simplify {
|
pub struct Simplify {
|
||||||
pub is_forwarded: libc::c_int,
|
pub is_forwarded: bool,
|
||||||
pub is_cut_at_begin: libc::c_int,
|
pub is_cut_at_begin: bool,
|
||||||
pub is_cut_at_end: libc::c_int,
|
pub is_cut_at_end: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Simplify {
|
impl Simplify {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Simplify {
|
Simplify {
|
||||||
is_forwarded: 0,
|
is_forwarded: false,
|
||||||
is_cut_at_begin: 0,
|
is_cut_at_begin: false,
|
||||||
is_cut_at_end: 0,
|
is_cut_at_end: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,9 +35,9 @@ impl Simplify {
|
|||||||
/* 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;
|
||||||
self.is_forwarded = 0i32;
|
self.is_forwarded = false;
|
||||||
self.is_cut_at_begin = 0i32;
|
self.is_cut_at_begin = false;
|
||||||
self.is_cut_at_end = 0i32;
|
self.is_cut_at_end = false;
|
||||||
out = strndup(
|
out = strndup(
|
||||||
in_unterminated as *mut libc::c_char,
|
in_unterminated as *mut libc::c_char,
|
||||||
in_bytes as libc::c_ulong,
|
in_bytes as libc::c_ulong,
|
||||||
@@ -95,7 +95,7 @@ impl Simplify {
|
|||||||
|| strcmp(line, b"----\x00" as *const u8 as *const libc::c_char) == 0i32
|
|| strcmp(line, b"----\x00" as *const u8 as *const libc::c_char) == 0i32
|
||||||
{
|
{
|
||||||
footer_mark = 1i32;
|
footer_mark = 1i32;
|
||||||
self.is_cut_at_end = 1i32
|
self.is_cut_at_end = true
|
||||||
}
|
}
|
||||||
if 0 != footer_mark {
|
if 0 != footer_mark {
|
||||||
l_last = l;
|
l_last = l;
|
||||||
@@ -114,7 +114,7 @@ impl Simplify {
|
|||||||
&& strncmp(line1, b"From: \x00" as *const u8 as *const libc::c_char, 6) == 0i32
|
&& strncmp(line1, b"From: \x00" as *const u8 as *const libc::c_char, 6) == 0i32
|
||||||
&& *line2.offset(0isize) as libc::c_int == 0i32
|
&& *line2.offset(0isize) as libc::c_int == 0i32
|
||||||
{
|
{
|
||||||
self.is_forwarded = 1i32;
|
self.is_forwarded = true;
|
||||||
l_first += 3
|
l_first += 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ impl Simplify {
|
|||||||
|| strncmp(line, b"~~~~~\x00" as *const u8 as *const libc::c_char, 5) == 0i32
|
|| strncmp(line, b"~~~~~\x00" as *const u8 as *const libc::c_char, 5) == 0i32
|
||||||
{
|
{
|
||||||
l_last = l;
|
l_last = l;
|
||||||
self.is_cut_at_end = 1i32;
|
self.is_cut_at_end = true;
|
||||||
/* done */
|
/* done */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ impl Simplify {
|
|||||||
}
|
}
|
||||||
if l_lastQuotedLine.is_some() {
|
if l_lastQuotedLine.is_some() {
|
||||||
l_last = l_lastQuotedLine.unwrap();
|
l_last = l_lastQuotedLine.unwrap();
|
||||||
self.is_cut_at_end = 1i32;
|
self.is_cut_at_end = true;
|
||||||
if l_last > 1 {
|
if l_last > 1 {
|
||||||
if is_empty_line(lines[l_last - 1]) {
|
if is_empty_line(lines[l_last - 1]) {
|
||||||
l_last -= 1
|
l_last -= 1
|
||||||
@@ -179,12 +179,12 @@ impl Simplify {
|
|||||||
}
|
}
|
||||||
if l_lastQuotedLine_0.is_some() {
|
if l_lastQuotedLine_0.is_some() {
|
||||||
l_first = l_lastQuotedLine_0.unwrap() + 1;
|
l_first = l_lastQuotedLine_0.unwrap() + 1;
|
||||||
self.is_cut_at_begin = 1i32
|
self.is_cut_at_begin = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* re-create buffer from the remaining lines */
|
/* re-create buffer from the remaining lines */
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
if 0 != self.is_cut_at_begin {
|
if self.is_cut_at_begin {
|
||||||
ret += "[...]";
|
ret += "[...]";
|
||||||
}
|
}
|
||||||
/* we write empty lines only in case and non-empty line follows */
|
/* we write empty lines only in case and non-empty line follows */
|
||||||
@@ -210,7 +210,7 @@ impl Simplify {
|
|||||||
pending_linebreaks = 1i32
|
pending_linebreaks = 1i32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if 0 != self.is_cut_at_end && (0 == self.is_cut_at_begin || 0 != content_lines_added) {
|
if self.is_cut_at_end && (!self.is_cut_at_begin || 0 != content_lines_added) {
|
||||||
ret += " [...]";
|
ret += " [...]";
|
||||||
}
|
}
|
||||||
dc_free_splitted_lines(lines);
|
dc_free_splitted_lines(lines);
|
||||||
|
|||||||
Reference in New Issue
Block a user