From: Christos Zoulas Date: Sun, 23 Mar 2003 21:24:07 +0000 (+0000) Subject: rename magic_buf to magic_buffer, and use file_buf internally. X-Git-Tag: FILE5_05~1029 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60bdb1d15bef62a272667779888915ae57b623bd;p=file rename magic_buf to magic_buffer, and use file_buf internally. --- diff --git a/src/compress.c b/src/compress.c index 118f504f..0734d61a 100644 --- a/src/compress.c +++ b/src/compress.c @@ -55,7 +55,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.27 2003/03/23 21:16:26 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.28 2003/03/23 21:24:07 christos Exp $") #endif @@ -108,7 +108,10 @@ file_zmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes) if (file_printf(ms, " (") == -1) return -1; ms->flags &= ~MAGIC_COMPRESS; - (void)magic_buf(ms, buf, nbytes); + if (file_buf(ms, buf, nbytes) == -1) { + ms->flags |= MAGIC_COMPRESS; + return -1; + } ms->flags |= MAGIC_COMPRESS; if (file_printf(ms, ")") == -1) return -1; diff --git a/src/magic.c b/src/magic.c index 0382fee3..6f090af5 100644 --- a/src/magic.c +++ b/src/magic.c @@ -36,7 +36,7 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: magic.c,v 1.2 2003/03/23 21:16:26 christos Exp $") +FILE_RCSID("@(#)$Id: magic.c,v 1.3 2003/03/23 21:24:07 christos Exp $") #endif /* lint */ @@ -196,7 +196,7 @@ magic_file(struct magic_set *ms, const char *inname) return NULL; } else { buf[nbytes++] = '\0'; /* null-terminate it */ - if (file_buf(ms, buf, nbytes) == -1) + if (file_buffer(ms, buf, nbytes) == -1) return NULL; #ifdef BUILTIN_ELF if (nbytes > 5) { @@ -226,7 +226,7 @@ magic_buf(struct magic_set *ms, const void *buf, size_t nb) * The main work is done here! * We have the file name and/or the data buffer to be identified. */ - if (file_buf(ms, buf, nb) == -1) { + if (file_buffer(ms, buf, nb) == -1) { return NULL; } return ms->haderr ? NULL : ms->o.buf; diff --git a/src/magic.h b/src/magic.h index b3232e5d..9110df11 100644 --- a/src/magic.h +++ b/src/magic.h @@ -46,7 +46,7 @@ magic_t magic_open(int flags); void magic_close(magic_t); const char *magic_file(magic_t, const char *); -const char *magic_buf(magic_t, const void *, size_t); +const char *magic_buffer(magic_t, const void *, size_t); const char *magic_error(magic_t); void magic_setflags(magic_t, int);