Fixed off-by-one error in SDL_ConvertStereo().
authorRyan C. Gordon <icculus@icculus.org>
Fri, 12 Jul 2013 01:26:43 -0400
changeset 7410a9878830f05e
parent 7409 8b5ae6ff6a49
child 7412 50211a1fd557
Fixed off-by-one error in SDL_ConvertStereo().

Fixes Bugzilla #561.
src/audio/SDL_audiocvt.c
     1.1 --- a/src/audio/SDL_audiocvt.c	Thu Jul 11 22:04:16 2013 -0700
     1.2 +++ b/src/audio/SDL_audiocvt.c	Fri Jul 12 01:26:43 2013 -0400
     1.3 @@ -293,10 +293,9 @@
     1.4          const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
     1.5          type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
     1.6          for (i = cvt->len_cvt / sizeof(type); i; --i) { \
     1.7 -            const type val = *src; \
     1.8              src -= 1; \
     1.9              dst -= 2; \
    1.10 -            dst[0] = dst[1] = val; \
    1.11 +            dst[0] = dst[1] = *src; \
    1.12          } \
    1.13      }
    1.14