#[no_mangle]
pub unsafe extern "C" fn decoder_latin1_byte_compatible_up_to(
decoder: *const Decoder,
buffer: *const u8,
buffer_len: usize,
) -> usize
Expand description
Checks for compatibility with storing Unicode scalar values as unsigned bytes taking into account the state of the decoder.
Returns SIZE_MAX
if the decoder is not in a neutral state, including waiting
for the BOM, or if the encoding is never Latin1-byte-compatible.
Otherwise returns the index of the first byte whose unsigned value doesn’t directly correspond to the decoded Unicode scalar value, or the length of the input if all bytes in the input decode directly to scalar values corresponding to the unsigned byte values.
Does not change the state of the decoder.
Do not use this unless you are supporting SpiderMonkey/V8-style string storage optimizations.
§Undefined behavior
UB ensues if buffer
and *buffer_len
don’t designate a valid memory
block of if buffer
is NULL
.