Lines Matching refs:m

555  		static const size_t len = sizeof(*m) * ALLOC_CHUNK;
558 - if ((m = CAST(struct magic *, malloc(len))) == NULL) {
559 + if ((m = CAST(struct magic *, emalloc(len))) == NULL) {
564 m->type = get_standard_integer_type(l, &l);
566 m->type = FILE_STRING;
574 m->mask_op = 0;
576 - if (!IS_STRING(m->type))
577 + if (!IS_LIBMAGIC_STRING(m->type))
578 m->mask_op |= FILE_OPINVERSE;
582 m->str_range = 0;
583 m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0;
585 - if (IS_STRING(m->type)) {
586 + if (IS_LIBMAGIC_STRING(m->type)) {
591 if (check_format(ms, m) == -1)
596 - file_mdump(m);
599 m->mimetype[0] = '\0'; /* initialise MIME type to none */
612 struct magic *m = &me->mp[0];
617 sizeof(m->mimetype), "MIME", "+-/.", 1);
623 if (m->type == FILE_REGEX) {
625 - int rc = file_regcomp(&rx, m->value.s, REG_EXTENDED);
634 + convert_libmagic_pattern(&pattern, m->value.s, strlen(m->value.s), options);
832 static const size_t m = sizeof(**map->magic);
838 struct magic m;
871 len = m * map->nmagic[i];
917 m->offset = swap4((uint32_t)m->offset);
918 m->in_offset = swap4((uint32_t)m->in_offset);
919 m->lineno = swap4((uint32_t)m->lineno);
920 - if (IS_STRING(m->type)) {
921 + if (IS_LIBMAGIC_STRING(m->type)) {
922 m->str_range = swap4(m->str_range);
923 m->str_flags = swap4(m->str_flags);
2138 int m = 0, rv = 0, looks_text = 0;
2149 - if ((m = file_zmagic(ms, fd, inname, ubuf, nb)) != 0) {
2150 + if ((m = file_zmagic(ms, stream, inname, ubuf, nb)) != 0) {
2152 (void)fprintf(stderr, "zmagic %d\n", m);
2159 - if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) {
2161 - (void)fprintf(stderr, "cdf %d\n", m);
2166 + if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) {
2168 + (void)fprintf(stderr, "cdf %d\n", m);
2187 return m;
2891 -file_mdump(struct magic *m)
2896 - (void) fprintf(stderr, "%u: %.*s %u", m->lineno,
2897 - (m->cont_level & 7) + 1, ">>>>>>>>", m->offset);
2899 - if (m->flag & INDIR) {
2902 - (m->in_type < file_nnames) ? file_names[m->in_type] :
2904 - if (m->in_op & FILE_OPINVERSE)
2907 - ((size_t)(m->in_op & FILE_OPS_MASK) <
2908 - SZOF(optyp)) ? optyp[m->in_op & FILE_OPS_MASK] : '?',
2909 - m->in_offset);
2911 - (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "",
2913 - (m->type < file_nnames) ? file_names[m->type] : "*bad type");
2914 - if (m->mask_op & FILE_OPINVERSE)
2917 - if (IS_STRING(m->type)) {
2918 - if (m->str_flags) {
2920 - if (m->str_flags & STRING_COMPACT_WHITESPACE)
2922 - if (m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE)
2925 - if (m->str_flags & STRING_IGNORE_LOWERCASE)
2927 - if (m->str_flags & STRING_IGNORE_UPPERCASE)
2929 - if (m->str_flags & REGEX_OFFSET_START)
2931 - if (m->str_flags & STRING_TEXTTEST)
2933 - if (m->str_flags & STRING_BINTEST)
2935 - if (m->str_flags & PSTRING_1_BE)
2937 - if (m->str_flags & PSTRING_2_BE)
2939 - if (m->str_flags & PSTRING_2_LE)
2941 - if (m->str_flags & PSTRING_4_BE)
2943 - if (m->str_flags & PSTRING_4_LE)
2945 - if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF)
2950 - if (m->str_range)
2951 - (void) fprintf(stderr, "/%u", m->str_range);
2954 - if ((size_t)(m->mask_op & FILE_OPS_MASK) < SZOF(optyp))
2955 - (void) fputc(optyp[m->mask_op & FILE_OPS_MASK], stderr);
2959 - if (m->num_mask) {
2961 - (unsigned long long)m->num_mask);
2964 - (void) fprintf(stderr, ",%c", m->reln);
2966 - if (m->reln != 'x') {
2967 - switch (m->type) {
2977 - (void) fprintf(stderr, "%d", m->value.l);
2983 - (unsigned long long)m->value.q);
2991 - file_showstr(stderr, m->value.s, (size_t)m->vallen);
2998 - file_fmttime(m->value.l, FILE_T_LOCAL, tbuf));
3005 - file_fmttime(m->value.l, 0, tbuf));
3011 - file_fmttime(m->value.q, FILE_T_LOCAL, tbuf));
3017 - file_fmttime(m->value.q, 0, tbuf));
3023 - file_fmttime(m->value.q, FILE_T_WINDOWS, tbuf));
3028 - (void) fprintf(stderr, "%G", m->value.f);
3033 - (void) fprintf(stderr, "%G", m->value.d);
3040 - (void) fprintf(stderr, "'%s'", m->value.s);
3043 - (void) fprintf(stderr, "*bad type %d*", m->type);
3047 - (void) fprintf(stderr, ",\"%s\"]\n", m->desc);
3295 " with `%s'", file, line, m->desc, def);
3307 struct magic *m = &magic[magindex];
3309 if (m->type != FILE_NAME)
3310 - if ((IS_STRING(m->type) &&
3311 + if ((IS_LIBMAGIC_STRING(m->type) &&
3313 ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
3314 (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
3317 check_fmt(struct magic_set *ms, struct magic *m)
3326 if (strchr(m->desc, '%') == NULL)
3337 - rc = file_regexec(&rx, m->desc, 0, 0, 0);
3339 + rv = !pcre_exec(pce, re_extra, m->desc, strlen(m->desc), 0, re_options, NULL, 0);
3367 mprint(struct magic_set *ms, struct magic *m)
3384 rval = file_printf(ms, F(ms, m, "%s"),
3396 + if (file_printf(ms, F(ms, m, "%s"), m->value.s) == -1)
3398 + if ((m->str_flags & REGEX_OFFSET_START))
3401 + t = ms->search.offset + m->vallen;
3406 if (file_printf(ms, "%s", m->desc) == -1)
3408 if (m->num_mask) \
3409 switch (m->mask_op & FILE_OPS_MASK) { \
3411 - p->fld += cast m->num_mask; \
3412 + p->fld += cast (int64_t)m->num_mask; \
3415 - p->fld -= cast m->num_mask; \
3416 + p->fld -= cast (int64_t)m->num_mask; \
3419 - p->fld *= cast m->num_mask; \
3420 + p->fld *= cast (int64_t)m->num_mask; \
3423 - p->fld /= cast m->num_mask; \
3424 + p->fld /= cast (int64_t)m->num_mask; \
3432 - if (m->str_flags & REGEX_LINE_COUNT) {
3433 - linecnt = m->str_range;
3437 - bytecnt = m->str_range;
3441 + linecnt = m->str_range;
3465 m->type, m->flag, offset, o, nbytes,
3469 - file_mdump(m);
3473 if (m->flag & INDIR) {
3479 - file_mdump(m);
3487 file_printf(ms, F(ms, m, "%u"), offset) == -1) {
3534 + ZSTR_VAL(t)[j++] = 'm';
3543 magiccheck(struct magic_set *ms, struct magic *m)
3561 - rc = file_regcomp(&rx, m->value.s,
3563 - ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
3567 + if (m->str_flags & STRING_IGNORE_CASE) {
3571 + convert_libmagic_pattern(&pattern, (char *)m->value.s, m->vallen, options);