X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fctf-writer%2Fwriter.c;h=c0dbdbb0d5e2b12cfaea0228bc05bf6561d2440d;hb=3f5808e584c030d29db447ecffd42496d09b85fb;hp=c822d63ffc8ff6738a9ed82e6c9263406377cf57;hpb=391c8f0d0c4232a94f64a8ca0bc9590c5545388c;p=babeltrace.git diff --git a/lib/ctf-writer/writer.c b/lib/ctf-writer/writer.c index c822d63f..c0dbdbb0 100644 --- a/lib/ctf-writer/writer.c +++ b/lib/ctf-writer/writer.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ void bt_ctf_writer_destroy(struct bt_object *obj); struct bt_ctf_writer *bt_ctf_writer_create(const char *path) { + int ret; struct bt_ctf_writer *writer = NULL; if (!path) { @@ -74,6 +76,11 @@ struct bt_ctf_writer *bt_ctf_writer_create(const char *path) writer->trace->is_created_by_writer = 1; bt_object_set_parent(writer->trace, writer); bt_put(writer->trace); + + /* Default to little-endian */ + ret = bt_ctf_writer_set_byte_order(writer, BT_CTF_BYTE_ORDER_NATIVE); + assert(ret == 0); + /* Create trace directory if necessary and open a metadata file */ if (g_mkdir_with_parents(path, S_IRWXU | S_IRWXG)) { perror("g_mkdir_with_parents"); @@ -298,6 +305,10 @@ int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer, goto end; } + if (byte_order == BT_CTF_BYTE_ORDER_NATIVE) { + byte_order = BT_CTF_MY_BYTE_ORDER; + } + ret = bt_ctf_trace_set_native_byte_order(writer->trace, byte_order); end: