From f059c857b202a2428b1b4757de2d3d9f23fdf9a3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 14 Aug 2008 19:09:33 +0200 Subject: enable a few additional gcc warnings and fix all problems found --- src/alsa.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/alsa.c') diff --git a/src/alsa.c b/src/alsa.c index a8b8a56..21da013 100644 --- a/src/alsa.c +++ b/src/alsa.c @@ -292,13 +292,13 @@ static void* thread_func(void *userdata) { goto finish; } - n_pfd = ret + 1; + n_pfd = (nfds_t) ret + 1; if (!(pfd = ca_new(struct pollfd, n_pfd))) { ret = CA_ERROR_OOM; goto finish; } - if ((ret = snd_pcm_poll_descriptors(out->pcm, pfd+1, n_pfd-1)) < 0) { + if ((ret = snd_pcm_poll_descriptors(out->pcm, pfd+1, (unsigned) n_pfd-1)) < 0) { ret = translate_error(ret); goto finish; } @@ -309,6 +309,7 @@ static void* thread_func(void *userdata) { for (;;) { unsigned short revents; + snd_pcm_sframes_t sframes; if (out->dead) break; @@ -322,7 +323,7 @@ static void* thread_func(void *userdata) { if (pfd[0].revents) break; - if ((ret = snd_pcm_poll_descriptors_revents(out->pcm, pfd+1, n_pfd-1, &revents)) < 0) { + if ((ret = snd_pcm_poll_descriptors_revents(out->pcm, pfd+1, (unsigned) n_pfd-1, &revents)) < 0) { ret = translate_error(ret); goto finish; } @@ -376,9 +377,9 @@ static void* thread_func(void *userdata) { break; } - if ((ret = snd_pcm_writei(out->pcm, d, nbytes/fs)) < 0) { + if ((sframes = snd_pcm_writei(out->pcm, d, nbytes/fs)) < 0) { - if ((ret = snd_pcm_recover(out->pcm, ret, 1)) < 0) { + if ((ret = snd_pcm_recover(out->pcm, (int) sframes, 1)) < 0) { ret = translate_error(ret); goto finish; } @@ -386,8 +387,8 @@ static void* thread_func(void *userdata) { continue; } - nbytes -= ret*fs; - d = (uint8_t*) d + ret*fs; + nbytes -= (size_t) sframes*fs; + d = (uint8_t*) d + (size_t) sframes*fs; } ret = CA_SUCCESS; -- cgit