mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
embedding: cef_string_multimap_key()
This commit is contained in:
parent
85a099719e
commit
ce3e9fb511
1 changed files with 18 additions and 0 deletions
|
@ -96,3 +96,21 @@ pub extern "C" fn cef_string_multimap_enumerate(smm: *mut cef_string_multimap_t,
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_multimap_key(smm: *mut cef_string_multimap_t, index: c_int, value: *mut cef_string_t) -> c_int {
|
||||
unsafe {
|
||||
if index < 0 || smm.is_null() { return 0; }
|
||||
let v = string_multimap_to_treemap(smm);
|
||||
let mut rem = index as uint;
|
||||
|
||||
for (key, val) in (*v).iter() {
|
||||
if rem < (*val).len() {
|
||||
return cef_string_utf8_set((*key).as_bytes().as_ptr(), (*key).len() as u64, value, 1);
|
||||
} else {
|
||||
rem = rem - (*val).len();
|
||||
}
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue