summaryrefslogtreecommitdiff
path: root/apps/pcmbuf.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-06-28 02:17:58 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-06-28 02:17:58 -0400
commit662f7576bfe5ed3f8a1b6d606cc7cc114a814791 (patch)
treec32ba5ba2b9c801ead53d4e3c40620c08f0bab7f /apps/pcmbuf.c
parent363f96b95b2d96746c013da09b194f4eee39d385 (diff)
downloadrockbox-662f7576bfe5ed3f8a1b6d606cc7cc114a814791.tar.gz
rockbox-662f7576bfe5ed3f8a1b6d606cc7cc114a814791.zip
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
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r--apps/pcmbuf.c2
1 files changed, 1 insertions, 1 deletions
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)
241 241
242 if (offset != 0) 242 if (offset != 0)
243 { 243 {
244 i = (i + offset) % pcmbuf_desc_count; 244 i = (i + offset) % (int)pcmbuf_desc_count;
245 245
246 /* remainder => modulus */ 246 /* remainder => modulus */
247 if (i < 0) 247 if (i < 0)