mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 06:56: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
@@ -16,12 +16,9 @@ pub unsafe fn charconv(
|
||||
) -> libc::c_int {
|
||||
assert!(!fromcode.is_null(), "invalid fromcode");
|
||||
assert!(!s.is_null(), "invalid input string");
|
||||
if let Some(encoding) = charset::Charset::for_label(
|
||||
CStr::from_ptr(fromcode)
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
.as_bytes(),
|
||||
) {
|
||||
if let Some(encoding) =
|
||||
charset::Charset::for_label(CStr::from_ptr(fromcode).to_string_lossy().as_bytes())
|
||||
{
|
||||
let data = std::slice::from_raw_parts(s as *const u8, strlen(s));
|
||||
|
||||
let (res, _, _) = encoding.decode(data);
|
||||
|
||||
@@ -1515,8 +1515,8 @@ pub unsafe fn mailmime_data_write_driver(
|
||||
}
|
||||
1 => {
|
||||
let filename = CStr::from_ptr((*mime_data).dt_data.dt_filename)
|
||||
.to_str()
|
||||
.unwrap_or_default();
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
if let Ok(file) = std::fs::File::open(filename) {
|
||||
if let Ok(mut text) = memmap::MmapOptions::new().map_copy(&file) {
|
||||
if 0 != (*mime_data).dt_encoded {
|
||||
|
||||
Reference in New Issue
Block a user