X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fctf-ir%2Ffield-types.c;h=06d8c76717571d136e5d9e3a9d529125e6d5b830;hb=aa15981cec13ee886e86b7d3755b9654cebafc0c;hp=78feecb9fa624715df70c2dc5b201f2fd853ac09;hpb=1c07c8a447070164bc709950997f848fc0cc98fe;p=babeltrace.git diff --git a/lib/ctf-ir/field-types.c b/lib/ctf-ir/field-types.c index 78feecb9..06d8c767 100644 --- a/lib/ctf-ir/field-types.c +++ b/lib/ctf-ir/field-types.c @@ -981,7 +981,7 @@ end: } int bt_ctf_field_type_integer_set_size(struct bt_ctf_field_type *type, - size_t size) + unsigned int size) { int ret = 0; struct bt_ctf_field_type_integer *integer; @@ -1009,14 +1009,14 @@ int bt_ctf_field_type_integer_set_size(struct bt_ctf_field_type *type, if (size == 0 || size > 64) { BT_LOGW("Invalid parameter: size must be between 1 and 64: " - "addr=%p, size=%zu", type, size); + "addr=%p, size=%u", type, size); ret = -1; goto end; } integer = container_of(type, struct bt_ctf_field_type_integer, parent); integer->size = size; - BT_LOGV("Set integer field type's size: addr=%p, size=%zu", + BT_LOGV("Set integer field type's size: addr=%p, size=%u", type, size); end: return ret; @@ -1073,6 +1073,7 @@ int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type, } switch (base) { + case BT_CTF_INTEGER_BASE_UNSPECIFIED: case BT_CTF_INTEGER_BASE_BINARY: case BT_CTF_INTEGER_BASE_OCTAL: case BT_CTF_INTEGER_BASE_DECIMAL: @@ -3223,7 +3224,7 @@ int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type *type, byte_order != BT_CTF_BYTE_ORDER_LITTLE_ENDIAN && byte_order != BT_CTF_BYTE_ORDER_BIG_ENDIAN && byte_order != BT_CTF_BYTE_ORDER_NETWORK) { - BT_LOGW("Invalid parameter: unknown byte order: " + BT_LOGW("Invalid parameter: invalid byte order: " "addr=%p, bo=%s", type, bt_ctf_byte_order_string(byte_order)); ret = -1; @@ -3900,6 +3901,7 @@ const char *get_integer_base_string(enum bt_ctf_integer_base base) switch (base) { case BT_CTF_INTEGER_BASE_DECIMAL: + case BT_CTF_INTEGER_BASE_UNSPECIFIED: base_string = "decimal"; break; case BT_CTF_INTEGER_BASE_HEXADECIMAL: @@ -4065,7 +4067,7 @@ int bt_ctf_field_type_structure_serialize(struct bt_ctf_field_type *type, struct structure_field *field = structure->fields->pdata[i]; BT_LOGD("Serializing structure field type's field metadata: " - "index=%" PRId64 ", " + "index=%zu, " "field-ft-addr=%p, field-name=\"%s\"", i, field, g_quark_to_string(field->name)); @@ -4079,7 +4081,7 @@ int bt_ctf_field_type_structure_serialize(struct bt_ctf_field_type *type, ret = bt_ctf_field_type_serialize(field->type, context); if (ret) { BT_LOGW("Cannot serialize structure field type's field's metadata: " - "index=%" PRId64 ", " + "index=%zu, " "field-ft-addr=%p, field-name=\"%s\"", i, field->type, g_quark_to_string(field->name)); @@ -4133,7 +4135,7 @@ int bt_ctf_field_type_variant_serialize(struct bt_ctf_field_type *type, struct structure_field *field = variant->fields->pdata[i]; BT_LOGD("Serializing variant field type's field metadata: " - "index=%" PRId64 ", " + "index=%zu, " "field-ft-addr=%p, field-name=\"%s\"", i, field, g_quark_to_string(field->name)); @@ -4149,7 +4151,7 @@ int bt_ctf_field_type_variant_serialize(struct bt_ctf_field_type *type, ret = bt_ctf_field_type_serialize(field->type, context); if (ret) { BT_LOGW("Cannot serialize variant field type's field's metadata: " - "index=%" PRId64 ", " + "index=%zu, " "field-ft-addr=%p, field-name=\"%s\"", i, field->type, g_quark_to_string(field->name)); @@ -5282,9 +5284,15 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( switch (type_id) { case CTF_TYPE_STRUCT: - bt_ctf_field_type_structure_get_field_by_index(field_type, - NULL, &field, index); + { + int ret = bt_ctf_field_type_structure_get_field_by_index( + field_type, NULL, &field, index); + if (ret) { + field = NULL; + goto end; + } break; + } case CTF_TYPE_VARIANT: { int ret = bt_ctf_field_type_variant_get_field_by_index(