Lines Matching refs:ms

231 format_decompression_error(struct magic_set *ms, size_t i, unsigned char *buf)  in format_decompression_error()  argument
234 int mime = ms->flags & MAGIC_MIME; in format_decompression_error()
237 return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf); in format_decompression_error()
243 return file_printf(ms, "application/x-decompression-error-%s-%s", in format_decompression_error()
248 file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name) in file_zmagic() argument
255 int mime = ms->flags & MAGIC_MIME; in file_zmagic()
262 if ((ms->flags & MAGIC_COMPRESS) == 0) in file_zmagic()
289 urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz); in file_zmagic()
295 ms->flags &= ~MAGIC_COMPRESS; in file_zmagic()
297 prv = format_decompression_error(ms, i, newbuf); in file_zmagic()
299 prv = file_buffer(ms, NULL, NULL, name, newbuf, nsz); in file_zmagic()
303 if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0) in file_zmagic()
307 if ((file_printf(ms, in file_zmagic()
310 if ((pb = file_push_buffer(ms)) == NULL) in file_zmagic()
316 if (file_buffer(ms, NULL, NULL, NULL, buf, nbytes) == -1) { in file_zmagic()
317 if (file_pop_buffer(ms, pb) != NULL) in file_zmagic()
321 if ((rbuf = file_pop_buffer(ms, pb)) != NULL) { in file_zmagic()
322 if (file_printf(ms, "%s", rbuf) == -1) { in file_zmagic()
328 if (!mime && file_printf(ms, ")") == -1) in file_zmagic()
349 ms->flags |= MAGIC_COMPRESS; in file_zmagic()
448 file_pipe2file(struct magic_set *ms, int fd, const void *startbuf, in file_pipe2file() argument
476 file_error(ms, errno, in file_pipe2file()
491 file_error(ms, errno, "error copying from pipe to temp file"); in file_pipe2file()
496 file_error(ms, errno, "error while writing to temp file"); in file_pipe2file()
506 file_error(ms, errno, "could not dup descriptor for temp file"); in file_pipe2file()
511 file_badseek(ms); in file_pipe2file()