Lines Matching refs:buf

62 trim_nuls(const unsigned char *buf, size_t nbytes)  in trim_nuls()  argument
64 while (nbytes > 1 && buf[nbytes - 1] == '\0') in trim_nuls()
110 const unsigned char *buf = CAST(const unsigned char *, b->fbuf); in file_ascmagic_with_encoding() local
133 nbytes = trim_nuls(buf, nbytes); in file_ascmagic_with_encoding()
338 encode_utf8(unsigned char *buf, size_t len, file_unichar_t *ubuf, size_t ulen) in encode_utf8() argument
341 unsigned char *end = buf + len; in encode_utf8()
345 if (end - buf < 1) in encode_utf8()
347 *buf++ = CAST(unsigned char, ubuf[i]); in encode_utf8()
351 if (end - buf < 2) in encode_utf8()
353 *buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0); in encode_utf8()
357 if (end - buf < 3) in encode_utf8()
359 *buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0); in encode_utf8()
363 if (end - buf < 4) in encode_utf8()
365 *buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0); in encode_utf8()
369 if (end - buf < 5) in encode_utf8()
371 *buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8); in encode_utf8()
375 if (end - buf < 6) in encode_utf8()
377 *buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc); in encode_utf8()
382 out5: *buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80); in encode_utf8()
383 out4: *buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80); in encode_utf8()
384 out3: *buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80); in encode_utf8()
385 out2: *buf++ = CAST(unsigned char, ((ubuf[i] >> 6) & 0x3f) + 0x80); in encode_utf8()
386 out1: *buf++ = CAST(unsigned char, ((ubuf[i] >> 0) & 0x3f) + 0x80); in encode_utf8()
389 return buf; in encode_utf8()