From 767ee352652989bdc28e21de75efccc4088f98e0 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 16 Feb 2023 13:44:50 +0100 Subject: [PATCH] tracerutils: allow casting parameters types It was impossible to have an u32 parameter such as 'max-buffer-size=(uint)5' because the parentheses were not properly parsed. Part-of: --- subprojects/gstreamer/gst/gsttracerutils.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/subprojects/gstreamer/gst/gsttracerutils.c b/subprojects/gstreamer/gst/gsttracerutils.c index 8cbbed7859..eccf6602a3 100644 --- a/subprojects/gstreamer/gst/gsttracerutils.c +++ b/subprojects/gstreamer/gst/gsttracerutils.c @@ -100,7 +100,21 @@ _priv_gst_tracing_init (void) while (t[i]) { // check t[i] for params if ((params = strchr (t[i], '('))) { - gchar *end = strchr (¶ms[1], ')'); + // params can contain multiple '(' when using this kind of parameter: 'max-buffer-size=(uint)5' + guint n_par = 1, j; + gchar *end = NULL; + + for (j = 1; params[j] != '\0'; j++) { + if (params[j] == '(') + n_par++; + else if (params[j] == ')') { + n_par--; + if (n_par == 0) { + end = ¶ms[j]; + break; + } + } + } *params = '\0'; params++; if (end)