diff options
author | jbj <devnull@localhost> | 2004-08-03 20:31:49 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-08-03 20:31:49 +0000 |
commit | 6a12bc63ae1524bc22c36a960560de0a8785aec2 (patch) | |
tree | 604e18ded4c50a658a484b3407ad46ff6ecc4ae2 /file/src/softmagic.c | |
parent | 311c1c7274224f386e12f71d6b70460ffa1b1637 (diff) | |
download | librpm-tizen-6a12bc63ae1524bc22c36a960560de0a8785aec2.tar.gz librpm-tizen-6a12bc63ae1524bc22c36a960560de0a8785aec2.tar.bz2 librpm-tizen-6a12bc63ae1524bc22c36a960560de0a8785aec2.zip |
Upgrade to file-4.10.
CVS patchset: 7389
CVS date: 2004/08/03 20:31:49
Diffstat (limited to 'file/src/softmagic.c')
-rw-r--r-- | file/src/softmagic.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/file/src/softmagic.c b/file/src/softmagic.c index ef37dfdc6..4e063b9df 100644 --- a/file/src/softmagic.c +++ b/file/src/softmagic.c @@ -44,7 +44,7 @@ #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.65 2004/03/09 18:49:58 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.66 2004/07/24 20:38:56 christos Exp $") #endif /* lint */ private int match(struct magic_set *, struct magic *, uint32_t, @@ -678,7 +678,7 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, if (m->flag & INDIR) { switch (m->in_type) { case FILE_BYTE: - if (m->in_offset) + if (m->in_offset) { switch (m->in_op&0x7F) { case FILE_OPAND: offset = p->b & m->in_offset; @@ -705,12 +705,14 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, offset = p->b % m->in_offset; break; } + } else + offset = p->b; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BESHORT: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (short)((p->hs[0]<<8)| (p->hs[1])) & @@ -752,12 +754,15 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (short)((p->hs[0]<<8)| + (p->hs[1])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LESHORT: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (short)((p->hs[1]<<8)| (p->hs[0])) & @@ -799,12 +804,15 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (short)((p->hs[1]<<8)| + (p->hs[0])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_SHORT: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = p->h & m->in_offset; break; @@ -830,12 +838,15 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, offset = p->h % m->in_offset; break; } + } + else + offset = p->h; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BELONG: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| @@ -893,12 +904,17 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (int32_t)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LELONG: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| @@ -956,12 +972,17 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (int32_t)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LONG: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = p->l & m->in_offset; break; @@ -994,6 +1015,8 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, * sleep; */ } + } else + offset = p->l; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; |