From 0d21a68ee7679e1894bf66da2c5f5ed42ac8c36d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 17 Nov 2014 19:32:02 -0500 Subject: [PATCH] embedding: cef_string_ascii_to_utf16() --- ports/cef/string.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/cef/string.rs b/ports/cef/string.rs index e407efed52b..f71e7e67611 100644 --- a/ports/cef/string.rs +++ b/ports/cef/string.rs @@ -262,3 +262,11 @@ pub extern "C" fn cef_string_wide_to_utf8(src: *const wchar_t, src_len: size_t, }) } } + +#[no_mangle] +pub extern "C" fn cef_string_ascii_to_utf16(src: *const u8, src_len: size_t, output: *mut cef_string_utf16_t) -> c_int { + slice_to_str(src, src_len as uint, |result| { + let conv = result.utf16_units().collect::>(); + cef_string_utf16_set(conv.as_ptr(), conv.len() as size_t, output, 1) + }) +}