Lines Matching refs:buf
61 trim_nuls(const unsigned char *buf, size_t nbytes) in trim_nuls() argument
63 while (nbytes > 1 && buf[nbytes - 1] == '\0') in trim_nuls()
109 const unsigned char *buf = CAST(const unsigned char *, b->fbuf); in file_ascmagic_with_encoding() local
132 nbytes = trim_nuls(buf, nbytes); in file_ascmagic_with_encoding()
338 encode_utf8(unsigned char *buf, size_t len, unicodechar *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()
349 if (end - buf < 2) in encode_utf8()
351 *buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0); in encode_utf8()
352 *buf++ = CAST(unsigned char, (ubuf[i] & 0x3f) + 0x80); in encode_utf8()
354 if (end - buf < 3) in encode_utf8()
356 *buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0); in encode_utf8()
357 *buf++ = CAST(unsigned char, ((ubuf[i] >> 6) & 0x3f) + 0x80); in encode_utf8()
358 *buf++ = CAST(unsigned char, (ubuf[i] & 0x3f) + 0x80); in encode_utf8()
360 if (end - buf < 4) in encode_utf8()
362 *buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0); in encode_utf8()
363 *buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80); in encode_utf8()
364 *buf++ = CAST(unsigned char, ((ubuf[i] >> 6) & 0x3f) + 0x80); in encode_utf8()
365 *buf++ = CAST(unsigned char, (ubuf[i] & 0x3f) + 0x80); in encode_utf8()
367 if (end - buf < 5) in encode_utf8()
369 *buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8); in encode_utf8()
370 *buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80); in encode_utf8()
371 *buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80); in encode_utf8()
372 *buf++ = CAST(unsigned char, ((ubuf[i] >> 6) & 0x3f) + 0x80); in encode_utf8()
373 *buf++ = CAST(unsigned char, (ubuf[i] & 0x3f) + 0x80); in encode_utf8()
375 if (end - buf < 6) in encode_utf8()
377 *buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc); in encode_utf8()
378 *buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80); in encode_utf8()
379 *buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80); in encode_utf8()
380 *buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80); in encode_utf8()
381 *buf++ = CAST(unsigned char, ((ubuf[i] >> 6) & 0x3f) + 0x80); in encode_utf8()
382 *buf++ = CAST(unsigned char, (ubuf[i] & 0x3f) + 0x80); in encode_utf8()
387 return buf; in encode_utf8()