use .to_string_lossy() member of Path, CStr etc.

instead of calling to_str().unwrap_or_default().
This commit is contained in:
B. Petersen
2019-10-05 15:26:14 +02:00
committed by holger krekel
parent e251c7b1c8
commit db2064de14
5 changed files with 15 additions and 27 deletions

View File

@@ -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 {