version 1.7, 2015/08/11 21:42:16 |
version 1.8, 2015/08/11 21:52:14 |
|
|
break; |
break; |
case MAGIC_TYPE_BESTRING16: |
case MAGIC_TYPE_BESTRING16: |
case MAGIC_TYPE_LESTRING16: |
case MAGIC_TYPE_LESTRING16: |
magic_warn(ml, "unsupported type %s", ml->type_string); |
magic_warn(ml, "unsupported type: %s", ml->type_string); |
return (-1); |
return (-1); |
} |
} |
} |
} |
|
|
|
|
endptr = magic_strtoll(s, &ml->indirect_offset); |
endptr = magic_strtoll(s, &ml->indirect_offset); |
if (endptr == NULL) { |
if (endptr == NULL) { |
magic_warn(ml, "can't parse offset"); |
magic_warn(ml, "can't parse offset: %s", s); |
goto fail; |
goto fail; |
} |
} |
s = endptr; |
s = endptr; |
|
|
if (*s == '.') { |
if (*s == '.') { |
s++; |
s++; |
if (*s == '\0' || strchr("bslBSL", *s) == NULL) { |
if (*s == '\0' || strchr("bslBSL", *s) == NULL) { |
magic_warn(ml, "unknown offset type"); |
magic_warn(ml, "unknown offset type: %c", *s); |
goto fail; |
goto fail; |
} |
} |
ml->indirect_type = *s; |
ml->indirect_type = *s; |
|
|
} |
} |
|
|
if (*s == '\0' || strchr("+-*", *s) == NULL) { |
if (*s == '\0' || strchr("+-*", *s) == NULL) { |
magic_warn(ml, "unknown offset operator"); |
magic_warn(ml, "unknown offset operator: %c", *s); |
goto fail; |
goto fail; |
} |
} |
ml->indirect_operator = *s; |
ml->indirect_operator = *s; |
|
|
ml->type_operator = *cp; |
ml->type_operator = *cp; |
endptr = magic_strtoull(cp + 1, &ml->type_operand); |
endptr = magic_strtoull(cp + 1, &ml->type_operand); |
if (endptr == NULL || *endptr != '\0') { |
if (endptr == NULL || *endptr != '\0') { |
magic_warn(ml, "can't parse operand"); |
magic_warn(ml, "can't parse operand: %s", cp + 1); |
goto fail; |
goto fail; |
} |
} |
*cp = '\0'; |
*cp = '\0'; |
|
|
else if (strcmp(s, "default") == 0) |
else if (strcmp(s, "default") == 0) |
ml->type = MAGIC_TYPE_DEFAULT; |
ml->type = MAGIC_TYPE_DEFAULT; |
else { |
else { |
magic_warn(ml, "unknown type"); |
magic_warn(ml, "unknown type: %s", s); |
goto fail; |
goto fail; |
} |
} |
magic_mark_text(ml, 0); |
magic_mark_text(ml, 0); |
|
|
else |
else |
endptr = magic_strtoll(s, &ml->test_signed); |
endptr = magic_strtoll(s, &ml->test_signed); |
if (endptr == NULL || *endptr != '\0') { |
if (endptr == NULL || *endptr != '\0') { |
magic_warn(ml, "can't parse number"); |
magic_warn(ml, "can't parse number: %s", s); |
goto fail; |
goto fail; |
} |
} |
|
|