Remove usage of String::from_str, deprecated in #6377

This commit is contained in:
Simon Sapin 2015-06-15 15:34:03 +02:00
parent 24af4c4ec6
commit 5428226e04
6 changed files with 11 additions and 13 deletions

View file

@ -36,7 +36,7 @@ pub fn command_line_init(argc: c_int, argv: *const *const u8) {
for i in 0..(argc as usize) {
let slice = ffi::CStr::from_ptr(*argv.offset(i as isize) as *const c_char);
let s = str::from_utf8(slice.to_bytes()).unwrap();
a.push(String::from_str(s));
a.push(s.to_owned());
}
let cl = command_line_new();
(*cl).argc = argc;

View file

@ -40,10 +40,9 @@ pub extern "C" fn cef_string_map_append(sm: *mut cef_string_map_t, key: *const c
if sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
slice_to_str((*key).str as *const u8, (*key).length as usize, |result| {
let s = String::from_str(result);
let csv = cef_string_userfree_utf16_alloc();
cef_string_utf16_set((*value).str as *const u16, (*value).length, csv, 1);
(*v).insert(s, csv);
(*v).insert(result.to_owned(), csv);
1
})
}
@ -55,7 +54,7 @@ pub extern "C" fn cef_string_map_find(sm: *mut cef_string_map_t, key: *const cef
if sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
slice_to_str((*key).str as *const u8, (*key).length as usize, |result| {
match (*v).get(&String::from_str(result)) {
match (*v).get(result) {
Some(s) => {
cef_string_utf16_set((**s).str as *const u16, (**s).length, value, 1);
1

View file

@ -44,7 +44,7 @@ pub extern "C" fn cef_string_multimap_find_count(smm: *mut cef_string_multimap_t
if smm.is_null() { return 0; }
let v = string_multimap_to_treemap(smm);
slice_to_str((*key).str as *const u8, (*key).length as usize, |result| {
match (*v).get(&String::from_str(result)) {
match (*v).get(result) {
Some(s) => s.len() as c_int,
None => 0
}
@ -58,12 +58,11 @@ pub extern "C" fn cef_string_multimap_append(smm: *mut cef_string_multimap_t, ke
if smm.is_null() { return 0; }
let v = string_multimap_to_treemap(smm);
slice_to_str((*key).str as *const u8, (*key).length as usize, |result| {
let s = String::from_str(result);
let csv = cef_string_userfree_utf16_alloc();
cef_string_utf16_set((*value).str as *const u16, (*value).length, csv, 1);
match (*v).get_mut(&s) {
match (*v).get_mut(result) {
Some(vc) => (*vc).push(csv),
None => { (*v).insert(s, vec!(csv)); }
None => { (*v).insert(result.to_owned(), vec!(csv)); }
}
1
})
@ -76,7 +75,7 @@ pub extern "C" fn cef_string_multimap_enumerate(smm: *mut cef_string_multimap_t,
if smm.is_null() { return 0; }
let v = string_multimap_to_treemap(smm);
slice_to_str((*key).str as *const u8, (*key).length as usize, |result| {
match (*v).get(&String::from_str(result)) {
match (*v).get(result) {
Some(s) => {
if (*s).len() <= index as usize {
return 0;