pod-builder: move some code around to help gcc 13

Make sure to pop the frame before returning errors to stop gcc13
from complaining with -Wdangling-pointer

Fixes #3171
This commit is contained in:
Wim Taymans 2023-04-20 17:52:27 +02:00
parent 83d2e85f49
commit 0333ddff45
6 changed files with 22 additions and 19 deletions

View file

@ -400,7 +400,7 @@ struct spa_pod_prop_body0 {
static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_impl_client *client,
struct spa_pod_builder *builder)
{
int res;
int res = 0;
switch (type) {
case SPA_TYPE_Id:
@ -445,17 +445,17 @@ static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_imp
if (b->value.type == SPA_TYPE_Id) {
uint32_t id;
if ((res = spa_pod_get_id(&b->value, &id)) < 0)
return res;
goto done;
spa_pod_builder_id(builder, pw_protocol_native0_type_from_v2(client, id));
SPA_POD_PROP_ALTERNATIVE_FOREACH0(b, size, alt)
if ((res = remap_from_v2(b->value.type, alt, b->value.size, client, builder)) < 0)
return res;
break;
} else {
spa_pod_builder_raw(builder, &b->value, size - sizeof(struct spa_pod));
}
done:
spa_pod_builder_pop(builder, &f);
break;
}
case SPA_TYPE_Object:
@ -493,7 +493,7 @@ static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_imp
SPA_POD_BODY(p),
p->size,
client, builder)) < 0)
return res;
break;
}
spa_pod_builder_pop(builder, &f);
break;
@ -506,14 +506,14 @@ static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_imp
spa_pod_builder_push_struct(builder, &f);
SPA_POD_FOREACH(b, size, p)
if ((res = remap_from_v2(p->type, SPA_POD_BODY(p), p->size, client, builder)) < 0)
return res;
break;
spa_pod_builder_pop(builder, &f);
break;
}
default:
break;
}
return 0;
return res;
}
static int remap_to_v2(struct pw_impl_client *client, const struct spa_type_info *info,