lib: create input port msg iterator from self {msg iterator, sink comp.}
[babeltrace.git] / src / plugins / utils / trimmer / trimmer.c
index c1c0f6921458cf963f814e41a80f31c4f9e94284..5c7ec431cc9ec64ff78157d477682173b7eb0fd3 100644 (file)
@@ -445,7 +445,7 @@ int set_bound_from_param(struct trimmer_comp *trimmer_comp,
        char tmp_arg[64];
 
        if (bt_value_is_signed_integer(param)) {
-               int64_t value = bt_value_signed_integer_get(param);
+               int64_t value = bt_value_integer_signed_get(param);
 
                /*
                 * Just convert it to a temporary string to handle
@@ -685,7 +685,8 @@ bt_component_class_message_iterator_init_method_status trimmer_msg_iter_init(
        trimmer_it->begin = trimmer_it->trimmer_comp->begin;
        trimmer_it->end = trimmer_it->trimmer_comp->end;
        trimmer_it->upstream_iter =
-               bt_self_component_port_input_message_iterator_create(
+               bt_self_component_port_input_message_iterator_create_from_message_iterator(
+                       self_msg_iter,
                        bt_self_component_filter_borrow_input_port_by_name(
                                self_comp, in_port_name));
        if (!trimmer_it->upstream_iter) {
@@ -866,6 +867,7 @@ int set_trimmer_iterator_bound(struct trimmer_iterator *trimmer_it,
 {
        struct trimmer_comp *trimmer_comp = trimmer_it->trimmer_comp;
        struct tm tm;
+       struct tm *res;
        time_t time_seconds = (time_t) (ns_from_origin / NS_PER_S);
        int ret = 0;
 
@@ -874,14 +876,14 @@ int set_trimmer_iterator_bound(struct trimmer_iterator *trimmer_it,
 
        /* We only need to extract the date from this time */
        if (is_gmt) {
-               bt_gmtime_r(&time_seconds, &tm);
+               res = bt_gmtime_r(&time_seconds, &tm);
        } else {
-               bt_localtime_r(&time_seconds, &tm);
+               res = bt_localtime_r(&time_seconds, &tm);
        }
 
-       if (errno) {
+       if (!res) {
                BT_COMP_LOGE_ERRNO("Cannot convert timestamp to date and time",
-                       "ts=%" PRId64, (int64_t) time_seconds);
+                       "ts=%" PRId64, (int64_t) time_seconds);
                ret = -1;
                goto end;
        }
@@ -1597,7 +1599,7 @@ bt_component_class_message_iterator_next_method_status handle_message(
        bt_component_class_message_iterator_next_method_status status;
        const bt_stream *stream = NULL;
        int64_t ns_from_origin = INT64_MIN;
-       bool has_ns_from_origin;
+       bool has_ns_from_origin = false;
        int ret;
 
        /* Find message's associated stream */
This page took 0.02388 seconds and 4 git commands to generate.