cargo fmt (and nothing else!)

This commit is contained in:
holger krekel
2019-07-22 17:12:09 +02:00
parent ff15754c1f
commit e5a9761233

View File

@@ -200,9 +200,8 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
addr = temp; addr = temp;
if !dc_may_be_valid_addr(addr) { if !dc_may_be_valid_addr(addr) {
(*qr_parsed).state = 400i32; (*qr_parsed).state = 400i32;
(*qr_parsed).text1 = dc_strdup( (*qr_parsed).text1 =
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);
);
OK_TO_CONTINUE = false; OK_TO_CONTINUE = false;
} }
} }
@@ -219,11 +218,8 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
} }
if OK_TO_CONTINUE { if OK_TO_CONTINUE {
if !fingerprint.is_null() { if !fingerprint.is_null() {
let peerstate = Peerstate::from_fingerprint( let peerstate =
context, Peerstate::from_fingerprint(context, &context.sql, as_str(fingerprint));
&context.sql,
as_str(fingerprint),
);
if addr.is_null() || invitenumber.is_null() || auth.is_null() { if addr.is_null() || invitenumber.is_null() || auth.is_null() {
if let Some(peerstate) = peerstate { if let Some(peerstate) = peerstate {
(*qr_parsed).state = 210i32; (*qr_parsed).state = 210i32;
@@ -248,13 +244,11 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
0 as *mut libc::c_int, 0 as *mut libc::c_int,
); );
device_msg = dc_mprintf( device_msg = dc_mprintf(
b"%s verified.\x00" as *const u8 b"%s verified.\x00" as *const u8 as *const libc::c_char,
as *const libc::c_char,
peerstate.addr, peerstate.addr,
) )
} else { } else {
(*qr_parsed).text1 = (*qr_parsed).text1 = dc_format_fingerprint_c(fingerprint);
dc_format_fingerprint_c(fingerprint);
(*qr_parsed).state = 230i32 (*qr_parsed).state = 230i32
} }
} else { } else {
@@ -285,14 +279,10 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
0x80i32, 0x80i32,
0 as *mut libc::c_int, 0 as *mut libc::c_int,
) )
} else if strstr( } else if strstr(qr, b"http://\x00" as *const u8 as *const libc::c_char)
qr, == qr as *mut libc::c_char
b"http://\x00" as *const u8 as *const libc::c_char, || strstr(qr, b"https://\x00" as *const u8 as *const libc::c_char)
) == qr as *mut libc::c_char == qr as *mut libc::c_char
|| strstr(
qr,
b"https://\x00" as *const u8 as *const libc::c_char,
) == qr as *mut libc::c_char
{ {
(*qr_parsed).state = 332i32; (*qr_parsed).state = 332i32;
(*qr_parsed).text1 = dc_strdup(qr) (*qr_parsed).text1 = dc_strdup(qr)
@@ -303,11 +293,8 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
if !device_msg.is_null() { if !device_msg.is_null() {
dc_add_device_msg(context, chat_id, device_msg); dc_add_device_msg(context, chat_id, device_msg);
} }
} }
} }
} }
} }
free(addr as *mut libc::c_void); free(addr as *mut libc::c_void);