Lines Matching refs:p

71 #define BE64(p) ( \  argument
72 (CAST(uint64_t, (p)->hq[0])<<56)| \
73 (CAST(uint64_t, (p)->hq[1])<<48)| \
74 (CAST(uint64_t, (p)->hq[2])<<40)| \
75 (CAST(uint64_t, (p)->hq[3])<<32)| \
76 (CAST(uint64_t, (p)->hq[4])<<24)| \
77 (CAST(uint64_t, (p)->hq[5])<<16)| \
78 (CAST(uint64_t, (p)->hq[6])<<8)| \
79 (CAST(uint64_t, (p)->hq[7])))
80 #define LE64(p) ( \ argument
81 (CAST(uint64_t, (p)->hq[7])<<56)| \
82 (CAST(uint64_t, (p)->hq[6])<<48)| \
83 (CAST(uint64_t, (p)->hq[5])<<40)| \
84 (CAST(uint64_t, (p)->hq[4])<<32)| \
85 (CAST(uint64_t, (p)->hq[3])<<24)| \
86 (CAST(uint64_t, (p)->hq[2])<<16)| \
87 (CAST(uint64_t, (p)->hq[1])<<8)| \
88 (CAST(uint64_t, (p)->hq[0])))
89 #define LE32(p) ( \ argument
90 (CAST(uint32_t, (p)->hl[3])<<24)| \
91 (CAST(uint32_t, (p)->hl[2])<<16)| \
92 (CAST(uint32_t, (p)->hl[1])<<8)| \
93 (CAST(uint32_t, (p)->hl[0])))
94 #define BE32(p) ( \ argument
95 (CAST(uint32_t, (p)->hl[0])<<24)| \
96 (CAST(uint32_t, (p)->hl[1])<<16)| \
97 (CAST(uint32_t, (p)->hl[2])<<8)| \
98 (CAST(uint32_t, (p)->hl[3])))
99 #define ME32(p) ( \ argument
100 (CAST(uint32_t, (p)->hl[1])<<24)| \
101 (CAST(uint32_t, (p)->hl[0])<<16)| \
102 (CAST(uint32_t, (p)->hl[3])<<8)| \
103 (CAST(uint32_t, (p)->hl[2])))
105 #define BE16(p) ((CAST(uint16_t, (p)->hs[0])<<8)|(CAST(uint16_t, (p)->hs[1]))) argument
106 #define LE16(p) ((CAST(uint16_t, (p)->hs[1])<<8)|(CAST(uint16_t, (p)->hs[0]))) argument
107 #define SEXT(s,v,p) ((s) ? \ argument
108 CAST(intmax_t, CAST(int##v##_t, p)) : \
109 CAST(intmax_t, CAST(uint##v##_t, p)))
596 union VALUETYPE *p = &ms->ms_value; in mprint() local
635 PRINTER(p->b, "", int8_t, uint8_t); in mprint()
640 PRINTER(p->h, "", int16_t, uint16_t); in mprint()
646 PRINTER(p->l, "", int32_t, uint32_t); in mprint()
652 PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long); in mprint()
665 char *str = p->s; in mprint()
677 sizeof(p->s) - (str - p->s))) == -1) in mprint()
693 file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1) in mprint()
702 file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL)) in mprint()
711 file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1) in mprint()
719 file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1) in mprint()
727 file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS)) in mprint()
735 vf = p->f; in mprint()
754 vd = p->d; in mprint()
817 file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1) in mprint()
824 file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1) in mprint()
884 union VALUETYPE *p = &ms->ms_value; in moffset() local
887 p->s[strcspn(p->s, "\r\n")] = '\0'; in moffset()
888 o = CAST(uint32_t, (ms->offset + strlen(p->s))); in moffset()
1058 p->fld &= CAST(type, m->num_mask); \
1061 p->fld |= CAST(type, m->num_mask); \
1064 p->fld ^= CAST(type, m->num_mask); \
1067 p->fld += CAST(type, m->num_mask); \
1070 p->fld -= CAST(type, m->num_mask); \
1073 p->fld *= CAST(type, m->num_mask); \
1078 p->fld /= CAST(type, m->num_mask); \
1083 p->fld %= CAST(type, m->num_mask); \
1087 p->fld = ~p->fld \
1090 cvt_8(union VALUETYPE *p, const struct magic *m) in cvt_8() argument
1097 cvt_16(union VALUETYPE *p, const struct magic *m) in cvt_16() argument
1104 cvt_32(union VALUETYPE *p, const struct magic *m) in cvt_32() argument
1111 cvt_64(union VALUETYPE *p, const struct magic *m) in cvt_64() argument
1121 p->fld += CAST(type, m->num_mask); \
1124 p->fld -= CAST(type, m->num_mask); \
1127 p->fld *= CAST(type, m->num_mask); \
1132 p->fld /= CAST(type, m->num_mask); \
1137 cvt_float(union VALUETYPE *p, const struct magic *m) in cvt_float() argument
1144 cvt_double(union VALUETYPE *p, const struct magic *m) in cvt_double() argument
1158 union VALUETYPE *p = &ms->ms_value; in mconvert() local
1162 if (cvt_8(p, m) == -1) in mconvert()
1172 if (cvt_16(p, m) == -1) in mconvert()
1178 if (cvt_32(p, m) == -1) in mconvert()
1186 if (cvt_64(p, m) == -1) in mconvert()
1194 p->s[sizeof(p->s) - 1] = '\0'; in mconvert()
1202 ptr1 = p->s; in mconvert()
1207 sz = sizeof(p->s) - sz; /* maximum length of string */ in mconvert()
1225 p->h = CAST(short, BE16(p)); in mconvert()
1226 if (cvt_16(p, m) == -1) in mconvert()
1232 p->l = CAST(int32_t, BE32(p)); in mconvert()
1233 if (cvt_32(p, m) == -1) in mconvert()
1240 p->q = CAST(uint64_t, BE64(p)); in mconvert()
1241 if (cvt_64(p, m) == -1) in mconvert()
1245 p->h = CAST(short, LE16(p)); in mconvert()
1246 if (cvt_16(p, m) == -1) in mconvert()
1252 p->l = CAST(int32_t, LE32(p)); in mconvert()
1253 if (cvt_32(p, m) == -1) in mconvert()
1260 p->q = CAST(uint64_t, LE64(p)); in mconvert()
1261 if (cvt_64(p, m) == -1) in mconvert()
1267 p->l = CAST(int32_t, ME32(p)); in mconvert()
1268 if (cvt_32(p, m) == -1) in mconvert()
1272 if (cvt_float(p, m) == -1) in mconvert()
1276 p->l = BE32(p); in mconvert()
1277 if (cvt_float(p, m) == -1) in mconvert()
1281 p->l = LE32(p); in mconvert()
1282 if (cvt_float(p, m) == -1) in mconvert()
1286 if (cvt_double(p, m) == -1) in mconvert()
1290 p->q = BE64(p); in mconvert()
1291 if (cvt_double(p, m) == -1) in mconvert()
1295 p->q = LE64(p); in mconvert()
1296 if (cvt_double(p, m) == -1) in mconvert()
1328 mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, in mcopy() argument
1401 char *dst = p->s; in mcopy()
1402 char *edst = &p->s[sizeof(p->s) - 1]; in mcopy()
1434 (void)memset(p, '\0', sizeof(*p)); in mcopy()
1435 p->q = offset; in mcopy()
1440 (void)memset(p, '\0', sizeof(*p)); in mcopy()
1443 if (nbytes - offset < sizeof(*p)) in mcopy()
1446 nbytes = sizeof(*p); in mcopy()
1448 (void)memcpy(p, s + offset, nbytes); in mcopy()
1454 if (nbytes < sizeof(*p)) in mcopy()
1455 (void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0', in mcopy()
1456 sizeof(*p) - nbytes); in mcopy()
1584 union VALUETYPE *p = &ms->ms_value; in mget() local
1602 if (mcopy(ms, p, m->type, m->flag & INDIR, s, in mget()
1612 mdebug(offset, RCAST(char *, RCAST(void *, p)), in mget()
1682 off = SEXT(sgn,64,strtoull(p->s, NULL, 8)); in mget()
1696 offset = do_ops(m, SEXT(sgn,8,p->b), off); in mget()
1701 offset = do_ops(m, SEXT(sgn,16,BE16(p)), off); in mget()
1706 offset = do_ops(m, SEXT(sgn,16,LE16(p)), off); in mget()
1711 offset = do_ops(m, SEXT(sgn,16,p->h), off); in mget()
1717 lhs = BE32(p); in mget()
1726 lhs = LE32(p); in mget()
1734 offset = do_ops(m, SEXT(sgn,32,ME32(p)), off); in mget()
1739 offset = do_ops(m, SEXT(sgn,32,p->l), off); in mget()
1744 offset = do_ops(m, SEXT(sgn,64,LE64(p)), off); in mget()
1749 offset = do_ops(m, SEXT(sgn,64,BE64(p)), off); in mget()
1755 SEXT(sgn,64,strtoull(p->s, NULL, 8)), off); in mget()
1780 if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1) in mget()
1785 mdebug(offset, RCAST(char *, RCAST(void *, p)), in mget()
2057 union VALUETYPE *p = &ms->ms_value; in magiccheck() local
2061 v = p->b; in magiccheck()
2073 v = p->h; in magiccheck()
2088 v = p->l; in magiccheck()
2104 v = p->q; in magiccheck()
2111 fv = p->f; in magiccheck()
2144 dv = p->d; in magiccheck()
2183 v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen), in magiccheck()
2184 sizeof(p->s), m->str_flags); in magiccheck()
2190 v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen), in magiccheck()
2191 sizeof(p->s), m->str_flags); in magiccheck()
2330 v = memcmp(m->value.guid, p->guid, sizeof(p->guid)); in magiccheck()
2452 const char *p; in handle_annotation() local
2456 p = m->mimetype; in handle_annotation()
2458 p = buf; in handle_annotation()
2459 if (file_printf(ms, "%s", p) == -1) in handle_annotation()