43 static int match(RzMagic *,
struct rz_magic *,
ut32,
44 const ut8 *,
size_t,
int);
45 static int mget(RzMagic *,
const ut8 *,
46 struct rz_magic *,
size_t,
unsigned int);
47 static int magiccheck(RzMagic *,
struct rz_magic *);
48 static st32 mprint(RzMagic *,
struct rz_magic *);
49 static void mdebug(
ut32,
const char *,
size_t);
50 static int mcopy(RzMagic *,
union VALUETYPE *,
int,
int,
51 const ut8 *,
ut32,
size_t,
size_t);
52 static int mconvert(RzMagic *,
struct rz_magic *);
54 static void cvt_8(
union VALUETYPE *,
const struct rz_magic *);
55 static void cvt_16(
union VALUETYPE *,
const struct rz_magic *);
56 static void cvt_32(
union VALUETYPE *,
const struct rz_magic *);
57 static void cvt_64(
union VALUETYPE *,
const struct rz_magic *);
63 #define RZ_MAGIC_DESC ((ms->flags & RZ_MAGIC_MIME) ? m->mimetype : m->desc)
73 for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next) {
110 unsigned int cont_level = 0;
111 int need_separator = 0;
114 int printed_something = 0;
119 for (magindex = 0; magindex < nmagic; magindex++) {
121 struct rz_magic *
m = &magic[magindex];
123 if ((
m->flag & BINTEST) !=
mode) {
125 while (magic[magindex + 1].cont_level != 0 && ++magindex < nmagic - 1) {
131 ms->offset =
m->offset;
132 ms->line =
m->lineno;
137 if (
m->reln ==
'!') {
154 while (magindex < nmagic - 1 && magic[magindex + 1].cont_level) {
166 printed_something = 1;
172 if ((ms->c.li[cont_level].off =
mprint(ms,
m)) == -1) {
181 while (++magindex < nmagic - 1 && magic[magindex].cont_level != 0) {
182 m = &magic[magindex];
183 ms->line =
m->lineno;
185 if (cont_level < m->cont_level) {
188 if (cont_level >
m->cont_level) {
193 cont_level =
m->cont_level;
195 ms->offset =
m->offset;
196 if (
m->flag & OFFADD) {
197 ms->offset += ms->c.li[cont_level - 1].off;
200 if (
m->cond == COND_ELSE ||
m->cond == COND_ELIF) {
201 if (ms->c.li[cont_level].last_match == 1) {
206 if (flush &&
m->reln !=
'!') {
214 ms->c.li[cont_level].last_match = 0;
217 ms->c.li[cont_level].last_match = 1;
218 if (
m->type != FILE_DEFAULT) {
219 ms->c.li[cont_level].got_match = 1;
220 }
else if (ms->c.li[cont_level].got_match) {
221 ms->c.li[cont_level].got_match = 0;
229 printed_something = 1;
241 if (need_separator && ((
m->flag & NOSPACE) == 0) && *
RZ_MAGIC_DESC) {
247 if ((ms->c.li[cont_level].off =
mprint(ms,
m)) == -1) {
265 if (printed_something) {
269 if ((ms->flags & RZ_MAGIC_CONTINUE) == 0 && printed_something) {
317 union VALUETYPE *
p = &ms->ms_value;
343 t = ms->offset +
sizeof(char);
369 t = ms->offset +
sizeof(short);
396 t = ms->offset +
sizeof(
st32);
405 t = ms->offset +
sizeof(
ut64);
410 case FILE_BESTRING16:
411 case FILE_LESTRING16:
412 if (
m->reln ==
'=' ||
m->reln ==
'!') {
416 t = ms->offset +
m->vallen;
418 if (*
m->value.s ==
'\0') {
419 p->s[strcspn(
p->s,
"\n")] =
'\0';
424 t = ms->offset + strlen(
p->s);
425 if (
m->type == FILE_PSTRING) {
437 t = ms->offset +
sizeof(
time_t);
446 t = ms->offset +
sizeof(
time_t);
454 t = ms->offset +
sizeof(
ut64);
462 t = ms->offset +
sizeof(
ut64);
488 t = ms->offset +
sizeof(
float);
514 t = ms->offset +
sizeof(double);
520 cp =
strdupn((
const char *)ms->search.s, ms->search.rm_len);
532 if ((
m->str_flags & REGEX_OFFSET_START)) {
533 t = ms->search.offset;
535 t = ms->search.offset + ms->search.rm_len;
544 if ((
m->str_flags & REGEX_OFFSET_START)) {
545 t = ms->search.offset;
547 t = ms->search.offset +
m->vallen;
564 #define DO_CVT(fld, cast) \
566 switch (m->mask_op & FILE_OPS_MASK) { \
568 p->fld &= cast m->num_mask; \
571 p->fld |= cast m->num_mask; \
574 p->fld ^= cast m->num_mask; \
577 p->fld += cast m->num_mask; \
580 p->fld -= cast m->num_mask; \
582 case FILE_OPMULTIPLY: \
583 p->fld *= cast m->num_mask; \
585 case FILE_OPDIVIDE: \
586 p->fld /= cast m->num_mask; \
588 case FILE_OPMODULO: \
589 p->fld %= cast m->num_mask; \
592 if (m->mask_op & FILE_OPINVERSE) \
595 static void cvt_8(
union VALUETYPE *
p,
const struct rz_magic *
m) {
599 static void cvt_16(
union VALUETYPE *
p,
const struct rz_magic *
m) {
603 static void cvt_32(
union VALUETYPE *
p,
const struct rz_magic *
m) {
607 static void cvt_64(
union VALUETYPE *
p,
const struct rz_magic *
m) {
611 #define DO_CVT2(fld, cast) \
613 switch (m->mask_op & FILE_OPS_MASK) { \
615 p->fld += cast m->num_mask; \
618 p->fld -= cast m->num_mask; \
620 case FILE_OPMULTIPLY: \
621 p->fld *= cast m->num_mask; \
623 case FILE_OPDIVIDE: \
624 p->fld /= cast m->num_mask; \
628 static void cvt_float(
union VALUETYPE *
p,
const struct rz_magic *
m) {
642 union VALUETYPE *
p = &ms->ms_value;
662 case FILE_BESTRING16:
663 case FILE_LESTRING16: {
667 p->s[
sizeof(
p->s) - 1] =
'\0';
669 if (
len-- &&
p->s[
len] ==
'\n') {
675 char *ptr1 =
p->s, *ptr2 = ptr1 + 1;
677 if (
len >=
sizeof(
p->s)) {
678 len =
sizeof(
p->s) - 1;
685 if (
len-- &&
p->s[
len] ==
'\n') {
691 p->h = (short)((
p->hs[0] << 8) | (
p->hs[1]));
704 ((
ut64)
p->hq[2] << 40) | ((
ut64)
p->hq[3] << 32) |
705 ((
ut64)
p->hq[4] << 24) | ((
ut64)
p->hq[5] << 16) |
710 p->h = (short)((
p->hs[1] << 8) | (
p->hs[0]));
723 ((
ut64)
p->hq[5] << 40) | ((
ut64)
p->hq[4] << 32) |
724 ((
ut64)
p->hq[3] << 24) | ((
ut64)
p->hq[2] << 16) |
731 p->l = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2]));
738 p->l = ((
ut32)
p->hl[0] << 24) | ((
ut32)
p->hl[1] << 16) |
743 p->l = ((
ut32)
p->hl[3] << 24) | ((
ut32)
p->hl[2] << 16) |
751 p->q = ((
ut64)
p->hq[0] << 56) | ((
ut64)
p->hq[1] << 48) |
752 ((
ut64)
p->hq[2] << 40) | ((
ut64)
p->hq[3] << 32) |
753 ((
ut64)
p->hq[4] << 24) | ((
ut64)
p->hq[5] << 16) |
758 p->q = ((
ut64)
p->hq[7] << 56) | ((
ut64)
p->hq[6] << 48) |
759 ((
ut64)
p->hq[5] << 40) | ((
ut64)
p->hq[4] << 32) |
760 ((
ut64)
p->hq[3] << 24) | ((
ut64)
p->hq[2] << 16) |
777 (void)fputc(
'\n', stderr);
778 (void)fputc(
'\n', stderr);
789 ms->search.s = (
const char *)
s +
offset;
791 ms->search.offset =
offset;
801 ms->search.s_len = 0;
806 last = (
const char *)
s +
nbytes;
809 lines && ((
b = strchr(
c =
b,
'\n')) || (
b = strchr(
c,
'\r')));
812 if (
b[0] ==
'\r' &&
b[1] ==
'\n') {
817 last = (
const char *)
s +
nbytes;
821 ms->search.s_len = last -
buf;
822 ms->search.offset =
offset;
823 ms->search.rm_len = 0;
826 case FILE_BESTRING16:
827 case FILE_LESTRING16: {
831 char *edst = &
p->s[
sizeof(
p->s) - 1];
833 if (
type == FILE_BESTRING16) {
850 if (
type == FILE_BESTRING16 ? *(
src - 1) !=
'\0' : *(
src + 1) !=
'\0') {
884 static int mget(RzMagic *ms,
const ut8 *
s,
struct rz_magic *
m,
size_t nbytes,
unsigned int cont_level) {
887 union VALUETYPE *
p = &ms->ms_value;
893 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
898 if (
m->flag & INDIR) {
899 int off =
m->in_offset;
900 if (
m->in_op & FILE_OPINDIRECT) {
901 const union VALUETYPE *q =
903 switch (
m->in_type) {
911 off = (short)((q->hs[0] << 8) | (q->hs[1]));
914 off = (short)((q->hs[1] << 8) | (q->hs[0]));
920 off = (
st32)((q->hl[0] << 24) | (q->hl[1] << 16) | (q->hl[2] << 8) | (q->hl[3]));
923 off = (
st32)((q->hl[3] << 24) | (q->hl[2] << 16) | (q->hl[1] << 8) | (q->hl[0]));
926 off = (
st32)((q->hl[1] << 24) | (q->hl[0] << 16) | (q->hl[3] << 8) | (q->hl[2]));
930 switch (
m->in_type) {
936 switch (
m->in_op & FILE_OPS_MASK) {
941 case FILE_OPMINUS:
offset =
p->b -
off;
break;
942 case FILE_OPMULTIPLY:
offset =
p->b *
off;
break;
943 case FILE_OPDIVIDE:
offset =
p->b /
off;
break;
944 case FILE_OPMODULO:
offset =
p->b %
off;
break;
949 if (
m->in_op & FILE_OPINVERSE) {
958 switch (
m->in_op & FILE_OPS_MASK) {
959 case FILE_OPAND:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) &
off;
break;
960 case FILE_OPOR:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) |
off;
break;
961 case FILE_OPXOR:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) ^
off;
break;
962 case FILE_OPADD:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) +
off;
break;
963 case FILE_OPMINUS:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) -
off;
break;
964 case FILE_OPMULTIPLY:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) *
off;
break;
965 case FILE_OPDIVIDE:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) /
off;
break;
966 case FILE_OPMODULO:
offset = (short)((
p->hs[0] << 8) | (
p->hs[1])) %
off;
break;
969 offset = (short)((
p->hs[0] << 8) |
972 if (
m->in_op & FILE_OPINVERSE) {
981 switch (
m->in_op & FILE_OPS_MASK) {
982 case FILE_OPAND:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) &
off;
break;
983 case FILE_OPOR:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) |
off;
break;
984 case FILE_OPXOR:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) ^
off;
break;
985 case FILE_OPADD:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) +
off;
break;
986 case FILE_OPMINUS:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) -
off;
break;
987 case FILE_OPMULTIPLY:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) *
off;
break;
988 case FILE_OPDIVIDE:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) /
off;
break;
989 case FILE_OPMODULO:
offset = (short)((
p->hs[1] << 8) | (
p->hs[0])) %
off;
break;
992 offset = (short)((
p->hs[1] << 8) | (
p->hs[0]));
994 if (
m->in_op & FILE_OPINVERSE) {
1003 switch (
m->in_op & FILE_OPS_MASK) {
1008 case FILE_OPMINUS:
offset =
p->h -
off;
break;
1009 case FILE_OPMULTIPLY:
offset =
p->h *
off;
break;
1010 case FILE_OPDIVIDE:
offset =
p->h /
off;
break;
1011 case FILE_OPMODULO:
offset =
p->h %
off;
break;
1016 if (
m->in_op & FILE_OPINVERSE) {
1025 switch (
m->in_op & FILE_OPS_MASK) {
1027 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) &
off;
1030 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) |
off;
1033 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) ^
off;
1036 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) +
off;
1039 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) -
off;
1041 case FILE_OPMULTIPLY:
1042 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) *
off;
1045 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) /
off;
1048 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3])) %
off;
1052 offset = (
st32)((
p->hl[0] << 24) | (
p->hl[1] << 16) | (
p->hl[2] << 8) | (
p->hl[3]));
1054 if (
m->in_op & FILE_OPINVERSE) {
1063 switch (
m->in_op & FILE_OPS_MASK) {
1065 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) &
off;
1068 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) |
off;
1071 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) ^
off;
1074 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) +
off;
1077 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) -
off;
1079 case FILE_OPMULTIPLY:
1080 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) *
off;
1083 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) /
off;
1086 offset = (
st32)((
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0])) %
off;
1090 offset = (
st32)(((
ut32)
p->hl[3] << 24) | (
p->hl[2] << 16) | (
p->hl[1] << 8) | (
p->hl[0]));
1092 if (
m->in_op & FILE_OPINVERSE) {
1101 switch (
m->in_op & FILE_OPS_MASK) {
1103 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) &
off;
1106 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) |
off;
1109 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) ^
off;
1112 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) +
off;
1115 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) -
off;
1117 case FILE_OPMULTIPLY:
1118 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) *
off;
1121 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) /
off;
1124 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2])) %
off;
1128 offset = (
st32)((
p->hl[1] << 24) | (
p->hl[0] << 16) | (
p->hl[3] << 8) | (
p->hl[2]));
1130 if (
m->in_op & FILE_OPINVERSE) {
1139 switch (
m->in_op & FILE_OPS_MASK) {
1144 case FILE_OPMINUS:
offset =
p->l -
off;
break;
1145 case FILE_OPMULTIPLY:
offset =
p->l *
off;
break;
1146 case FILE_OPDIVIDE:
offset =
p->l /
off;
break;
1147 case FILE_OPMODULO:
offset =
p->l %
off;
break;
1152 if (
m->in_op & FILE_OPINVERSE) {
1158 if (
m->flag & INDIROFFADD) {
1159 offset += ms->c.li[cont_level - 1].off;
1166 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1168 sizeof(
union VALUETYPE));
1250 if ((
v = *
b++ - *
a++) !=
'\0') {
1256 if ((
flags & STRING_IGNORE_LOWERCASE) &&
1261 }
else if ((
flags & STRING_IGNORE_UPPERCASE) &&
isupper(*
a)) {
1275 }
else if ((
flags & STRING_COMPACT_OPTIONAL_BLANK) &&
isspace(*
a)) {
1281 if ((
v = *
b++ - *
a++) !=
'\0') {
1301 ut64 l =
m->value.q;
1306 union VALUETYPE *
p = &ms->ms_value;
1348 case 'x': matched = 1;
break;
1349 case '!': matched = fv != fl;
break;
1350 case '=': matched = fv == fl;
break;
1351 case '>': matched = fv > fl;
break;
1352 case '<': matched = fv < fl;
break;
1354 file_magerror(ms,
"cannot happen with float: invalid relation `%c'",
m->reln);
1364 case 'x': matched = 1;
break;
1365 case '!': matched = dv != dl;
break;
1366 case '=': matched = dv == dl;
break;
1367 case '>': matched = dv > dl;
break;
1368 case '<': matched = dv < dl;
break;
1370 file_magerror(ms,
"cannot happen with double: invalid relation `%c'",
m->reln);
1383 case FILE_BESTRING16:
1384 case FILE_LESTRING16:
1391 if (!ms->search.s) {
1395 slen =
RZ_MIN(
m->vallen,
sizeof(
m->value.s));
1399 for (
idx = 0;
m->str_range == 0 ||
idx <
m->str_range;
idx++) {
1400 if ((
int)ms->search.offset < 0) {
1403 if (slen +
idx > ms->search.s_len) {
1408 ms->search.offset +=
idx;
1419 if (!ms->search.s) {
1434 #ifndef RZ_REGEX_STARTEND
1435 #define RZ_REGEX_STARTEND 0
1436 size_t l = ms->search.s_len - 1;
1437 char c = ms->search.s[l];
1438 ((
char *)(
intptr_t)ms->search.s)[l] =
'\0';
1440 pmatch[0].
rm_so = 0;
1441 pmatch[0].
rm_eo = ms->search.s_len;
1444 #if RZ_REGEX_STARTEND == 0
1445 ((
char *)(
intptr_t)ms->search.s)[l] =
c;
1449 ms->search.s += (
int)pmatch[0].rm_so;
1450 ms->search.offset += (
size_t)pmatch[0].rm_so;
1451 ms->search.rm_len = (
size_t)(pmatch[0].rm_eo - pmatch[0].rm_so);
1465 if (
v == (
ut64)-1) {
1478 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1479 (void)fprintf(stderr,
"%" PFMT64u " == *any* = 1\n", (
ut64)
v);
1485 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1491 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1498 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1503 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1511 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1516 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1522 matched = (
v & l) == l;
1523 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1528 matched = (
v & l) != l;
1529 if ((ms->flags & RZ_MAGIC_DEBUG) != 0) {
1534 file_magerror(ms,
"cannot happen: invalid relation `%c'",
m->reln);
void file_showstr(FILE *fp, const char *s, size_t len)
ut64 file_signextend(RzMagic *ms, struct rz_magic *m, ut64 v)
static RzBinSourceLineInfo * lines(RzBinFile *bf)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void nbytes
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
void file_oomem(struct rz_magic_set *, size_t)
void file_magerror(struct rz_magic_set *, const char *,...)
void file_mdump(struct rz_magic *)
int file_printf(struct rz_magic_set *, const char *,...)
int file_check_mem(struct rz_magic_set *, unsigned int)
const char * file_fmttime(unsigned int, int, char *)
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * malloc(size_t size)
static ut32 rz_read_le32(const void *src)
static ut32 rz_read_be32(const void *src)
RZ_API int rz_regex_exec(const RzRegex *preg, const char *string, size_t nmatch, RzRegexMatch __pmatch[], int eflags)
RZ_API void rz_regex_fini(RzRegex *)
#define RZ_REGEX_EXTENDED
RZ_API int rz_regex_comp(RzRegex *, const char *, int)
RZ_API size_t rz_regex_error(int, const RzRegex *, char *, size_t)
#define ASCTIME_BUF_MINLEN
static struct sockaddr static addrlen static backlog const void static flags void flags
static int mget(RzMagic *, const ut8 *, struct rz_magic *, size_t, unsigned int)
static int match(RzMagic *, struct rz_magic *, ut32, const ut8 *, size_t, int)
static int mcopy(RzMagic *, union VALUETYPE *, int, int, const ut8 *, ut32, size_t, size_t)
static int check_fmt(RzMagic *ms, struct rz_magic *m)
#define RZ_REGEX_STARTEND
char * strdupn(const char *str, size_t n)
static void cvt_16(union VALUETYPE *, const struct rz_magic *)
static void cvt_32(union VALUETYPE *, const struct rz_magic *)
static st32 mprint(RzMagic *, struct rz_magic *)
static void cvt_float(union VALUETYPE *p, const struct rz_magic *m)
static int mconvert(RzMagic *, struct rz_magic *)
static void cvt_64(union VALUETYPE *, const struct rz_magic *)
#define DO_CVT2(fld, cast)
static void mdebug(ut32, const char *, size_t)
static int magiccheck(RzMagic *, struct rz_magic *)
static void cvt_double(union VALUETYPE *p, const struct rz_magic *m)
static ut64 file_strncmp16(const char *a, const char *b, size_t len, ut32 flags)
static int print_sep(RzMagic *, int)
static ut64 file_strncmp(const char *s1, const char *s2, size_t len, ut32 flags)
int file_softmagic(RzMagic *ms, const ut8 *buf, size_t nbytes, int mode)
static void cvt_8(union VALUETYPE *, const struct rz_magic *)
#define DO_CVT(fld, cast)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()