*: Avoid macros that use casts where possible

Use direct field access when the type is known, instead of a macro that
includes a cast.

These were missed in e4fcbef89a.
This commit is contained in:
Demi Marie Obenour 2025-06-07 15:21:37 -04:00 committed by Wim Taymans
parent 5cf84fa3fe
commit b3bf5be1f6
11 changed files with 19 additions and 20 deletions

View file

@ -128,7 +128,7 @@ SPA_API_DEBUG_FORMAT int spa_debugc_format(struct spa_debug_context *ctx, int in
if (info == NULL)
info = spa_type_format;
if (format == NULL || SPA_POD_TYPE(format) != SPA_TYPE_Object)
if (format == NULL || format->type != SPA_TYPE_Object)
return -EINVAL;
if (spa_format_parse(format, &mtype, &mstype) < 0)

View file

@ -270,7 +270,7 @@ SPA_API_POD_ITER int spa_pod_get_bytes(const struct spa_pod *pod, const void **v
if (!spa_pod_is_bytes(pod))
return -EINVAL;
*value = (const void *)SPA_POD_CONTENTS(struct spa_pod_bytes, pod);
*len = SPA_POD_BODY_SIZE(pod);
*len = pod->size;
return 0;
}

View file

@ -281,7 +281,7 @@ SPA_API_POD_PARSER bool spa_pod_parser_can_collect(const struct spa_pod *pod, ch
if (pod == NULL)
return false;
if (SPA_POD_TYPE(pod) == SPA_TYPE_Choice) {
if (pod->type == SPA_TYPE_Choice) {
if (!spa_pod_is_choice(pod))
return false;
if (type == 'V')

View file

@ -918,7 +918,7 @@ static struct spa_pod *merge_objects(struct impl *this, struct spa_pod_builder *
struct spa_pod_builder_state state;
int res = 0;
if (o2 == NULL || SPA_POD_TYPE(o1) != SPA_POD_TYPE(o2))
if (o2 == NULL || o1->pod.type != o2->pod.type)
return (struct spa_pod*)o1;
spa_pod_builder_push_object(b, &f, o1->body.type, o1->body.id);

View file

@ -1585,7 +1585,7 @@ spa_v4l2_set_control(struct impl *this, uint32_t id,
if ((res = spa_v4l2_open(dev, this->props.device)) < 0)
return res;
switch (SPA_POD_TYPE(&prop->value)) {
switch (prop->value.type) {
case SPA_TYPE_Bool:
{
bool val;

View file

@ -969,7 +969,7 @@ static struct spa_pod *merge_objects(struct impl *this, struct spa_pod_builder *
struct spa_pod_builder_state state;
int res = 0;
if (o2 == NULL || SPA_POD_TYPE(o1) != SPA_POD_TYPE(o2))
if (o2 == NULL || o1->pod.type != o2->pod.type)
return (struct spa_pod*)o1;
spa_pod_builder_push_object(b, &f, o1->body.type, o1->body.id);

View file

@ -1286,7 +1286,7 @@ static int diff_prop(struct impl *impl, struct spa_pod_prop *prop,
void *vals, *v, *best = NULL;
int res = INT_MAX;
if (SPA_POD_TYPE(val) != type)
if (val->type != type)
return -EINVAL;
size = SPA_POD_BODY_SIZE(val);