Fix SEEK_BEGIN for streams that do not contain any event
[babeltrace.git] / lib / iterator.c
index a06d66bdd34790feaea7a2ca477b59b0b89fd93a..c50b0ef36c18085496b0933832b9dd3df5ec3044 100644 (file)
@@ -381,8 +381,8 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
                        stream->prev_cycles_timestamp = 0;
                        stream->prev_cycles_timestamp_end = 0;
 
-                       printf_debug("restored to cur_index = %zd and "
-                               "offset = %zd, timestamp = %" PRIu64 "\n",
+                       printf_debug("restored to cur_index = %" PRId64 " and "
+                               "offset = %" PRId64 ", timestamp = %" PRIu64 "\n",
                                stream_pos->cur_index,
                                stream_pos->offset, stream->real_timestamp);
 
@@ -471,6 +471,10 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
                                        if (ret != 0 && ret != EOF) {
                                                goto error;
                                        }
+                                       if (ret == EOF) {
+                                               /* Do not add EOF streams */
+                                               continue;
+                                       }
                                        ret = heap_insert(iter->stream_heap, file_stream);
                                        if (ret)
                                                goto error;
@@ -625,7 +629,6 @@ static int babeltrace_filestream_seek(struct ctf_file_stream *file_stream,
                break;
        case BT_SEEK_TIME:
        case BT_SEEK_RESTORE:
-       case BT_SEEK_END:
        default:
                assert(0); /* Not yet defined */
        }
This page took 0.023814 seconds and 4 git commands to generate.