From c6c0ca4289ad129a4e711cb5a31eef23c99cd1b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 5 Mar 2015 18:24:57 -0500 Subject: [PATCH] Add Variant and Sequence IR type validation checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/event-types.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index 5c091bc7..8bfc1f61 100644 --- a/formats/ctf/ir/event-types.c +++ b/formats/ctf/ir/event-types.c @@ -382,6 +382,27 @@ int bt_ctf_field_type_validate(struct bt_ctf_field_type *type) ret = enumeration->entries->len ? 0 : -1; break; } + case CTF_TYPE_SEQUENCE: + { + struct bt_ctf_field_type_sequence *sequence = + container_of(type, struct bt_ctf_field_type_sequence, + parent); + + /* length field name should be set at this point */ + ret = sequence->length_field_name->len ? 0 : -1; + break; + } + case CTF_TYPE_VARIANT: + { + struct bt_ctf_field_type_variant *variant = + container_of(type, struct bt_ctf_field_type_variant, + parent); + + if (variant->tag_name->len == 0 || !variant->tag) { + ret = -1; + } + break; + } default: break; } -- 2.34.1