mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +03:00
systematically substitute "goto cleanup" logic without changing indentation
This commit is contained in:
44
src/dc_qr.rs
44
src/dc_qr.rs
@@ -21,7 +21,7 @@ use crate::x::*;
|
|||||||
// text1=URL
|
// text1=URL
|
||||||
// text1=error string
|
// text1=error string
|
||||||
pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc_lot_t {
|
pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc_lot_t {
|
||||||
let mut current_block: u64;
|
let mut OK_TO_CONTINUE = true;
|
||||||
let mut payload: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut payload: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
// must be normalized, if set
|
// must be normalized, if set
|
||||||
let mut addr: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut addr: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
@@ -86,7 +86,6 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
dc_param_unref(param);
|
dc_param_unref(param);
|
||||||
}
|
}
|
||||||
fingerprint = dc_normalize_fingerprint_c(payload);
|
fingerprint = dc_normalize_fingerprint_c(payload);
|
||||||
current_block = 5023038348526654800;
|
|
||||||
} else if strncasecmp(
|
} else if strncasecmp(
|
||||||
qr,
|
qr,
|
||||||
b"mailto:\x00" as *const u8 as *const libc::c_char,
|
b"mailto:\x00" as *const u8 as *const libc::c_char,
|
||||||
@@ -101,7 +100,6 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
*query = 0i32 as libc::c_char
|
*query = 0i32 as libc::c_char
|
||||||
}
|
}
|
||||||
addr = dc_strdup(payload);
|
addr = dc_strdup(payload);
|
||||||
current_block = 5023038348526654800;
|
|
||||||
} else if strncasecmp(
|
} else if strncasecmp(
|
||||||
qr,
|
qr,
|
||||||
b"SMTP:\x00" as *const u8 as *const libc::c_char,
|
b"SMTP:\x00" as *const u8 as *const libc::c_char,
|
||||||
@@ -116,7 +114,6 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
*colon = 0i32 as libc::c_char
|
*colon = 0i32 as libc::c_char
|
||||||
}
|
}
|
||||||
addr = dc_strdup(payload);
|
addr = dc_strdup(payload);
|
||||||
current_block = 5023038348526654800;
|
|
||||||
} else if strncasecmp(
|
} else if strncasecmp(
|
||||||
qr,
|
qr,
|
||||||
b"MATMSG:\x00" as *const u8 as *const libc::c_char,
|
b"MATMSG:\x00" as *const u8 as *const libc::c_char,
|
||||||
@@ -132,12 +129,11 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
if !semicolon.is_null() {
|
if !semicolon.is_null() {
|
||||||
*semicolon = 0i32 as libc::c_char
|
*semicolon = 0i32 as libc::c_char
|
||||||
}
|
}
|
||||||
current_block = 5023038348526654800;
|
|
||||||
} else {
|
} else {
|
||||||
(*qr_parsed).state = 400i32;
|
(*qr_parsed).state = 400i32;
|
||||||
(*qr_parsed).text1 =
|
(*qr_parsed).text1 =
|
||||||
dc_strdup(b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char);
|
dc_strdup(b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char);
|
||||||
current_block = 16562876845594826114;
|
OK_TO_CONTINUE = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if strncasecmp(
|
if strncasecmp(
|
||||||
@@ -190,11 +186,9 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
}
|
}
|
||||||
dc_free_splitted_lines(lines);
|
dc_free_splitted_lines(lines);
|
||||||
}
|
}
|
||||||
current_block = 5023038348526654800;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
if OK_TO_CONTINUE {
|
||||||
16562876845594826114 => {}
|
{
|
||||||
_ => {
|
|
||||||
/* check the parameters
|
/* check the parameters
|
||||||
---------------------- */
|
---------------------- */
|
||||||
if !addr.is_null() {
|
if !addr.is_null() {
|
||||||
@@ -210,16 +204,11 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
(*qr_parsed).text1 = dc_strdup(
|
(*qr_parsed).text1 = dc_strdup(
|
||||||
b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char,
|
b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
current_block = 16562876845594826114;
|
OK_TO_CONTINUE = false;
|
||||||
} else {
|
}
|
||||||
current_block = 14116432890150942211;
|
}
|
||||||
}
|
if OK_TO_CONTINUE {
|
||||||
} else {
|
{
|
||||||
current_block = 14116432890150942211;
|
|
||||||
}
|
|
||||||
match current_block {
|
|
||||||
16562876845594826114 => {}
|
|
||||||
_ => {
|
|
||||||
if !fingerprint.is_null() {
|
if !fingerprint.is_null() {
|
||||||
if strlen(fingerprint) != 40 {
|
if strlen(fingerprint) != 40 {
|
||||||
(*qr_parsed).state = 400i32;
|
(*qr_parsed).state = 400i32;
|
||||||
@@ -227,16 +216,11 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
b"Bad fingerprint length in QR code.\x00" as *const u8
|
b"Bad fingerprint length in QR code.\x00" as *const u8
|
||||||
as *const libc::c_char,
|
as *const libc::c_char,
|
||||||
);
|
);
|
||||||
current_block = 16562876845594826114;
|
OK_TO_CONTINUE = false;
|
||||||
} else {
|
}
|
||||||
current_block = 5409161009579131794;
|
}
|
||||||
}
|
if OK_TO_CONTINUE {
|
||||||
} else {
|
{
|
||||||
current_block = 5409161009579131794;
|
|
||||||
}
|
|
||||||
match current_block {
|
|
||||||
16562876845594826114 => {}
|
|
||||||
_ => {
|
|
||||||
if !fingerprint.is_null() {
|
if !fingerprint.is_null() {
|
||||||
let peerstate = Peerstate::from_fingerprint(
|
let peerstate = Peerstate::from_fingerprint(
|
||||||
context,
|
context,
|
||||||
|
|||||||
Reference in New Issue
Block a user