Fix type-limits warnings, uint can't be < 0
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 13 May 2019 17:43:40 +0000 (13:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 May 2019 19:17:39 +0000 (15:17 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I14ba4492bd2ea9803daf8985dd8fe21107942df6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1295
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
cli/babeltrace.c
fd-cache/fd-cache.c
include/babeltrace/ctfser-internal.h
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/msg-iter/msg-iter.c
plugins/text/pretty/print.c

index 5578a661f973def4be5036f5f04f516aa0d643cb..934f9f85eda9ebecaa44c0a6f296ede10da006d2 100644 (file)
@@ -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);
index e12583a08743869a3265462cc4cd87c877d81de1..7e78fcb2c1e4ddd0375d28be332679bb91b4dca4 100644 (file)
@@ -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;
 
index fdbd2290a9fe42532987514a06b2ded094acbbeb..3522bae02afa40ff67eb686cd8134534bac0e7e8 100644 (file)
@@ -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;
        }
index a34cbf2619fc69cb6554760273773090515f779e..41a613a8dac9826b3093601feb4609bf402a1a5b 100644 (file)
@@ -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;
index 9f3dbad984c014ead0a4ec078f80d7b208c4fb09..22ebc55f090e80bd1cbb3290fadc24f276a5f4e0 100644 (file)
@@ -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;
index a53a567f080807189da974f648016acdee8541ff..5e63deb0bca15d9145a249bc1514231be58de3c3 100644 (file)
@@ -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++;
This page took 0.045881 seconds and 4 git commands to generate.