embedding: implement cef_string_utf16_cmp()

This commit is contained in:
Mike Blumenkrantz 2014-10-13 06:32:50 -04:00
parent 8077edc062
commit 9fe95fc77e

View file

@ -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 {