mirror of
https://github.com/servo/servo.git
synced 2025-07-13 10:23:40 +01:00
embedding: cef_string_map_find()
This commit is contained in:
parent
7199c6ea58
commit
1a007e19e7
1 changed files with 22 additions and 0 deletions
|
@ -54,3 +54,25 @@ pub extern "C" fn cef_string_map_append(sm: *mut cef_string_map_t, key: *const c
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_map_find(sm: *mut cef_string_map_t, key: *const cef_string_t, value: *mut cef_string_t) -> c_int {
|
||||
unsafe {
|
||||
if fptr_is_null(mem::transmute(sm)) { return 0; }
|
||||
let v = string_map_to_treemap(sm);
|
||||
slice::raw::buf_as_slice(mem::transmute((*key).str), (*key).length as uint, |result| {
|
||||
match str::from_utf8(result) {
|
||||
Some(k) => {
|
||||
match (*v).find(&String::from_str(k)) {
|
||||
Some(s) => {
|
||||
cef_string_utf8_set(mem::transmute((**s).str), (**s).length, value, 1);
|
||||
1
|
||||
}
|
||||
None => 0
|
||||
}
|
||||
},
|
||||
None => 0
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue