Lines Matching defs:ubuf

71  * ubuf, and the number of characters converted in ulen.
74 file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, unichar **ubuf, size_t *ulen, const char **code, const char **code_mime, const char **type)
86 mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
87 if ((*ubuf = CAST(unichar *, calloc((size_t)1, mlen))) == NULL) {
92 if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
96 } else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
100 } else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
105 } else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
114 } else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
118 } else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
125 if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
129 } else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
227 looks_ascii(const unsigned char *buf, size_t nbytes, unichar *ubuf,
240 ubuf[(*ulen)++] = buf[i];
247 looks_latin1(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
259 ubuf[(*ulen)++] = buf[i];
266 looks_extended(const unsigned char *buf, size_t nbytes, unichar *ubuf,
279 ubuf[(*ulen)++] = buf[i];
293 * If ubuf is non-NULL on entry, text is decoded into ubuf, *ulen;
294 * ubuf must be big enough!
297 file_looks_utf8(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
304 if (ubuf)
317 if (ubuf)
318 ubuf[(*ulen)++] = buf[i];
353 if (ubuf)
354 ubuf[(*ulen)++] = c;
368 looks_utf8_with_BOM(const unsigned char *buf, size_t nbytes, unichar *ubuf,
372 return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
378 looks_ucs16(const unsigned char *buf, size_t nbytes, unichar *ubuf,
400 ubuf[(*ulen)++] = buf[i + 1] + 256 * buf[i];
402 ubuf[(*ulen)++] = buf[i] + 256 * buf[i + 1];
404 if (ubuf[*ulen - 1] == 0xfffe)
406 if (ubuf[*ulen - 1] < 128 &&
407 text_chars[(size_t)ubuf[*ulen - 1]] != T)