}
size = integer_type->declaration.len;
- min_value = -((int64_t)1 << (size - 1));
- max_value = ((int64_t)1 << (size - 1)) - 1;
+ min_value = -(1ULL << (size - 1));
+ max_value = (1ULL << (size - 1)) - 1;
if (value < min_value || value > max_value) {
ret = -1;
goto end;
}
size = integer_type->declaration.len;
- max_value = (size == 64) ? UINT64_MAX : ((uint64_t)1 << size) - 1;
+ max_value = (size == 64) ? UINT64_MAX : ((uint64_t) 1 << size) - 1;
if (value > max_value) {
ret = -1;
goto end;
BT_HIDDEN
void bt_ctf_field_freeze(struct bt_ctf_field *field)
{
+ enum bt_ctf_type_id type_id;
+
if (!field) {
goto end;
}
- field_freeze_funcs[bt_ctf_field_get_type_id(field)](field);
+ type_id = bt_ctf_field_get_type_id(field);
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
+ type_id >= BT_CTF_NR_TYPE_IDS) {
+ goto end;
+ }
+ field_freeze_funcs[type_id](field);
end:
return;
}