ref: 5ca8150ca7c0d29b528cb8bc14065674dfe17831
parent: 466fc1d8846e9acb1868f682e04905f8de883f18
author: cbagwell <cbagwell>
date: Sat Oct 25 16:25:48 EDT 2008
snd_pcm_readi returns negative numbers so store in a signed variable.
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -502,16 +502,16 @@
len = 0;
while (len < nsamp) {
- size_t n = snd_pcm_readi(alsa->pcm_handle, alsa->buf,
+ long n = snd_pcm_readi(alsa->pcm_handle, alsa->buf,
(nsamp - len)/ft->signal.channels); /* ALSA takes "frame" counts. */
- if ((int)n < 0) {
- if (xrun_recovery(alsa->pcm_handle, (int)n) < 0) {
+ if (n < 0) {
+ if (xrun_recovery(alsa->pcm_handle, n) < 0) {
lsx_fail_errno(ft, SOX_EPERM, "ALSA read error");
return 0;
}
} else {
n *= ft->signal.channels;
- read_buf(buf + len, alsa->buf, n, ft->encoding.reverse_bytes, &ft->clips);
+ read_buf(buf + len, alsa->buf, (size_t)n, ft->encoding.reverse_bytes, &ft->clips);
len += n;
}
}