From: Lennart Poettering Date: Thu, 21 Apr 2011 19:05:51 +0000 (+0200) Subject: memblockq: decode unset chunks as NULL chunks again X-Git-Tag: 1.0_branch~628 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=575ba65714ab85d81b0e520f348d78c2ae80a6f9;p=profile%2Fivi%2Fpulseaudio.git memblockq: decode unset chunks as NULL chunks again This fixes asserts beeing hit when see requests are posted via the native protocol. --- diff --git a/src/pulsecore/asyncmsgq.c b/src/pulsecore/asyncmsgq.c index b0804f7..c211d9b 100644 --- a/src/pulsecore/asyncmsgq.c +++ b/src/pulsecore/asyncmsgq.c @@ -321,7 +321,7 @@ void pa_asyncmsgq_write_after_poll(pa_asyncmsgq *a) { int pa_asyncmsgq_dispatch(pa_msgobject *object, int code, void *userdata, int64_t offset, pa_memchunk *memchunk) { if (object) - return object->process_msg(object, code, userdata, offset, memchunk); + return object->process_msg(object, code, userdata, offset, pa_memchunk_isset(memchunk) ? memchunk : NULL); return 0; } diff --git a/src/pulsecore/memchunk.c b/src/pulsecore/memchunk.c index 0bbf859..34317fe 100644 --- a/src/pulsecore/memchunk.c +++ b/src/pulsecore/memchunk.c @@ -110,3 +110,12 @@ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src) { return dst; } + +pa_bool_t pa_memchunk_isset(pa_memchunk *chunk) { + assert(chunk); + + return + chunk->memblock || + chunk->index > 0 || + chunk->length > 0; +} diff --git a/src/pulsecore/memchunk.h b/src/pulsecore/memchunk.h index 9458f4f..d7d8240 100644 --- a/src/pulsecore/memchunk.h +++ b/src/pulsecore/memchunk.h @@ -50,4 +50,7 @@ pa_memchunk *pa_memchunk_will_need(const pa_memchunk *c); /* Copy the data in the src memchunk to the dst memchunk */ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src); +/* Return TRUE if any field is set != 0 */ +pa_bool_t pa_memchunk_isset(pa_memchunk *c); + #endif