mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
*: rely on checks now done by spa_pod_get_values()
Rely on spa_pod_get_values() to return no values if the size is too small for the type. This means that if there is a check that at least one value is returned, checking that the size is large enough is unnecessary.
This commit is contained in:
parent
42098fd8c1
commit
5853e1150b
5 changed files with 7 additions and 13 deletions
|
|
@ -164,8 +164,7 @@ SPA_API_DEBUG_FORMAT int spa_debugc_format(struct spa_debug_context *ctx, int in
|
|||
type = val->type;
|
||||
size = val->size;
|
||||
|
||||
if (type < SPA_TYPE_None || type >= _SPA_TYPE_LAST || n_vals < 1 ||
|
||||
size < spa_pod_type_size(type))
|
||||
if (type < SPA_TYPE_None || type >= _SPA_TYPE_LAST || n_vals < 1)
|
||||
continue;
|
||||
|
||||
vals = SPA_POD_BODY(val);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
|
|||
v1 = spa_pod_get_values(&p1->value, &nalt1, &p1c);
|
||||
v2 = spa_pod_get_values(&p2->value, &nalt2, &p2c);
|
||||
|
||||
/* empty choices */
|
||||
/* empty or bogus choices */
|
||||
if (nalt1 < 1 || nalt2 < 1)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -95,8 +95,6 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
|
|||
/* incompatible property types */
|
||||
if (type != v2->type || size != v2->size || p1->key != p2->key)
|
||||
return -EINVAL;
|
||||
if (size < spa_pod_type_size(type))
|
||||
return -EINVAL;
|
||||
|
||||
/* start with copying the property */
|
||||
spa_pod_builder_prop(b, p1->key, p1->flags & p2->flags);
|
||||
|
|
@ -405,7 +403,7 @@ SPA_API_POD_FILTER int spa_pod_filter_object_make(struct spa_pod_object *pod)
|
|||
struct spa_pod *v = spa_pod_get_values(&res->value, &nvals, &choice);
|
||||
const void *vals = SPA_POD_BODY(v);
|
||||
|
||||
if (v->size < spa_pod_type_size(v->type))
|
||||
if (nvals < 1)
|
||||
continue;
|
||||
|
||||
if (spa_pod_compare_is_valid_choice(v->type, v->size,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue