#include "query.h"
#include <stdbool.h>
-#include <assert.h>
+#include <babeltrace/assert-internal.h>
#include "metadata.h"
#include "../common/metadata/decoder.h"
#include <babeltrace/common-internal.h>
goto error;
}
+ BT_ASSERT(params);
+
if (!bt_value_is_map(params)) {
BT_LOGE_STR("Query parameters is not a map value object.");
query_ret.status = BT_QUERY_STATUS_INVALID_PARAMS;
goto error;
}
- assert(path);
+ BT_ASSERT(path);
metadata_fp = ctf_fs_metadata_open_file(path);
if (!metadata_fp) {
BT_LOGE("Cannot open trace metadata: path=\"%s\".", path);
}
static
-int add_stream_ids(struct bt_value *info, struct bt_ctf_stream *stream)
+int add_stream_ids(struct bt_value *info, struct bt_stream *stream)
{
int ret = 0;
int64_t stream_class_id, stream_instance_id;
enum bt_value_status status;
- struct bt_ctf_stream_class *stream_class = NULL;
+ struct bt_stream_class *stream_class = NULL;
- stream_instance_id = bt_ctf_stream_get_id(stream);
+ stream_instance_id = bt_stream_get_id(stream);
if (stream_instance_id != -1) {
status = bt_value_map_insert_integer(info, "id",
stream_instance_id);
}
}
- stream_class = bt_ctf_stream_get_class(stream);
+ stream_class = bt_stream_get_class(stream);
if (!stream_class) {
ret = -1;
goto end;
}
- stream_class_id = bt_ctf_stream_class_get_id(stream_class);
+ stream_class_id = bt_stream_class_get_id(stream_class);
if (stream_class_id == -1) {
ret = -1;
goto end;
goto end;
}
- assert(trace->ds_file_groups);
+ BT_ASSERT(trace->ds_file_groups);
/* Add trace range info only if it contains streams. */
if (trace->ds_file_groups->len == 0) {
ret = -1;
if (ret) {
goto end;
}
- ret = add_range(trace_info, &trace_intersection,
- "intersection-range-ns");
- if (ret) {
- goto end;
+
+ if (trace_intersection.begin_ns < trace_intersection.end_ns) {
+ ret = add_range(trace_info, &trace_intersection,
+ "intersection-range-ns");
+ if (ret) {
+ goto end;
+ }
}
status = bt_value_map_insert(trace_info, "streams", file_groups);
GList *tn_node = NULL;
GString *normalized_path = NULL;
+ BT_ASSERT(params);
+
if (!bt_value_is_map(params)) {
BT_LOGE("Query parameters is not a map value object.");
query_ret.status = BT_QUERY_STATUS_INVALID_PARAMS;
BT_LOGE("Failed to normalize path: `%s`.", path);
goto error;
}
- assert(path);
+ BT_ASSERT(path);
ret = ctf_fs_find_traces(&trace_paths, normalized_path->str);
if (ret) {