Fix: bitfield: shift undefined/implementation defined behaviors
[babeltrace.git] / plugins / text / pretty / print.c
index 95189d5e2fda7df18fea904cf87d6d2d4a173248..e779bcc204500c7292612985e44bcfcdf2886aa7 100644 (file)
@@ -546,10 +546,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;
        }
@@ -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;
@@ -924,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.023844 seconds and 4 git commands to generate.