X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fiterator.c;h=b205a93764ddc1940db73a35365977a586314b7b;hp=a06d66bdd34790feaea7a2ca477b59b0b89fd93a;hb=38380786954798ace38594b1e92905aeba4da55d;hpb=4b8de1531a2a5b5ef8ca87ad104567de4f74f469 diff --git a/lib/iterator.c b/lib/iterator.c index a06d66bd..b205a937 100644 --- a/lib/iterator.c +++ b/lib/iterator.c @@ -253,7 +253,7 @@ static int find_max_timestamp_ctf_stream_class( struct ctf_file_stream **cfsp, uint64_t *max_timestamp) { - int ret = EOF, i; + int ret = EOF, i, found = 0; for (i = 0; i < stream_class->streams->len; i++) { struct ctf_stream_definition *stream; @@ -272,9 +272,13 @@ static int find_max_timestamp_ctf_stream_class( if (current_max_ts >= *max_timestamp) { *max_timestamp = current_max_ts; *cfsp = cfs; + found = 1; } } assert(ret >= 0 || ret == EOF); + if (found) { + return 0; + } return ret; } @@ -381,8 +385,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 +475,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 +633,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 */ }