Lines Matching refs:buf
105 zlibcmp(const unsigned char *buf) in zlibcmp() argument
110 if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0) in zlibcmp()
113 x = buf[0] | (buf[1] << 8); in zlibcmp()
115 x = buf[1] | (buf[0] << 8); in zlibcmp()
125 lzmacmp(const unsigned char *buf) in lzmacmp() argument
127 if (buf[0] != 0x5d || buf[1] || buf[2]) in lzmacmp()
129 if (buf[12] && buf[12] != 0xff) in lzmacmp()
231 format_decompression_error(struct magic_set *ms, size_t i, unsigned char *buf) in format_decompression_error() argument
237 return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf); in format_decompression_error()
239 for (p = buf; *p; p++) in format_decompression_error()
244 methodname(i), buf); in format_decompression_error()
257 const unsigned char *buf = CAST(const unsigned char *, b->fbuf); in file_zmagic() local
270 zm = (*compr[i].u.func)(buf); in file_zmagic()
272 zm = memcmp(buf, compr[i].u.magic, in file_zmagic()
289 urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz); in file_zmagic()
316 if (file_buffer(ms, NULL, NULL, NULL, buf, nbytes) == -1) { in file_zmagic()
358 swrite(int fd, const void *buf, size_t n) in swrite() argument
364 switch (rv = write(fd, buf, n)) { in swrite()
371 buf = CAST(const char *, buf) + rv; in swrite()
383 sread(int fd, void *buf, size_t n, int canbepipe) in sread() argument
431 switch ((rv = FINFO_READ_FUNC(fd, buf, n))) { in sread()
440 buf = CAST(char *, CCAST(void *, buf)) + rv; in sread()
451 char buf[4096]; in file_pipe2file() local
455 (void)strlcpy(buf, "/tmp/file.XXXXXX", sizeof buf); in file_pipe2file()
458 char *ptr = mktemp(buf); in file_pipe2file()
468 tfd = mkstemp(buf); in file_pipe2file()
471 (void)unlink(buf); in file_pipe2file()
484 while ((r = sread(fd, buf, sizeof(buf), 1)) > 0) in file_pipe2file()
485 if (swrite(tfd, buf, CAST(size_t, r)) != r) in file_pipe2file()
688 makeerror(unsigned char **buf, size_t *len, const char *fmt, ...) in makeerror() argument
698 *buf = NULL; in makeerror()
702 *buf = RCAST(unsigned char *, msg); in makeerror()
766 char *buf; in filter_error() local
769 buf = RCAST(char *, ubuf); in filter_error()
770 while (isspace(CAST(unsigned char, *buf))) in filter_error()
771 buf++; in filter_error()
772 DPRINTF("Filter error[[[%s]]]\n", buf); in filter_error()
773 if ((p = strchr(CAST(char *, buf), '\n')) != NULL) in filter_error()
775 if ((p = strchr(CAST(char *, buf), ';')) != NULL) in filter_error()
777 if ((p = strrchr(CAST(char *, buf), ':')) != NULL) { in filter_error()