MCPcopy Create free account
hub / github.com/buger/jsonparser / appendUnicodeEscape

Function appendUnicodeEscape

json_fuzz_test.go:500–506  ·  view source on GitHub ↗

appendUnicodeEscape appends a `\uXXXX` escape sequence for the given code point to buf. Does NOT validate cp — callers use it for both valid BMP code points and for lone/invalid surrogates (which the parser must reject cleanly). cp must fit in 20 bits (the BMP range); higher bits are masked.

(buf *[]byte, cp int)

Source from the content-addressed store, hash-verified

498// code points and for lone/invalid surrogates (which the parser must reject
499// cleanly). cp must fit in 20 bits (the BMP range); higher bits are masked.
500func appendUnicodeEscape(buf *[]byte, cp int) {
501 *buf = append(*buf, '\\', 'u',
502 hexChars[(cp>>12)&0xF],
503 hexChars[(cp>>8)&0xF],
504 hexChars[(cp>>4)&0xF],
505 hexChars[cp&0xF])
506}
507
508// =============================================================================
509// JSON-aware mutation operators

Callers 2

genKeyFunction · 0.85
genStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected