summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-03-15 21:31:39 (GMT)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-03-24 17:43:34 (GMT)
commit1a65d5b2520044cf212bad4f9b80ec3475447712 (patch)
tree23aec407e957c978a2bed56da09c92f48670660a
parent3b9ff1245bb65a4ee94ea193e3fe28d2cb342224 (diff)
downloadgstreamer-1a65d5b2520044cf212bad4f9b80ec3475447712.tar.gz
gstreamer-1a65d5b2520044cf212bad4f9b80ec3475447712.tar.xz
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
-rw-r--r--gst/gstparamspecs.c10
1 files 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