Fixed off-by-one error in SDL_ConvertStereo().
authorRyan C. Gordon <icculus@icculus.org>
Fri, 12 Jul 2013 01:26:43 -0400
changeset 7410 a9878830f05e
parent 7409 8b5ae6ff6a49
child 7412 50211a1fd557
Fixed off-by-one error in SDL_ConvertStereo(). Fixes Bugzilla #561.
src/audio/SDL_audiocvt.c
--- a/src/audio/SDL_audiocvt.c	Thu Jul 11 22:04:16 2013 -0700
+++ b/src/audio/SDL_audiocvt.c	Fri Jul 12 01:26:43 2013 -0400
@@ -293,10 +293,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) { \
-            const type val = *src; \
             src -= 1; \
             dst -= 2; \
-            dst[0] = dst[1] = val; \
+            dst[0] = dst[1] = *src; \
         } \
     }