From 53dc85fa3e0012825e9f0128747f6f2fb54119d1 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Mon, 6 May 2019 15:04:05 -0400 Subject: [PATCH] Fix: sink.text.pretty: Unsigned compared against 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit CID 1401251 (#1 of 1): Unsigned compared against 0 (NO_EFFECT) unsigned_compare: This less-than-zero comparison of an unsigned value is never true. nr_fields < 0UL. Reported-by: Coverity (1401251) Unsigned compared against 0 Signed-off-by: Francis Deslauriers Change-Id: I8aa8a03a6b03ca1640570d70a51729d001af3b66 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1263 Reviewed-by: Jérémie Galarneau --- plugins/text/pretty/print.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/text/pretty/print.c b/plugins/text/pretty/print.c index 95189d5e..a53a567f 100644 --- a/plugins/text/pretty/print.c +++ b/plugins/text/pretty/print.c @@ -822,11 +822,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; -- 2.34.1