From 6468dbd6647f512766fbd6924ebd6038488352c3 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Wed, 17 May 2017 17:00:04 -0400 Subject: [PATCH] fix copytrace: set the byte order MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- plugins/libctfcopytrace/ctfcopytrace.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 0689ee38..9789e5c4 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -833,6 +833,7 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, enum bt_component_status ret = BT_COMPONENT_STATUS_OK; int field_count, i, int_ret; struct bt_ctf_field_type *header_type = NULL; + enum bt_ctf_byte_order order; field_count = bt_ctf_trace_get_environment_field_count(trace); for (i = 0; i < field_count; i++) { @@ -870,6 +871,20 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, } } + order = bt_ctf_trace_get_native_byte_order(trace); + if (order == BT_CTF_BYTE_ORDER_UNKNOWN) { + fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); + ret = BT_COMPONENT_STATUS_ERROR; + goto end; + } + + ret = bt_ctf_trace_set_native_byte_order(writer_trace, order); + if (ret) { + fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); + ret = BT_COMPONENT_STATUS_ERROR; + goto end; + } + header_type = bt_ctf_trace_get_packet_header_type(writer_trace); if (!header_type) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); -- 2.34.1