struct fs_sink_ctf_field_class *tgt_fc = NULL;
uint64_t i;
int64_t si;
- const char *tgt_fc_name;
+ const char *tgt_fc_name = NULL;
struct field_path_elem *field_path_elem;
/* Get target field class's name */
i = 0;
- while (i < bt_field_path_get_index_count(tgt_ir_field_path)) {
- uint64_t index = bt_field_path_get_index_by_index(
- tgt_ir_field_path, i);
+ while (i < bt_field_path_get_item_count(tgt_ir_field_path)) {
+ const bt_field_path_item *fp_item =
+ bt_field_path_borrow_item_by_index_const(
+ tgt_ir_field_path, i);
struct fs_sink_ctf_named_field_class *named_fc = NULL;
BT_ASSERT(tgt_fc);
+ BT_ASSERT(fp_item);
switch (tgt_fc->type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
- (void *) tgt_fc, index);
+ (void *) tgt_fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_variant_borrow_option_by_index(
- (void *) tgt_fc, index);
+ (void *) tgt_fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY:
case FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE:
struct fs_sink_ctf_field_class_array_base *array_base_fc =
(void *) tgt_fc;
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT);
tgt_fc = array_base_fc->elem_fc;
break;
}
BT_ASSERT(fc);
- for (i = 0; i < bt_field_path_get_index_count(tgt_ir_field_path); i++) {
- uint64_t index = bt_field_path_get_index_by_index(
- tgt_ir_field_path, i);
+ for (i = 0; i < bt_field_path_get_item_count(tgt_ir_field_path); i++) {
+ const bt_field_path_item *fp_item =
+ bt_field_path_borrow_item_by_index_const(
+ tgt_ir_field_path, i);
struct fs_sink_ctf_named_field_class *named_fc = NULL;
+ if (bt_field_path_item_get_type(fp_item) !=
+ BT_FIELD_PATH_ITEM_TYPE_INDEX) {
+ /* Not supported by TSDL 1.8 */
+ ret = -1;
+ goto end;
+ }
+
switch (fc->type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
- (void *) fc, index);
+ (void *) fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_variant_borrow_option_by_index(
- (void *) fc, index);
+ (void *) fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
- case FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY:
- case FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE:
- /* Not supported by TSDL 1.8 */
- ret = -1;
- goto end;
default:
abort();
}
* sequence field class.
*/
static
-int set_field_refs(struct fs_sink_ctf_field_class *fc, const char *fc_name,
- struct fs_sink_ctf_field_class *parent_fc)
+int set_field_refs(struct fs_sink_ctf_field_class * const fc,
+ const char *fc_name, struct fs_sink_ctf_field_class *parent_fc)
{
int ret = 0;
+ enum fs_sink_ctf_field_class_type fc_type;
BT_ASSERT(fc);
- switch (fc->type) {
+ fc_type = fc->type;
+
+ switch (fc_type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
{
uint64_t i;
uint64_t len;
struct fs_sink_ctf_field_class_struct *struct_fc;
- struct fs_sink_ctf_field_class_variant *var_fc;
+ struct fs_sink_ctf_field_class_variant *var_fc = NULL;
struct fs_sink_ctf_named_field_class *named_fc;
- if (fc->type == FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT) {
+ if (fc_type == FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT) {
struct_fc = (void *) fc;
len = struct_fc->members->len;
} else {
}
for (i = 0; i < len; i++) {
- if (fc->type == FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT) {
+ if (fc_type == FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT) {
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
struct_fc, i);
} else {
struct fs_sink_ctf_field_class_array_base *array_base_fc =
(void *) fc;
- if (fc->type == FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE) {
+ if (fc_type == FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE) {
ret = set_field_ref(fc, fc_name, parent_fc);
if (ret) {
goto end;
const char *name = bt_clock_class_get_name(
(*out_sc)->default_clock_class);
- if (!bt_stream_class_default_clock_is_always_known(ir_sc)) {
- BT_LOGE("Unsupported stream clock which can have an unknown value: "
- "sc-name=\"%s\"",
- bt_stream_class_get_name(ir_sc));
- goto error;
- }
-
if (name) {
/* Try original name, protected */
g_string_assign((*out_sc)->default_clock_class_name,
}
switch (bt_value_get_type(val)) {
- case BT_VALUE_TYPE_INTEGER:
+ case BT_VALUE_TYPE_SIGNED_INTEGER:
case BT_VALUE_TYPE_STRING:
break;
default: