From 1c62ce6f860804cfb87aaef591d48f07dc36bbd2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 14 Jun 2007 20:11:46 +0000 Subject: [PATCH] Fix a nasty typo in pa_asyncq_pop git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1480 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/asyncq.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c index da1f16f..c966e7d 100644 --- a/src/pulsecore/asyncq.c +++ b/src/pulsecore/asyncq.c @@ -141,8 +141,10 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) { int x[20]; errno = 0; - if ((r = read(l->write_fds[0], x, sizeof(x))) <= 0 && errno != EINTR) + if ((r = read(l->write_fds[0], x, sizeof(x))) < 0 && errno != EINTR) return -1; + + pa_assert(r != 0); if (r > 0) if (pa_atomic_sub(&l->n_read, r) <= r) @@ -174,6 +176,8 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) { return -1; } + pa_assert(r != 0); + if (r > 0) pa_atomic_sub(&l->n_read, r); } @@ -220,8 +224,10 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) { int x[20]; errno = 0; - if ((r = read(l->read_fds[0], x, sizeof(x))) <= 0 && errno != EINTR) + if ((r = read(l->read_fds[0], x, sizeof(x))) < 0 && errno != EINTR) return NULL; + + pa_assert(r != 0); if (r > 0) if (pa_atomic_sub(&l->n_written, r) <= r) @@ -246,11 +252,13 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) { _Y; - if ((r = read(l->read_fds[0], x, sizeof(x)) < 0) && errno != EINTR) { + if ((r = read(l->read_fds[0], x, sizeof(x))) < 0 && errno != EINTR) { pa_atomic_dec(&l->read_waiting); return NULL; } + pa_assert(r != 0); + if (r > 0) pa_atomic_sub(&l->n_written, r); } @@ -312,7 +320,4 @@ void pa_asyncq_after_poll(pa_asyncq *l) { pa_assert(pa_atomic_load(&l->read_waiting) > 0); pa_atomic_dec(&l->read_waiting); - - - } -- 2.7.4