diff options
Diffstat (limited to 'ext/fileinfo/libmagic/file.h')
-rw-r--r-- | ext/fileinfo/libmagic/file.h | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/ext/fileinfo/libmagic/file.h b/ext/fileinfo/libmagic/file.h index 9652ada3ab..8ff768a5cd 100644 --- a/ext/fileinfo/libmagic/file.h +++ b/ext/fileinfo/libmagic/file.h @@ -102,27 +102,13 @@ #define MAXstring 32 /* max leng of "string" types */ #define MAGICNO 0xF11E041C -#define VERSIONNO 6 +#define VERSIONNO 5 #define FILE_MAGICSIZE (32 * 6) #define FILE_LOAD 0 #define FILE_CHECK 1 #define FILE_COMPILE 2 -union VALUETYPE { - uint8_t b; - uint16_t h; - uint32_t l; - uint64_t q; - uint8_t hs[2]; /* 2 bytes of a fixed-endian "short" */ - uint8_t hl[4]; /* 4 bytes of a fixed-endian "long" */ - uint8_t hq[8]; /* 8 bytes of a fixed-endian "quad" */ - char s[MAXstring]; /* the search string or regex pattern */ - unsigned char us[MAXstring]; - float f; - double d; -}; - struct magic { /* Word 1 */ uint16_t cont_level; /* level of ">" */ @@ -136,7 +122,7 @@ struct magic { for top-level tests) */ #define TEXTTEST 0 /* for passing to file_softmagic */ - uint8_t factor; + uint8_t dummy1; /* Word 2 */ uint8_t reln; /* relation (0=eq, '>'=gt, etc) */ @@ -205,15 +191,11 @@ struct magic { uint8_t mask_op; /* operator for mask */ #ifdef ENABLE_CONDITIONALS uint8_t cond; /* conditional type */ + uint8_t dummy2; #else - uint8_t dummy; + uint8_t dummy2; + uint8_t dummy3; #endif - uint8_t factor_op; -#define FILE_FACTOR_OP_PLUS '+' -#define FILE_FACTOR_OP_MINUS '-' -#define FILE_FACTOR_OP_TIMES '*' -#define FILE_FACTOR_OP_DIV '/' -#define FILE_FACTOR_OP_NONE '\0' #define FILE_OPS "&|^+-*/%" #define FILE_OPAND 0 @@ -255,8 +237,20 @@ struct magic { #define num_mask _u._mask #define str_range _u._s._count #define str_flags _u._s._flags + /* Words 9-16 */ - union VALUETYPE value; /* either number of string */ + union VALUETYPE { + uint8_t b; + uint16_t h; + uint32_t l; + uint64_t q; + uint8_t hs[2]; /* 2 bytes of a fixed-endian "short" */ + uint8_t hl[4]; /* 4 bytes of a fixed-endian "long" */ + uint8_t hq[8]; /* 8 bytes of a fixed-endian "quad" */ + char s[MAXstring]; /* the search string or regex pattern */ + float f; + double d; + } value; /* either number or string */ /* Words 17..31 */ char desc[MAXDESC]; /* description */ /* Words 32..47 */ @@ -288,20 +282,18 @@ struct mlist { struct mlist *next, *prev; }; -struct level_info { - int32_t off; - int got_match; -#ifdef ENABLE_CONDITIONALS - int last_match; - int last_cond; /* used for error checking by parse() */ -#endif -} *li; - struct magic_set { struct mlist *mlist; struct cont { size_t len; - struct level_info *li; + struct level_info { + int32_t off; + int got_match; +#ifdef ENABLE_CONDITIONALS + int last_match; + int last_cond; /* used for error checking by parse() */ +#endif + } *li; } c; struct out { char *buf; /* Accumulation buffer */ @@ -357,6 +349,7 @@ protected void file_oomem(struct magic_set *, size_t); protected void file_error(struct magic_set *, int, const char *, ...); protected void file_magerror(struct magic_set *, const char *, ...); protected void file_magwarn(struct magic_set *, const char *, ...); +protected void file_mdump(struct magic *); protected void file_showstr(FILE *, const char *, size_t); protected size_t file_mbswidth(const char *); protected const char *file_getbuffer(struct magic_set *); @@ -386,7 +379,6 @@ extern char *sys_errlist[]; #define O_BINARY 0 #endif -#ifndef __cplusplus #ifdef __GNUC__ static const char *rcsid(const char *) __attribute__((__used__)); #endif @@ -394,8 +386,5 @@ static const char *rcsid(const char *) __attribute__((__used__)); static const char *rcsid(const char *p) { \ return rcsid(p = id); \ } -#else -#define FILE_RCSID(id) -#endif #endif /* __file_h__ */ |