From 1a65d5b2520044cf212bad4f9b80ec3475447712 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 15 Mar 2017 17:31:39 -0400 Subject: [PATCH] paramspec: Fix array validation logic A paramspec validation should modify the content to match what the spec requires and return TURE if a modification happened. This previous implementation would only fix the first element of the array and return. It was also return TRUE for empty array, while no modification was needed. https://bugzilla.gnome.org/show_bug.cgi?id=780111 --- gst/gstparamspecs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/gstparamspecs.c b/gst/gstparamspecs.c index 66de3bd..7326aa0 100644 --- a/gst/gstparamspecs.c +++ b/gst/gstparamspecs.c @@ -233,6 +233,7 @@ static gboolean _gst_param_array_validate (GParamSpec * pspec, GValue * value) { GstParamSpecArray *aspec = GST_PARAM_SPEC_ARRAY_LIST (pspec); + gboolean ret = FALSE; /* ensure array values validity against a present element spec */ if (aspec->element_spec) { @@ -249,15 +250,16 @@ _gst_param_array_validate (GParamSpec * pspec, GValue * value) g_value_unset (element); g_value_init (element, G_PARAM_SPEC_VALUE_TYPE (element_spec)); g_param_value_set_default (element_spec, element); - return FALSE; + ret = TRUE; } + /* validate array value against element_spec */ - if (!g_param_value_validate (element_spec, element)) - return FALSE; + if (g_param_value_validate (element_spec, element)) + ret = TRUE; } } - return TRUE; + return ret; } static gint -- 2.7.4