Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: set effective byte order of FT copy _and_ original #103

Open
wants to merge 1 commit into
base: stable-1.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions formats/ctf/ir/stream-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,20 @@ int bt_ctf_stream_class_add_event_class(
bt_object_set_parent(event_class, stream_class);

if (trace) {
if (stream_class->byte_order) {
/*
* Set the effective byte order of all the event
* class's field type now as we are about to
* maybe replace some field types (with
* bt_ctf_validation_replace_types()). This
* allows the user to use the original field
* type to create a field and still have the
* correct effective byte order.
*/
bt_ctf_event_class_set_native_byte_order(event_class,
stream_class->byte_order);
}

/*
* At this point we know that the function will be
* successful. Therefore we can replace the event
Expand Down
9 changes: 9 additions & 0 deletions formats/ctf/ir/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,15 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
bt_object_set_parent(stream_class, trace);
g_ptr_array_add(trace->stream_classes, stream_class);

/*
* Set the effective byte order of all the stream class's field
* type now as we are about to maybe replace some field types
* (with bt_ctf_validation_replace_types()). This allows the
* user to use the original field type to create a field and
* still have the correct effective byte order.
*/
bt_ctf_stream_class_set_byte_order(stream_class, trace->byte_order);

/*
* At this point we know that the function will be successful.
* Therefore we can replace the trace and stream class field
Expand Down