mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
embedding: implement cef_string_utf16_cmp()
This commit is contained in:
parent
8077edc062
commit
9fe95fc77e
1 changed files with 15 additions and 0 deletions
|
@ -167,6 +167,21 @@ pub extern "C" fn cef_string_utf16_set(src: *const c_ushort, src_len: size_t, ou
|
|||
return 1;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_utf16_cmp(a: *const cef_string_utf16_t, b: *const cef_string_utf16_t) -> c_int {
|
||||
unsafe {
|
||||
slice::raw::buf_as_slice(mem::transmute((*a).str), (*a).length as uint, |astr:&[u16]| {
|
||||
slice::raw::buf_as_slice(mem::transmute((*b).str), (*b).length as uint, |bstr:&[u16]| {
|
||||
match astr.cmp(&bstr) {
|
||||
Less => -1,
|
||||
Equal => 0,
|
||||
Greater => 1
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_wide_clear(cs: *mut cef_string_wide_t) {
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue