X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-generate-io-struct.c;h=4515b53e437fb16238530f9371b20a745b79f2b2;hb=fbad6b84b7a1a9e1d046d9ef983ca001f4f7ba29;hp=142923349f85aae059d2792a6115ed24933b64cb;hpb=5e26a3edfc7c3d1f70c4a8ccac9f3b58f554e129;p=babeltrace.git diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c index 14292334..4515b53e 100644 --- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c +++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c @@ -875,7 +875,6 @@ struct bt_declaration *ctf_declaration_struct_visit(FILE *fd, ret = get_unary_unsigned(min_align, &min_align_value); if (ret) { fprintf(fd, "[error] %s: unexpected unary expression for structure \"align\" attribute\n", __func__); - ret = -EINVAL; goto error; } } @@ -1320,6 +1319,11 @@ struct bt_declaration *ctf_declaration_integer_visit(FILE *fd, int depth, return NULL; } size = right->u.unary_expression.u.unsigned_constant; + if (!size) { + fprintf(fd, "[error] %s: integer size: expecting non-zero constant\n", + __func__); + return NULL; + } has_size = 1; } else if (!strcmp(left->u.unary_expression.u.string, "align")) { if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) { @@ -1476,9 +1480,9 @@ struct bt_declaration *ctf_declaration_floating_point_visit(FILE *fd, int depth, struct ctf_trace *trace) { struct ctf_node *expression; - uint64_t alignment = 1, exp_dig = 0, mant_dig = 0, - byte_order = trace->byte_order; - int has_alignment = 0, has_exp_dig = 0, has_mant_dig = 0; + uint64_t alignment = 1, exp_dig = 0, mant_dig = 0; + int byte_order = trace->byte_order, has_alignment = 0, + has_exp_dig = 0, has_mant_dig = 0; struct declaration_float *float_declaration; bt_list_for_each_entry(expression, expressions, siblings) { @@ -2400,6 +2404,7 @@ int ctf_clock_declaration_visit(FILE *fd, int depth, struct ctf_node *node, goto error; } clock->absolute = ret; + ret = 0; } else { fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in clock declaration.\n", __func__, left); }