mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
embedding: cef_string_multimap_size()
This commit is contained in:
parent
89fa3bb99a
commit
cc55f88496
1 changed files with 16 additions and 0 deletions
|
@ -10,6 +10,9 @@ use std::string::String;
|
|||
use string::{cef_string_userfree_utf8_alloc,cef_string_userfree_utf8_free,cef_string_utf8_set};
|
||||
use types::{cef_string_multimap_t,cef_string_t};
|
||||
|
||||
fn string_multimap_to_treemap(smm: *mut cef_string_multimap_t) -> *mut TreeMap<String, Vec<*mut cef_string_t>> {
|
||||
smm as *mut TreeMap<String, Vec<*mut cef_string_t>>
|
||||
}
|
||||
|
||||
//cef_string_multimap
|
||||
|
||||
|
@ -20,3 +23,16 @@ pub extern "C" fn cef_string_multimap_alloc() -> *mut cef_string_multimap_t {
|
|||
mem::transmute(smm)
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_multimap_size(smm: *mut cef_string_multimap_t) -> c_int {
|
||||
unsafe {
|
||||
if smm.is_null() { return 0; }
|
||||
let mut c: c_int = 0;
|
||||
let v = string_multimap_to_treemap(smm);
|
||||
for (_, val) in (*v).iter() {
|
||||
c = c + (*val).len() as c_int;
|
||||
}
|
||||
c
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue