pod: check pod alignment

Make a SPA_POD_ALIGN = 8 and make sure all pods are aligned to it. Use
the new constant to pad and check alignment. Make some new macros to
check for the pod type, alignment and minimal size.
This commit is contained in:
Wim Taymans 2025-07-03 14:53:07 +02:00
parent b75ed93e51
commit aa2289a25b
5 changed files with 56 additions and 34 deletions

View file

@ -167,7 +167,7 @@ SPA_API_POD_BUILDER void spa_pod_builder_remove(struct spa_pod_builder *builder,
SPA_API_POD_BUILDER int spa_pod_builder_pad(struct spa_pod_builder *builder, uint32_t size)
{
uint64_t zeroes = 0;
size = SPA_ROUND_UP_N(size, 8) - size;
size = SPA_ROUND_UP_N(size, SPA_POD_ALIGN) - size;
return size ? spa_pod_builder_raw(builder, &zeroes, size) : 0;
}