X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Ftext%2Fpretty%2Fprint.c;h=bdc1eb9801b5c0e8d1341d7f173ee721d2ebd618;hb=2e90378a2b94006e2743b06e7fe7a1f0e691a56e;hp=5e63deb0bca15d9145a249bc1514231be58de3c3;hpb=1d9f5cd6724aafdccf82c57ee0125bbc7cfb4027;p=babeltrace.git diff --git a/plugins/text/pretty/print.c b/plugins/text/pretty/print.c index 5e63deb0..bdc1eb98 100644 --- a/plugins/text/pretty/print.c +++ b/plugins/text/pretty/print.c @@ -226,14 +226,7 @@ int print_event_timestamp(struct pretty_component *pretty, goto end; } - if (bt_message_event_borrow_default_clock_snapshot_const(event_msg, - &clock_snapshot) != BT_CLOCK_SNAPSHOT_STATE_KNOWN) { - /* - * No known default clock value: skip the timestamp - * without an error. - */ - goto end; - } + clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const(event_msg); if (print_names) { print_name_equal(pretty, "timestamp"); @@ -546,10 +539,10 @@ int print_integer(struct pretty_component *pretty, len = bt_field_class_integer_get_field_value_range(int_fc); g_string_append(pretty->string, "0b"); - v.u = _bt_piecewise_lshift(v.u, 64 - len); + _bt_safe_lshift(v.u, 64 - len); for (bitnr = 0; bitnr < len; bitnr++) { g_string_append_printf(pretty->string, "%u", (v.u & (1ULL << 63)) ? 1 : 0); - v.u = _bt_piecewise_lshift(v.u, 1); + _bt_safe_lshift(v.u, 1); } break; } @@ -724,7 +717,7 @@ int print_enum(struct pretty_component *pretty, for (i = 0; i < label_count; i++) { const char *mapping_name = label_array[i]; - if (i == 0) { + if (i != 0) { g_string_append(pretty->string, ", "); } if (pretty->use_colors) { @@ -1364,23 +1357,29 @@ int pretty_print_discarded_items(struct pretty_component *pretty, BT_ASSERT(stream); stream_class = bt_stream_borrow_class_const(stream); - if (bt_stream_class_borrow_default_clock_class_const(stream_class)) { - switch (bt_message_get_type(msg)) { - case BT_MESSAGE_TYPE_DISCARDED_EVENTS: - bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const( - msg, &begin); - bt_message_discarded_events_borrow_default_end_clock_snapshot_const( - msg, &end); - break; - case BT_MESSAGE_TYPE_DISCARDED_PACKETS: - bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const( - msg, &begin); - bt_message_discarded_packets_borrow_default_end_clock_snapshot_const( - msg, &end); - break; - default: - abort(); + switch (bt_message_get_type(msg)) { + case BT_MESSAGE_TYPE_DISCARDED_EVENTS: + if (bt_stream_class_discarded_events_have_default_clock_snapshots( + stream_class)) { + begin = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const( + msg); + end = bt_message_discarded_events_borrow_default_end_clock_snapshot_const( + msg); } + + break; + case BT_MESSAGE_TYPE_DISCARDED_PACKETS: + if (bt_stream_class_discarded_packets_have_default_clock_snapshots( + stream_class)) { + begin = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const( + msg); + end = bt_message_discarded_packets_borrow_default_end_clock_snapshot_const( + msg); + } + + break; + default: + abort(); } print_discarded_elements_msg(pretty, stream, begin, end,