mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 14:36:29 +03:00
use .to_string_lossy() member of Path, CStr etc.
instead of calling to_str().unwrap_or_default().
This commit is contained in:
committed by
holger krekel
parent
e251c7b1c8
commit
db2064de14
@@ -79,19 +79,13 @@ impl Aheader {
|
||||
let optional_field = unsafe { (*field).fld_data.fld_optional_field };
|
||||
if !optional_field.is_null()
|
||||
&& unsafe { !(*optional_field).fld_name.is_null() }
|
||||
&& unsafe {
|
||||
CStr::from_ptr((*optional_field).fld_name)
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
} == "Autocrypt"
|
||||
&& unsafe { CStr::from_ptr((*optional_field).fld_name).to_string_lossy() }
|
||||
== "Autocrypt"
|
||||
{
|
||||
let value = unsafe {
|
||||
CStr::from_ptr((*optional_field).fld_value)
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
};
|
||||
let value =
|
||||
unsafe { CStr::from_ptr((*optional_field).fld_value).to_string_lossy() };
|
||||
|
||||
if let Ok(test) = Self::from_str(value) {
|
||||
if let Ok(test) = Self::from_str(&value) {
|
||||
if addr_cmp(&test.addr, wanted_from) {
|
||||
if fine_header.is_none() {
|
||||
fine_header = Some(test);
|
||||
|
||||
@@ -620,12 +620,9 @@ impl<'a> MimeParser<'a> {
|
||||
&& strcmp(charset, b"utf-8\x00" as *const u8 as *const libc::c_char) != 0i32
|
||||
&& strcmp(charset, b"UTF-8\x00" as *const u8 as *const libc::c_char) != 0i32
|
||||
{
|
||||
if let Some(encoding) = Charset::for_label(
|
||||
CStr::from_ptr(charset)
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
.as_bytes(),
|
||||
) {
|
||||
if let Some(encoding) =
|
||||
Charset::for_label(CStr::from_ptr(charset).to_string_lossy().as_bytes())
|
||||
{
|
||||
let (res, _, _) = encoding.decode(&decoded_data);
|
||||
if res.is_empty() {
|
||||
/* no error - but nothing to add */
|
||||
|
||||
Reference in New Issue
Block a user