Lines Matching refs:buf

73 	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);  in file_encoding()  local
103 if (looks_ascii(buf, nbytes, *ubuf, ulen)) { in file_encoding()
104 if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) { in file_encoding()
113 } else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) { in file_encoding()
117 } else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) { in file_encoding()
121 } else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) { in file_encoding()
130 } else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) { in file_encoding()
139 } else if (looks_latin1(buf, nbytes, *ubuf, ulen)) { in file_encoding()
143 } else if (looks_extended(buf, nbytes, *ubuf, ulen)) { in file_encoding()
148 from_ebcdic(buf, nbytes, nbuf); in file_encoding()
254 looks_ascii(const unsigned char *buf, size_t nbytes, unichar *ubuf, in looks_ascii() argument
262 int t = text_chars[buf[i]]; in looks_ascii()
267 ubuf[(*ulen)++] = buf[i]; in looks_ascii()
274 looks_latin1(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) in looks_latin1() argument
281 int t = text_chars[buf[i]]; in looks_latin1()
286 ubuf[(*ulen)++] = buf[i]; in looks_latin1()
293 looks_extended(const unsigned char *buf, size_t nbytes, unichar *ubuf, in looks_extended() argument
301 int t = text_chars[buf[i]]; in looks_extended()
306 ubuf[(*ulen)++] = buf[i]; in looks_extended()
324 file_looks_utf8(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) in file_looks_utf8() argument
335 if ((buf[i] & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ in file_looks_utf8()
341 if (text_chars[buf[i]] != T) in file_looks_utf8()
345 ubuf[(*ulen)++] = buf[i]; in file_looks_utf8()
346 } else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */ in file_looks_utf8()
351 if ((buf[i] & 0x20) == 0) { /* 110xxxxx */ in file_looks_utf8()
352 c = buf[i] & 0x1f; in file_looks_utf8()
354 } else if ((buf[i] & 0x10) == 0) { /* 1110xxxx */ in file_looks_utf8()
355 c = buf[i] & 0x0f; in file_looks_utf8()
357 } else if ((buf[i] & 0x08) == 0) { /* 11110xxx */ in file_looks_utf8()
358 c = buf[i] & 0x07; in file_looks_utf8()
360 } else if ((buf[i] & 0x04) == 0) { /* 111110xx */ in file_looks_utf8()
361 c = buf[i] & 0x03; in file_looks_utf8()
363 } else if ((buf[i] & 0x02) == 0) { /* 1111110x */ in file_looks_utf8()
364 c = buf[i] & 0x01; in file_looks_utf8()
374 if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40)) in file_looks_utf8()
377 c = (c << 6) + (buf[i] & 0x3f); in file_looks_utf8()
395 looks_utf8_with_BOM(const unsigned char *buf, size_t nbytes, unichar *ubuf, in looks_utf8_with_BOM() argument
398 if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf) in looks_utf8_with_BOM()
399 return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen); in looks_utf8_with_BOM()
405 looks_utf7(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) in looks_utf7() argument
407 if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v') in looks_utf7()
408 switch (buf[3]) { in looks_utf7()
589 from_ebcdic(const unsigned char *buf, size_t nbytes, unsigned char *out) in from_ebcdic() argument
594 out[i] = ebcdic_to_ascii[buf[i]]; in from_ebcdic()