babeltrace-log: pass single-trace=yes to sink.ctf.fs
[babeltrace.git] / plugins / libctfcopytrace / ctfcopytrace.c
index 4f0811e35e8b72b45b6aa3487a9ba2aaca10f4a2..2b408ace8d1765bb73ecdaa4d379a8a71d232e2e 100644 (file)
@@ -58,7 +58,8 @@ struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err,
                goto end;
        }
 
-       writer_clock_class = bt_ctf_clock_class_create(name);
+       writer_clock_class = bt_ctf_clock_class_create(name,
+               bt_ctf_clock_class_get_frequency(clock_class));
        if (!writer_clock_class) {
                fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
                                __LINE__);
@@ -76,19 +77,6 @@ struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err,
                }
        }
 
-       u64_ret = bt_ctf_clock_class_get_frequency(clock_class);
-       if (u64_ret == -1ULL) {
-               fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
-                               __LINE__);
-               goto end_destroy;
-       }
-       int_ret = bt_ctf_clock_class_set_frequency(writer_clock_class, u64_ret);
-       if (int_ret != 0) {
-               fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
-                               __LINE__);
-               goto end_destroy;
-       }
-
        u64_ret = bt_ctf_clock_class_get_precision(clock_class);
        if (u64_ret == -1ULL) {
                fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
@@ -867,6 +855,7 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
        struct bt_ctf_field_type *header_type = NULL;
        enum bt_ctf_byte_order order;
        const char *trace_name;
+       const unsigned char *trace_uuid;
 
        field_count = bt_ctf_trace_get_environment_field_count(trace);
        for (i = 0; i < field_count; i++) {
@@ -947,6 +936,16 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
                }
        }
 
+       trace_uuid = bt_ctf_trace_get_uuid(trace);
+       if (trace_uuid) {
+               int_ret = bt_ctf_trace_set_uuid(writer_trace, trace_uuid);
+               if (int_ret < 0) {
+                       fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__);
+                       ret = BT_COMPONENT_STATUS_ERROR;
+                       goto end;
+               }
+       }
+
 end:
        return ret;
 }
This page took 0.024731 seconds and 4 git commands to generate.