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

@@ -2136,7 +2136,7 @@ pub unsafe extern "C" fn dc_chat_get_profile_image(chat: *mut dc_chat_t) -> *mut
let ffi_context = &*ffi_chat.context;
ffi_context
.with_inner(|ctx| match ffi_chat.chat.get_profile_image(ctx) {
Some(p) => p.to_str().unwrap_or_default().to_string().strdup(),
Some(p) => p.to_string_lossy().strdup(),
None => ptr::null_mut(),
})
.unwrap_or_else(|_| ptr::null_mut())
@@ -2773,7 +2773,7 @@ pub unsafe extern "C" fn dc_contact_get_profile_image(
ffi_contact
.contact
.get_profile_image(ctx)
.map(|p| p.to_str().unwrap_or_default().to_string().strdup())
.map(|p| p.to_string_lossy().strdup())
.unwrap_or_else(|| std::ptr::null_mut())
})
.unwrap_or_else(|_| ptr::null_mut())