X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Ftext%2Fpretty%2Fprint.c;h=bdc1eb9801b5c0e8d1341d7f173ee721d2ebd618;hb=2e90378a2b94006e2743b06e7fe7a1f0e691a56e;hp=95189d5e2fda7df18fea904cf87d6d2d4a173248;hpb=fdd3a2da18afef5ca32ba181a8b6ebbff173df02;p=babeltrace.git diff --git a/plugins/text/pretty/print.c b/plugins/text/pretty/print.c index 95189d5e..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) { @@ -822,11 +815,9 @@ int print_struct(struct pretty_component *pretty, ret = -1; goto end; } + nr_fields = bt_field_class_structure_get_member_count(struct_class); - if (nr_fields < 0) { - ret = -1; - goto end; - } + g_string_append(pretty->string, "{"); pretty->depth++; nr_printed_fields = 0; @@ -924,11 +915,6 @@ int print_sequence(struct pretty_component *pretty, uint64_t i; len = bt_field_array_get_length(seq); - if (len < 0) { - ret = -1; - goto end; - } - g_string_append(pretty->string, "["); pretty->depth++; @@ -1371,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,