- /*
- * file range is from timestamp_begin of the first entry to the
- * timestamp_end of the last entry.
- */
- file_begin_epoch = ((struct ctf_fs_ds_index_entry *) &g_array_index(info->index->entries,
- struct ctf_fs_ds_index_entry, 0))->timestamp_begin_ns;
- file_end_epoch = ((struct ctf_fs_ds_index_entry *) &g_array_index(info->index->entries,
- struct ctf_fs_ds_index_entry, info->index->entries->len - 1))->timestamp_end_ns;
+ /*
+ * Since each `struct ctf_fs_ds_file_group` has a sorted array of
+ * `struct ctf_fs_ds_index_entry`, we can compute the stream range from
+ * the timestamp_begin of the first index entry and the timestamp_end
+ * of the last index entry.
+ */
+ BT_ASSERT(group->index);
+ BT_ASSERT(group->index->entries);
+ BT_ASSERT(group->index->entries->len > 0);