mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
validate: Error out on invalid 'foreach' iterator types
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/248>
This commit is contained in:
parent
87f656d1f6
commit
32591fece8
1 changed files with 12 additions and 5 deletions
|
@ -2431,19 +2431,26 @@ static gboolean
|
|||
_foreach_find_iterator (GQuark field_id, GValue * value,
|
||||
GstValidateAction * action)
|
||||
{
|
||||
if (!g_strcmp0 (g_quark_to_string (field_id), "actions"))
|
||||
const gchar *field = g_quark_to_string (field_id);
|
||||
|
||||
if (!g_strcmp0 (field, "actions"))
|
||||
return TRUE;
|
||||
|
||||
if (!GST_VALUE_HOLDS_INT_RANGE (value) && !GST_VALUE_HOLDS_ARRAY (value))
|
||||
if (!GST_VALUE_HOLDS_INT_RANGE (value) && !GST_VALUE_HOLDS_ARRAY (value)) {
|
||||
gst_validate_error_structure (action,
|
||||
"Unsupported iterator type `%s` for %s"
|
||||
". Only ranges (`[(int)start, (int)stop, [(int)step]]`) and arrays "
|
||||
" (`<item1, item2>`) are supported", field, G_VALUE_TYPE_NAME (value));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (GST_VALIDATE_ACTION_RANGE_NAME (action)) {
|
||||
gst_validate_error_structure (action, "Found several ranges in structure, "
|
||||
"it is not supported");
|
||||
gst_validate_error_structure (action, "Wrong iterator syntax, "
|
||||
" only one iterator field is supported.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_VALIDATE_ACTION_RANGE_NAME (action) = g_quark_to_string (field_id);
|
||||
GST_VALIDATE_ACTION_RANGE_NAME (action) = field;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue