core: Assert on memchunk divisibility by sample spec in pa_memblockq_push().

Earlier, -1 was returned if the memchunk size was not a multiple of the frame
size. Now, it is verified unconditionally through an assertion. Error code -1
is still returned when the memblock queue is full.

In those few cases where the return value of pa_memblockq_push() is checked,
an overflow is assumed to be the reason in case an error code is returned.
This commit is contained in:
Jarkko Suontausta 2012-05-24 10:38:22 +03:00 committed by Tanu Kaskinen
parent 3b3d26813f
commit 7e6e3b7044
2 changed files with 2 additions and 3 deletions

View file

@ -287,8 +287,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
pa_assert(uchunk->length > 0);
pa_assert(uchunk->index + uchunk->length <= pa_memblock_get_length(uchunk->memblock));
if (uchunk->length % bq->base)
return -1;
pa_assert_se(uchunk->length % bq->base == 0);
if (!can_push(bq, uchunk->length))
return -1;