address three comments from @dignifiedquire

This commit is contained in:
holger krekel
2019-09-22 22:06:25 +02:00
parent 1e80cfc72f
commit 829a7b5c72
2 changed files with 5 additions and 3 deletions

View File

@@ -909,7 +909,7 @@ unsafe fn import_self_keys(context: &Context, dir_name: *const libc::c_char) ->
} }
} }
set_default = 1; set_default = 1;
if name_f.find("legacy").is_some() { if name_f.contains("legacy") {
info!( info!(
context, context,
"Treating \"{}\" as a legacy private key.", "Treating \"{}\" as a legacy private key.",

View File

@@ -788,8 +788,10 @@ fn build_body_text(text: &str) -> *mut mailmime {
} }
fn set_body_text(part: *mut mailmime, text: &str) { fn set_body_text(part: *mut mailmime, text: &str) {
use libc::strlen;
unsafe { unsafe {
mailmime_set_body_text(part, text.strdup(), text.len()); let text_c = text.strdup();
mailmime_set_body_text(part, text_c, strlen(text_c));
} }
} }
@@ -909,7 +911,7 @@ fn build_body_file(context: &Context, msg: &Message, base_name: &str) -> (*mut m
pub(crate) fn vec_contains_lowercase(vec: &Vec<String>, part: &str) -> bool { pub(crate) fn vec_contains_lowercase(vec: &Vec<String>, part: &str) -> bool {
let partlc = part.to_lowercase(); let partlc = part.to_lowercase();
for cur in vec.iter() { for cur in vec.iter() {
if (*cur).to_lowercase() == partlc { if cur.to_lowercase() == partlc {
return true; return true;
} }
} }