src.ctf.fs: make ctf_fs_ds_file::stream a bt2::Stream::Shared
[babeltrace.git] / src / plugins / ctf / fs-src / fs.cpp
index 40e50085fa87aabf8543bcbf35a3518c38668195..ac4c720c816ef37f7bed3ee552f6b746572df7b8 100644 (file)
@@ -523,7 +523,8 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const
      * Create a temporary ds_file to read some properties about the data
      * stream file.
      */
-    ds_file = ctf_fs_ds_file_create(ctf_fs_trace, NULL, path, ctf_fs_trace->logger);
+    ds_file =
+        ctf_fs_ds_file_create(ctf_fs_trace, bt2::Stream::Shared {}, path, ctf_fs_trace->logger);
     if (!ds_file) {
         goto error;
     }
@@ -1135,7 +1136,8 @@ static int decode_clock_snapshot_after_event(struct ctf_fs_trace *ctf_fs_trace,
     BT_ASSERT(index_entry);
     BT_ASSERT(index_entry->path);
 
-    ds_file = ctf_fs_ds_file_create(ctf_fs_trace, NULL, index_entry->path, ctf_fs_trace->logger);
+    ds_file = ctf_fs_ds_file_create(ctf_fs_trace, bt2::Stream::Shared {}, index_entry->path,
+                                    ctf_fs_trace->logger);
     if (!ds_file) {
         BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger, "Failed to create a ctf_fs_ds_file");
         ret = -1;
@@ -1835,18 +1837,20 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace)
         BT_ASSERT(ds_file_group->sc->ir_sc);
         BT_ASSERT(ctf_fs_trace->trace);
 
+        bt_stream *stream;
+
         if (ds_file_group->stream_id == UINT64_C(-1)) {
             /* No stream ID: use 0 */
-            ds_file_group->stream = bt_stream_create_with_id(
-                ds_file_group->sc->ir_sc, ctf_fs_trace->trace, ctf_fs_trace->next_stream_id);
+            stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace,
+                                              ctf_fs_trace->next_stream_id);
             ctf_fs_trace->next_stream_id++;
         } else {
             /* Specific stream ID */
-            ds_file_group->stream = bt_stream_create_with_id(
-                ds_file_group->sc->ir_sc, ctf_fs_trace->trace, (uint64_t) ds_file_group->stream_id);
+            stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace,
+                                              (uint64_t) ds_file_group->stream_id);
         }
 
-        if (!ds_file_group->stream) {
+        if (!stream) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
                                          "Cannot create stream for DS file group: "
                                          "addr={}, stream-name=\"{}\"",
@@ -1854,12 +1858,14 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace)
             goto error;
         }
 
-        ret = bt_stream_set_name(ds_file_group->stream, name->str);
+        ds_file_group->stream = bt2::Stream::Shared::createWithoutRef(stream);
+
+        ret = bt_stream_set_name(ds_file_group->stream->libObjPtr(), name->str);
         if (ret) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
                                          "Cannot set stream's name: "
                                          "addr={}, stream-name=\"{}\"",
-                                         fmt::ptr(ds_file_group->stream), name->str);
+                                         fmt::ptr(ds_file_group->stream->libObjPtr()), name->str);
             goto error;
         }
 
This page took 0.02473 seconds and 4 git commands to generate.