if (notit->cur_exp_packet_total_size == -1) {
if (notit->cur_exp_packet_content_size != -1) {
- BT_LOGW("Content size is set, but packet size is not: "
- "notit-addr=%p, packet-context-field-addr=%p, "
- "packet-size=%" PRId64 ", content-size=%" PRId64,
- notit, notit->dscopes.stream_packet_context,
- notit->cur_exp_packet_total_size,
- notit->cur_exp_packet_content_size);
- status = BT_MSG_ITER_STATUS_ERROR;
- goto end;
+ notit->cur_exp_packet_total_size =
+ notit->cur_exp_packet_content_size;
}
} else {
if (notit->cur_exp_packet_content_size == -1) {
}
}
+ BT_ASSERT((notit->cur_exp_packet_total_size >= 0 &&
+ notit->cur_exp_packet_content_size >= 0) ||
+ (notit->cur_exp_packet_total_size < 0 &&
+ notit->cur_exp_packet_content_size < 0));
+
if (notit->cur_exp_packet_content_size >
notit->cur_exp_packet_total_size) {
BT_LOGW("Invalid packet or content size: "
seq_fc->stored_length_index);
seq_field = stack_top(notit->stack)->base;
BT_ASSERT(seq_field);
- ret = bt_field_dynamic_array_set_length(seq_field, (uint64_t) length);
- if (ret) {
- BT_LOGE("Cannot set dynamic array field's length field: "
- "notit-addr=%p, field-addr=%p, "
- "length=%" PRIu64, notit, seq_field, length);
+
+ /*
+ * bfcr_get_sequence_length_cb() also gets called back for a
+ * text sequence, but the destination field is a string field.
+ * Only set the field's sequence length if the destination field
+ * is a sequence field.
+ */
+ if (!seq_fc->base.is_text) {
+ BT_ASSERT(bt_field_get_class_type(seq_field) ==
+ BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY);
+ ret = bt_field_dynamic_array_set_length(seq_field,
+ (uint64_t) length);
+ if (ret) {
+ BT_LOGE("Cannot set dynamic array field's length field: "
+ "notit-addr=%p, field-addr=%p, "
+ "length=%" PRIu64, notit, seq_field, length);
+ }
}
return length;
BT_ASSERT(notit->msg_iter);
- if (notit->snapshots.beginning_clock == UINT64_C(-1)) {
+ if (bt_stream_class_borrow_default_clock_class(notit->meta.sc->ir_sc)) {
+ uint64_t value = 0;
+
+ if (notit->snapshots.beginning_clock == UINT64_C(-1)) {
+ if (notit->prev_packet_snapshots.end_clock != UINT64_C(-1)) {
+ value = notit->prev_packet_snapshots.end_clock;
+ }
+ } else {
+ value = notit->snapshots.beginning_clock;
+ }
+
+
+ msg = bt_message_packet_beginning_create_with_default_clock_snapshot(
+ notit->msg_iter, notit->packet, value);
+ } else {
msg = bt_message_packet_beginning_create(notit->msg_iter,
notit->packet);
- } else {
- msg = bt_message_packet_beginning_create_with_default_clock_snapshot(
- notit->msg_iter, notit->packet,
- notit->snapshots.beginning_clock);
}
if (!msg) {
BT_ASSERT(notit->msg_iter);
- if (notit->snapshots.end_clock == UINT64_C(-1)) {
- msg = bt_message_packet_end_create(notit->msg_iter,
- notit->packet);
- } else {
+ if (bt_stream_class_borrow_default_clock_class(notit->meta.sc->ir_sc)) {
+ if (notit->snapshots.end_clock == UINT64_C(-1)) {
+ notit->snapshots.end_clock =
+ notit->default_clock_snapshot;
+ }
+
+ BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1));
msg = bt_message_packet_end_create_with_default_clock_snapshot(
notit->msg_iter, notit->packet,
notit->snapshots.end_clock);
+ } else {
+ msg = bt_message_packet_end_create(notit->msg_iter,
+ notit->packet);
}
if (!msg) {
ret = set_current_packet_content_sizes(notit);
if (ret) {
status = BT_MSG_ITER_STATUS_ERROR;
- goto end;
}
return status;