Function mozjs_sys::jsapi::JS_DecodeBytes

source ยท
pub unsafe extern "C" fn JS_DecodeBytes(
    cx: *mut JSContext,
    src: *const c_char,
    srclen: usize,
    dst: *mut u16,
    dstlenp: *mut usize,
) -> bool
Expand description

For JS_DecodeBytes, set *dstlenp to the size of the destination buffer before the call; on return, *dstlenp contains the number of characters actually stored. To determine the necessary destination buffer size, make a sizing call that passes nullptr for dst.

On errors, the functions report the error. In that case, *dstlenp contains the number of characters or bytes transferred so far. If cx is nullptr, no error is reported on failure, and the functions simply return false.

NB: This function does not store an additional zero byte or char16_t after the transcoded string.