mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
Merge pull request #298 from deltachat/remove_gotos_dc_strencode
Remove gotos from dc_strencode
This commit is contained in:
@@ -120,97 +120,90 @@ fn hex_2_int(ch: libc::c_char) -> libc::c_char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut libc::c_char {
|
pub unsafe fn dc_encode_header_words(to_encode: *const libc::c_char) -> *mut libc::c_char {
|
||||||
let mut current_block: u64;
|
let mut ok_to_continue = true;
|
||||||
let mut ret_str: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut ret_str: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let mut cur: *const libc::c_char = to_encode;
|
let mut cur: *const libc::c_char = to_encode;
|
||||||
let mmapstr: *mut MMAPString = mmap_string_new(b"\x00" as *const u8 as *const libc::c_char);
|
let mmapstr: *mut MMAPString = mmap_string_new(b"\x00" as *const u8 as *const libc::c_char);
|
||||||
if to_encode.is_null() || mmapstr.is_null() {
|
if to_encode.is_null() || mmapstr.is_null() {
|
||||||
current_block = 8550051112593613029;
|
ok_to_continue = false;
|
||||||
} else {
|
|
||||||
current_block = 4644295000439058019;
|
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
match current_block {
|
if !ok_to_continue {
|
||||||
8550051112593613029 => {
|
if !mmapstr.is_null() {
|
||||||
if !mmapstr.is_null() {
|
mmap_string_free(mmapstr);
|
||||||
mmap_string_free(mmapstr);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
_ => {
|
break;
|
||||||
if *cur as libc::c_int != '\u{0}' as i32 {
|
} else {
|
||||||
let begin: *const libc::c_char;
|
if *cur as libc::c_int != '\u{0}' as i32 {
|
||||||
let mut end: *const libc::c_char;
|
let begin: *const libc::c_char;
|
||||||
let mut do_quote: bool;
|
let mut end: *const libc::c_char;
|
||||||
let mut quote_words: libc::c_int;
|
let mut do_quote: bool;
|
||||||
begin = cur;
|
let mut quote_words: libc::c_int;
|
||||||
end = begin;
|
begin = cur;
|
||||||
quote_words = 0i32;
|
end = begin;
|
||||||
do_quote = true;
|
quote_words = 0i32;
|
||||||
while *cur as libc::c_int != '\u{0}' as i32 {
|
do_quote = true;
|
||||||
get_word(cur, &mut cur, &mut do_quote);
|
while *cur as libc::c_int != '\u{0}' as i32 {
|
||||||
if !do_quote {
|
get_word(cur, &mut cur, &mut do_quote);
|
||||||
break;
|
if !do_quote {
|
||||||
}
|
break;
|
||||||
quote_words = 1i32;
|
|
||||||
end = cur;
|
|
||||||
if *cur as libc::c_int != '\u{0}' as i32 {
|
|
||||||
cur = cur.offset(1isize)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if 0 != quote_words {
|
quote_words = 1i32;
|
||||||
if !quote_word(
|
end = cur;
|
||||||
b"utf-8\x00" as *const u8 as *const libc::c_char,
|
if *cur as libc::c_int != '\u{0}' as i32 {
|
||||||
mmapstr,
|
cur = cur.offset(1isize)
|
||||||
begin,
|
}
|
||||||
end.wrapping_offset_from(begin) as size_t,
|
}
|
||||||
) {
|
if 0 != quote_words {
|
||||||
current_block = 8550051112593613029;
|
if !quote_word(
|
||||||
continue;
|
b"utf-8\x00" as *const u8 as *const libc::c_char,
|
||||||
}
|
|
||||||
if *end as libc::c_int == ' ' as i32 || *end as libc::c_int == '\t' as i32 {
|
|
||||||
if mmap_string_append_c(mmapstr, *end).is_null() {
|
|
||||||
current_block = 8550051112593613029;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
end = end.offset(1isize)
|
|
||||||
}
|
|
||||||
if *end as libc::c_int != '\u{0}' as i32 {
|
|
||||||
if mmap_string_append_len(
|
|
||||||
mmapstr,
|
|
||||||
end,
|
|
||||||
cur.wrapping_offset_from(end) as size_t,
|
|
||||||
)
|
|
||||||
.is_null()
|
|
||||||
{
|
|
||||||
current_block = 8550051112593613029;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if mmap_string_append_len(
|
|
||||||
mmapstr,
|
mmapstr,
|
||||||
begin,
|
begin,
|
||||||
cur.wrapping_offset_from(begin) as size_t,
|
end.wrapping_offset_from(begin) as size_t,
|
||||||
)
|
) {
|
||||||
.is_null()
|
ok_to_continue = false;
|
||||||
{
|
|
||||||
current_block = 8550051112593613029;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if !(*cur as libc::c_int == ' ' as i32 || *cur as libc::c_int == '\t' as i32) {
|
if *end as libc::c_int == ' ' as i32 || *end as libc::c_int == '\t' as i32 {
|
||||||
current_block = 4644295000439058019;
|
if mmap_string_append_c(mmapstr, *end).is_null() {
|
||||||
continue;
|
ok_to_continue = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
end = end.offset(1isize)
|
||||||
}
|
}
|
||||||
if mmap_string_append_c(mmapstr, *cur).is_null() {
|
if *end as libc::c_int != '\u{0}' as i32 {
|
||||||
current_block = 8550051112593613029;
|
if mmap_string_append_len(
|
||||||
continue;
|
mmapstr,
|
||||||
|
end,
|
||||||
|
cur.wrapping_offset_from(end) as size_t,
|
||||||
|
)
|
||||||
|
.is_null()
|
||||||
|
{
|
||||||
|
ok_to_continue = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cur = cur.offset(1isize);
|
} else if mmap_string_append_len(
|
||||||
current_block = 4644295000439058019;
|
mmapstr,
|
||||||
} else {
|
begin,
|
||||||
ret_str = strdup((*mmapstr).str_0);
|
cur.wrapping_offset_from(begin) as size_t,
|
||||||
current_block = 8550051112593613029;
|
)
|
||||||
|
.is_null()
|
||||||
|
{
|
||||||
|
ok_to_continue = false;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if !(*cur as libc::c_int == ' ' as i32 || *cur as libc::c_int == '\t' as i32) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if mmap_string_append_c(mmapstr, *cur).is_null() {
|
||||||
|
ok_to_continue = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cur = cur.offset(1isize);
|
||||||
|
} else {
|
||||||
|
ret_str = strdup((*mmapstr).str_0);
|
||||||
|
ok_to_continue = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user