From 62deac93461b822547ed2712af0ca267941d1b46 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 Oct 2014 01:32:32 -0400 Subject: [PATCH] use enc.len() for cef_string_utf8_to_utf16 conversion size --- ports/cef/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/cef/string.rs b/ports/cef/string.rs index 47505f2a038..dd1e7ae5c51 100644 --- a/ports/cef/string.rs +++ b/ports/cef/string.rs @@ -98,7 +98,7 @@ pub extern "C" fn cef_string_utf8_to_utf16(src: *const u8, src_len: size_t, outp unsafe { slice::raw::buf_as_slice(src, src_len as uint, |result| { let enc = str::from_utf8(result).unwrap().utf16_units().collect::>(); - cef_string_utf16_set(enc.as_ptr(), (src_len * 2) as size_t, output, 1); + cef_string_utf16_set(enc.as_ptr(), enc.len() as size_t, output, 1); }); } 1