From 2607921689d4f7978382dfcac5bc7b4e766a42f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 11 May 2015 17:37:59 -0400 Subject: [PATCH] ir: validate sequence length fields and variant tags of event classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/stream-class.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/formats/ctf/ir/stream-class.c b/formats/ctf/ir/stream-class.c index aba76cd1..72b07b84 100644 --- a/formats/ctf/ir/stream-class.c +++ b/formats/ctf/ir/stream-class.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -340,6 +341,20 @@ int bt_ctf_stream_class_add_event_class( goto end; } + /* + * Resolve the event's sequence length and variant tags if the + * stream is already associated with a trace. Otherwise, this + * validation will be performed once the stream is registered + * to a trace. + */ + if (stream_class->trace) { + ret = bt_ctf_event_class_resolve_types(event_class, + stream_class->trace, stream_class); + if (ret) { + goto end; + } + } + /* Only set an event id if none was explicitly set before */ event_id = bt_ctf_event_class_get_id(event_class); if (event_id < 0) { -- 2.34.1