use enc.len() for cef_string_utf8_to_utf16 conversion size

This commit is contained in:
Mike Blumenkrantz 2014-10-13 01:32:32 -04:00
parent cb5d7b98bf
commit 62deac9346

View file

@ -98,7 +98,7 @@ pub extern "C" fn cef_string_utf8_to_utf16(src: *const u8, src_len: size_t, outp
unsafe { unsafe {
slice::raw::buf_as_slice(src, src_len as uint, |result| { slice::raw::buf_as_slice(src, src_len as uint, |result| {
let enc = str::from_utf8(result).unwrap().utf16_units().collect::<Vec<u16>>(); let enc = str::from_utf8(result).unwrap().utf16_units().collect::<Vec<u16>>();
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 1