From 662f7576bfe5ed3f8a1b6d606cc7cc114a814791 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 28 Jun 2013 02:17:58 -0400 Subject: Fix a bug in pcmbuf.c when doing offset with modulus. Causes the track change to go in the wrong buffer (and even be missed by playback) if the current descriptor for the write index is descriptor 0 because the offset used is "-1" upon track change. Got nailed by implicit conversion of the % operator dividend to unsigned. Change-Id: I32538db801ac9d790c8b1b5bd041b09ad4b64d2e --- apps/pcmbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/pcmbuf.c') diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 068c7aa1d3..cc454a49ce 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -241,7 +241,7 @@ static struct chunkdesc * index_chunkdesc_offs(size_t index, int offset) if (offset != 0) { - i = (i + offset) % pcmbuf_desc_count; + i = (i + offset) % (int)pcmbuf_desc_count; /* remainder => modulus */ if (i < 0) -- cgit