From 1d9f5cd6724aafdccf82c57ee0125bbc7cfb4027 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 13 May 2019 13:43:40 -0400 Subject: [PATCH] Fix type-limits warnings, uint can't be < 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Jeanson Change-Id: I14ba4492bd2ea9803daf8985dd8fe21107942df6 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1295 Reviewed-by: Jérémie Galarneau --- cli/babeltrace.c | 2 -- fd-cache/fd-cache.c | 2 -- include/babeltrace/ctfser-internal.h | 3 +-- plugins/ctf/common/metadata/visitor-generate-ir.c | 2 +- plugins/ctf/common/msg-iter/msg-iter.c | 1 - plugins/text/pretty/print.c | 5 ----- 6 files changed, 2 insertions(+), 13 deletions(-) diff --git a/cli/babeltrace.c b/cli/babeltrace.c index 5578a661..934f9f85 100644 --- a/cli/babeltrace.c +++ b/cli/babeltrace.c @@ -1718,7 +1718,6 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( } downstream_port_count = port_count_fn(downstream_comp); - BT_ASSERT(downstream_port_count >= 0); for (i = 0; i < downstream_port_count; i++) { const bt_port_input *in_downstream_port = @@ -2546,7 +2545,6 @@ int cmd_run_ctx_connect_comp_ports(struct cmd_run_ctx *ctx, uint64_t i; count = port_count_fn(comp); - BT_ASSERT(count >= 0); for (i = 0; i < count; i++) { const bt_port_output *upstream_port = port_by_index_fn(comp, i); diff --git a/fd-cache/fd-cache.c b/fd-cache/fd-cache.c index e12583a0..7e78fcb2 100644 --- a/fd-cache/fd-cache.c +++ b/fd-cache/fd-cache.c @@ -189,8 +189,6 @@ struct bt_fd_cache_handle *bt_fd_cache_get_handle(struct bt_fd_cache *fdc, g_hash_table_insert(fdc->cache, fd_internal->key, fd_internal); } - BT_ASSERT(fd_internal->ref_count >= 0); - fd_internal->ref_count++; goto end; diff --git a/include/babeltrace/ctfser-internal.h b/include/babeltrace/ctfser-internal.h index fdbd2290..3522bae0 100644 --- a/include/babeltrace/ctfser-internal.h +++ b/include/babeltrace/ctfser-internal.h @@ -146,8 +146,7 @@ bool _bt_ctfser_has_space_left(struct bt_ctfser *ctfser, uint64_t size_bits) goto end; } - if (unlikely(ctfser->offset_in_cur_packet_bits < 0 || size_bits > - UINT64_MAX - ctfser->offset_in_cur_packet_bits)) { + if (unlikely(size_bits > UINT64_MAX - ctfser->offset_in_cur_packet_bits)) { has_space_left = false; goto end; } diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index a34cbf26..41a613a8 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -3204,7 +3204,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, * Only read "stream_id" if get_unary_unsigned() * succeeded. */ - if (ret || (!ret && *stream_id < 0)) { + if (ret) { _BT_LOGE_NODE(node, "Unexpected unary expression for event class's `stream_id` attribute."); ret = -EINVAL; diff --git a/plugins/ctf/common/msg-iter/msg-iter.c b/plugins/ctf/common/msg-iter/msg-iter.c index 9f3dbad9..22ebc55f 100644 --- a/plugins/ctf/common/msg-iter/msg-iter.c +++ b/plugins/ctf/common/msg-iter/msg-iter.c @@ -3021,7 +3021,6 @@ enum bt_msg_iter_status bt_msg_iter_get_packet_properties( props->exp_packet_total_size = notit->cur_exp_packet_total_size; props->exp_packet_content_size = notit->cur_exp_packet_content_size; props->stream_class_id = (uint64_t) notit->cur_stream_class_id; - BT_ASSERT(props->stream_class_id >= 0); props->data_stream_id = notit->cur_data_stream_id; props->snapshots.discarded_events = notit->snapshots.discarded_events; props->snapshots.packets = notit->snapshots.packets; diff --git a/plugins/text/pretty/print.c b/plugins/text/pretty/print.c index a53a567f..5e63deb0 100644 --- a/plugins/text/pretty/print.c +++ b/plugins/text/pretty/print.c @@ -922,11 +922,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++; -- 2.34.1