Fixed issue where there was a garbage sample at the end of the buffer.
authorSam Lantinga <slouken@libsdl.org>
Thu, 12 Jan 2012 21:42:35 -0500
changeset 6210 a598b3abd962
parent 6208 291fea716f09
child 6211 b0b81f18bf35
Fixed issue where there was a garbage sample at the end of the buffer.
src/audio/SDL_audiocvt.c
--- a/src/audio/SDL_audiocvt.c	Tue Jan 10 21:07:09 2012 -0500
+++ b/src/audio/SDL_audiocvt.c	Thu Jan 12 21:42:35 2012 -0500
@@ -295,8 +295,9 @@
     { \
         const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
         type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
-        for (i = cvt->len_cvt / sizeof(type); i; --i, --src) { \
+        for (i = cvt->len_cvt / sizeof(type); i; --i) { \
             const type val = *src; \
+            src -= 1; \
             dst -= 2; \
             dst[0] = dst[1] = val; \
         } \