mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
embedding: cef_string_map_size()
This commit is contained in:
parent
6dd1eca677
commit
e486fa52d5
1 changed files with 13 additions and 0 deletions
|
@ -12,6 +12,10 @@ use std::string::String;
|
|||
use string::{cef_string_userfree_utf8_alloc,cef_string_userfree_utf8_free,cef_string_utf8_set};
|
||||
use types::{cef_string_map_t,cef_string_t};
|
||||
|
||||
fn string_map_to_treemap(sm: *mut cef_string_map_t) -> *mut TreeMap<String, *mut cef_string_t> {
|
||||
sm as *mut TreeMap<String, *mut cef_string_t>
|
||||
}
|
||||
|
||||
//cef_string_map
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -21,3 +25,12 @@ pub extern "C" fn cef_string_map_alloc() -> *mut cef_string_map_t {
|
|||
mem::transmute(sm)
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_map_size(sm: *mut cef_string_map_t) -> c_int {
|
||||
unsafe {
|
||||
if fptr_is_null(mem::transmute(sm)) { return 0; }
|
||||
let v = string_map_to_treemap(sm);
|
||||
(*v).len() as c_int
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue