Permalink
Browse files

count indirect recursion as recursion.

  • Loading branch information...
1 parent 0e5f108 commit cc9e74dfeca5265ad725acc926ef0b8d2a18ee70 @zoulasc zoulasc committed Feb 12, 2014
Showing with 10 additions and 10 deletions.
  1. +2 −2 src/ascmagic.c
  2. +2 −2 src/file.h
  3. +2 −2 src/funcs.c
  4. +4 −4 src/softmagic.c
View
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.86 2013/06/08 14:13:12 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.87 2013/09/17 15:51:22 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
== NULL)
goto done;
if ((rv = file_softmagic(ms, utf8_buf,
- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
+ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
rv = -1;
}
View
@@ -27,7 +27,7 @@
*/
/*
* file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.146 2013/12/05 17:02:34 christos Exp $
+ * @(#)$File: file.h,v 1.147 2014/01/07 03:15:09 christos Exp $
*/
#ifndef __file_h__
@@ -439,7 +439,7 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
unichar **, size_t *, const char **, const char **, const char **);
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
- int, int);
+ size_t, int, int);
protected int file_apprentice(struct magic_set *, const char *, int);
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
protected uint64_t file_signextend(struct magic_set *, struct magic *,
View
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.65 2013/12/05 17:02:34 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.66 2014/01/07 03:15:09 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -230,7 +230,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
/* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
- if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
+ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
looks_text)) != 0) {
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "softmagic %d\n", m);
View
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.172 2014/01/08 22:22:54 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.173 2014/02/11 15:41:25 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -79,13 +79,13 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
protected int
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
- int mode, int text)
+ size_t level, int mode, int text)
{
struct mlist *ml;
int rv, printed_something = 0, need_separator = 0;
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
- text, 0, 0, &printed_something, &need_separator,
+ text, 0, level, &printed_something, &need_separator,
NULL)) != 0)
return rv;
@@ -1747,7 +1747,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
ms->o.buf = NULL;
ms->offset = 0;
rv = file_softmagic(ms, s + offset, nbytes - offset,
- BINTEST, text);
+ recursion_level, BINTEST, text);
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
rbuf = ms->o.buf;

0 comments on commit cc9e74d

Please sign in to comment.