X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Futils%2Ftrimmer%2Ftrimmer.c;h=4d39fba27cdbd662e5d1df2e21c830e6a7fb66e3;hp=b18d976b0fe9ad8905de5307a8d6006d62ad7f3d;hb=f2fb1b3297ca0bc13b53189a063b63944be7fae9;hpb=0a6d7302f774fbd35d7439889734acd418e8ef14 diff --git a/src/plugins/utils/trimmer/trimmer.c b/src/plugins/utils/trimmer/trimmer.c index b18d976b..4d39fba2 100644 --- a/src/plugins/utils/trimmer/trimmer.c +++ b/src/plugins/utils/trimmer/trimmer.c @@ -998,14 +998,25 @@ bt_component_class_message_iterator_next_method_status state_seek_initially( struct trimmer_iterator *trimmer_it) { struct trimmer_comp *trimmer_comp = trimmer_it->trimmer_comp; - bt_component_class_message_iterator_next_method_status status = - BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; + bt_component_class_message_iterator_next_method_status status; BT_ASSERT(trimmer_it->begin.is_set); if (trimmer_it->begin.is_infinite) { - if (!bt_self_component_port_input_message_iterator_can_seek_beginning( - trimmer_it->upstream_iter)) { + bt_bool can_seek; + + status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning( + trimmer_it->upstream_iter, &can_seek); + if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) { + if (status < 0) { + BT_COMP_LOGE_APPEND_CAUSE(trimmer_comp->self_comp, + "Cannot make upstream message iterator initially seek its beginning."); + } + + goto end; + } + + if (!can_seek) { BT_COMP_LOGE_APPEND_CAUSE(trimmer_comp->self_comp, "Cannot make upstream message iterator initially seek its beginning."); status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR; @@ -1015,9 +1026,23 @@ bt_component_class_message_iterator_next_method_status state_seek_initially( status = (int) bt_self_component_port_input_message_iterator_seek_beginning( trimmer_it->upstream_iter); } else { - if (!bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( - trimmer_it->upstream_iter, - trimmer_it->begin.ns_from_origin)) { + bt_bool can_seek; + + status = (int) bt_self_component_port_input_message_iterator_can_seek_ns_from_origin( + trimmer_it->upstream_iter, trimmer_it->begin.ns_from_origin, + &can_seek); + + if (status != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) { + if (status < 0) { + BT_COMP_LOGE_APPEND_CAUSE(trimmer_comp->self_comp, + "Cannot make upstream message iterator initially seek: seek-ns-from-origin=%" PRId64, + trimmer_it->begin.ns_from_origin); + } + + goto end; + } + + if (!can_seek) { BT_COMP_LOGE_APPEND_CAUSE(trimmer_comp->self_comp, "Cannot make upstream message iterator initially seek: seek-ns-from-origin=%" PRId64, trimmer_it->begin.ns_from_origin);