changeset 4889:8c9cbb623d55

Fixed crashing loading 48KHz audio, contributed by Terry Welsh
author Sam Lantinga <slouken@libsdl.org>
date Sat, 18 Sep 2010 18:15:08 -0700
parents 0a77d2fc95ad
children 443771460df9
files src/audio/SDL_audiotypecvt.c src/audio/sdlgenaudiocvt.pl
diffstat 2 files changed, 106 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/SDL_audiotypecvt.c	Sat Sep 18 17:12:19 2010 -0700
+++ b/src/audio/SDL_audiotypecvt.c	Sat Sep 18 18:15:08 2010 -0700
@@ -2308,7 +2308,7 @@
     const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
     Uint8 sample0 = src[0];
     Uint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = sample0;
         dst--;
         eps += srcsize;
@@ -2340,7 +2340,7 @@
     const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
     Uint8 sample0 = src[0];
     Uint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2374,7 +2374,7 @@
     Uint8 sample0 = src[0];
     Uint8 last_sample1 = sample1;
     Uint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = sample1;
         dst[0] = sample0;
         dst -= 2;
@@ -2411,7 +2411,7 @@
     Uint8 sample1 = src[1];
     Uint8 last_sample0 = sample0;
     Uint8 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2452,7 +2452,7 @@
     Uint8 last_sample2 = sample2;
     Uint8 last_sample1 = sample1;
     Uint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = sample3;
         dst[2] = sample2;
         dst[1] = sample1;
@@ -2499,7 +2499,7 @@
     Uint8 last_sample1 = sample1;
     Uint8 last_sample2 = sample2;
     Uint8 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2550,7 +2550,7 @@
     Uint8 last_sample2 = sample2;
     Uint8 last_sample1 = sample1;
     Uint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = sample5;
         dst[4] = sample4;
         dst[3] = sample3;
@@ -2607,7 +2607,7 @@
     Uint8 last_sample3 = sample3;
     Uint8 last_sample4 = sample4;
     Uint8 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2668,7 +2668,7 @@
     Uint8 last_sample2 = sample2;
     Uint8 last_sample1 = sample1;
     Uint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = sample7;
         dst[6] = sample6;
         dst[5] = sample5;
@@ -2735,7 +2735,7 @@
     Uint8 last_sample5 = sample5;
     Uint8 last_sample6 = sample6;
     Uint8 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2788,7 +2788,7 @@
     const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
     Sint8 sample0 = ((Sint8) src[0]);
     Sint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = ((Sint8) sample0);
         dst--;
         eps += srcsize;
@@ -2820,7 +2820,7 @@
     const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
     Sint8 sample0 = ((Sint8) src[0]);
     Sint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2854,7 +2854,7 @@
     Sint8 sample0 = ((Sint8) src[0]);
     Sint8 last_sample1 = sample1;
     Sint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = ((Sint8) sample1);
         dst[0] = ((Sint8) sample0);
         dst -= 2;
@@ -2891,7 +2891,7 @@
     Sint8 sample1 = ((Sint8) src[1]);
     Sint8 last_sample0 = sample0;
     Sint8 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -2932,7 +2932,7 @@
     Sint8 last_sample2 = sample2;
     Sint8 last_sample1 = sample1;
     Sint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = ((Sint8) sample3);
         dst[2] = ((Sint8) sample2);
         dst[1] = ((Sint8) sample1);
@@ -2979,7 +2979,7 @@
     Sint8 last_sample1 = sample1;
     Sint8 last_sample2 = sample2;
     Sint8 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3030,7 +3030,7 @@
     Sint8 last_sample2 = sample2;
     Sint8 last_sample1 = sample1;
     Sint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = ((Sint8) sample5);
         dst[4] = ((Sint8) sample4);
         dst[3] = ((Sint8) sample3);
@@ -3087,7 +3087,7 @@
     Sint8 last_sample3 = sample3;
     Sint8 last_sample4 = sample4;
     Sint8 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3148,7 +3148,7 @@
     Sint8 last_sample2 = sample2;
     Sint8 last_sample1 = sample1;
     Sint8 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = ((Sint8) sample7);
         dst[6] = ((Sint8) sample6);
         dst[5] = ((Sint8) sample5);
@@ -3215,7 +3215,7 @@
     Sint8 last_sample5 = sample5;
     Sint8 last_sample6 = sample6;
     Sint8 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3268,7 +3268,7 @@
     const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
     Uint16 sample0 = SDL_SwapLE16(src[0]);
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = SDL_SwapLE16(sample0);
         dst--;
         eps += srcsize;
@@ -3300,7 +3300,7 @@
     const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
     Uint16 sample0 = SDL_SwapLE16(src[0]);
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3334,7 +3334,7 @@
     Uint16 sample0 = SDL_SwapLE16(src[0]);
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = SDL_SwapLE16(sample1);
         dst[0] = SDL_SwapLE16(sample0);
         dst -= 2;
@@ -3371,7 +3371,7 @@
     Uint16 sample1 = SDL_SwapLE16(src[1]);
     Uint16 last_sample0 = sample0;
     Uint16 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3412,7 +3412,7 @@
     Uint16 last_sample2 = sample2;
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = SDL_SwapLE16(sample3);
         dst[2] = SDL_SwapLE16(sample2);
         dst[1] = SDL_SwapLE16(sample1);
@@ -3459,7 +3459,7 @@
     Uint16 last_sample1 = sample1;
     Uint16 last_sample2 = sample2;
     Uint16 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3510,7 +3510,7 @@
     Uint16 last_sample2 = sample2;
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = SDL_SwapLE16(sample5);
         dst[4] = SDL_SwapLE16(sample4);
         dst[3] = SDL_SwapLE16(sample3);
@@ -3567,7 +3567,7 @@
     Uint16 last_sample3 = sample3;
     Uint16 last_sample4 = sample4;
     Uint16 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3628,7 +3628,7 @@
     Uint16 last_sample2 = sample2;
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = SDL_SwapLE16(sample7);
         dst[6] = SDL_SwapLE16(sample6);
         dst[5] = SDL_SwapLE16(sample5);
@@ -3695,7 +3695,7 @@
     Uint16 last_sample5 = sample5;
     Uint16 last_sample6 = sample6;
     Uint16 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3748,7 +3748,7 @@
     const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
     Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = ((Sint16) SDL_SwapLE16(sample0));
         dst--;
         eps += srcsize;
@@ -3780,7 +3780,7 @@
     const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
     Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3814,7 +3814,7 @@
     Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = ((Sint16) SDL_SwapLE16(sample1));
         dst[0] = ((Sint16) SDL_SwapLE16(sample0));
         dst -= 2;
@@ -3851,7 +3851,7 @@
     Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
     Sint16 last_sample0 = sample0;
     Sint16 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3892,7 +3892,7 @@
     Sint16 last_sample2 = sample2;
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = ((Sint16) SDL_SwapLE16(sample3));
         dst[2] = ((Sint16) SDL_SwapLE16(sample2));
         dst[1] = ((Sint16) SDL_SwapLE16(sample1));
@@ -3939,7 +3939,7 @@
     Sint16 last_sample1 = sample1;
     Sint16 last_sample2 = sample2;
     Sint16 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -3990,7 +3990,7 @@
     Sint16 last_sample2 = sample2;
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = ((Sint16) SDL_SwapLE16(sample5));
         dst[4] = ((Sint16) SDL_SwapLE16(sample4));
         dst[3] = ((Sint16) SDL_SwapLE16(sample3));
@@ -4047,7 +4047,7 @@
     Sint16 last_sample3 = sample3;
     Sint16 last_sample4 = sample4;
     Sint16 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4108,7 +4108,7 @@
     Sint16 last_sample2 = sample2;
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = ((Sint16) SDL_SwapLE16(sample7));
         dst[6] = ((Sint16) SDL_SwapLE16(sample6));
         dst[5] = ((Sint16) SDL_SwapLE16(sample5));
@@ -4175,7 +4175,7 @@
     Sint16 last_sample5 = sample5;
     Sint16 last_sample6 = sample6;
     Sint16 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4228,7 +4228,7 @@
     const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
     Uint16 sample0 = SDL_SwapBE16(src[0]);
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = SDL_SwapBE16(sample0);
         dst--;
         eps += srcsize;
@@ -4260,7 +4260,7 @@
     const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
     Uint16 sample0 = SDL_SwapBE16(src[0]);
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4294,7 +4294,7 @@
     Uint16 sample0 = SDL_SwapBE16(src[0]);
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = SDL_SwapBE16(sample1);
         dst[0] = SDL_SwapBE16(sample0);
         dst -= 2;
@@ -4331,7 +4331,7 @@
     Uint16 sample1 = SDL_SwapBE16(src[1]);
     Uint16 last_sample0 = sample0;
     Uint16 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4372,7 +4372,7 @@
     Uint16 last_sample2 = sample2;
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = SDL_SwapBE16(sample3);
         dst[2] = SDL_SwapBE16(sample2);
         dst[1] = SDL_SwapBE16(sample1);
@@ -4419,7 +4419,7 @@
     Uint16 last_sample1 = sample1;
     Uint16 last_sample2 = sample2;
     Uint16 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4470,7 +4470,7 @@
     Uint16 last_sample2 = sample2;
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = SDL_SwapBE16(sample5);
         dst[4] = SDL_SwapBE16(sample4);
         dst[3] = SDL_SwapBE16(sample3);
@@ -4527,7 +4527,7 @@
     Uint16 last_sample3 = sample3;
     Uint16 last_sample4 = sample4;
     Uint16 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4588,7 +4588,7 @@
     Uint16 last_sample2 = sample2;
     Uint16 last_sample1 = sample1;
     Uint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = SDL_SwapBE16(sample7);
         dst[6] = SDL_SwapBE16(sample6);
         dst[5] = SDL_SwapBE16(sample5);
@@ -4655,7 +4655,7 @@
     Uint16 last_sample5 = sample5;
     Uint16 last_sample6 = sample6;
     Uint16 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4708,7 +4708,7 @@
     const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
     Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = ((Sint16) SDL_SwapBE16(sample0));
         dst--;
         eps += srcsize;
@@ -4740,7 +4740,7 @@
     const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
     Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4774,7 +4774,7 @@
     Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = ((Sint16) SDL_SwapBE16(sample1));
         dst[0] = ((Sint16) SDL_SwapBE16(sample0));
         dst -= 2;
@@ -4811,7 +4811,7 @@
     Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
     Sint16 last_sample0 = sample0;
     Sint16 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4852,7 +4852,7 @@
     Sint16 last_sample2 = sample2;
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = ((Sint16) SDL_SwapBE16(sample3));
         dst[2] = ((Sint16) SDL_SwapBE16(sample2));
         dst[1] = ((Sint16) SDL_SwapBE16(sample1));
@@ -4899,7 +4899,7 @@
     Sint16 last_sample1 = sample1;
     Sint16 last_sample2 = sample2;
     Sint16 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -4950,7 +4950,7 @@
     Sint16 last_sample2 = sample2;
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = ((Sint16) SDL_SwapBE16(sample5));
         dst[4] = ((Sint16) SDL_SwapBE16(sample4));
         dst[3] = ((Sint16) SDL_SwapBE16(sample3));
@@ -5007,7 +5007,7 @@
     Sint16 last_sample3 = sample3;
     Sint16 last_sample4 = sample4;
     Sint16 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5068,7 +5068,7 @@
     Sint16 last_sample2 = sample2;
     Sint16 last_sample1 = sample1;
     Sint16 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = ((Sint16) SDL_SwapBE16(sample7));
         dst[6] = ((Sint16) SDL_SwapBE16(sample6));
         dst[5] = ((Sint16) SDL_SwapBE16(sample5));
@@ -5135,7 +5135,7 @@
     Sint16 last_sample5 = sample5;
     Sint16 last_sample6 = sample6;
     Sint16 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5188,7 +5188,7 @@
     const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
     Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = ((Sint32) SDL_SwapLE32(sample0));
         dst--;
         eps += srcsize;
@@ -5220,7 +5220,7 @@
     const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
     Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5254,7 +5254,7 @@
     Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = ((Sint32) SDL_SwapLE32(sample1));
         dst[0] = ((Sint32) SDL_SwapLE32(sample0));
         dst -= 2;
@@ -5291,7 +5291,7 @@
     Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
     Sint32 last_sample0 = sample0;
     Sint32 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5332,7 +5332,7 @@
     Sint32 last_sample2 = sample2;
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = ((Sint32) SDL_SwapLE32(sample3));
         dst[2] = ((Sint32) SDL_SwapLE32(sample2));
         dst[1] = ((Sint32) SDL_SwapLE32(sample1));
@@ -5379,7 +5379,7 @@
     Sint32 last_sample1 = sample1;
     Sint32 last_sample2 = sample2;
     Sint32 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5430,7 +5430,7 @@
     Sint32 last_sample2 = sample2;
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = ((Sint32) SDL_SwapLE32(sample5));
         dst[4] = ((Sint32) SDL_SwapLE32(sample4));
         dst[3] = ((Sint32) SDL_SwapLE32(sample3));
@@ -5487,7 +5487,7 @@
     Sint32 last_sample3 = sample3;
     Sint32 last_sample4 = sample4;
     Sint32 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5548,7 +5548,7 @@
     Sint32 last_sample2 = sample2;
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = ((Sint32) SDL_SwapLE32(sample7));
         dst[6] = ((Sint32) SDL_SwapLE32(sample6));
         dst[5] = ((Sint32) SDL_SwapLE32(sample5));
@@ -5615,7 +5615,7 @@
     Sint32 last_sample5 = sample5;
     Sint32 last_sample6 = sample6;
     Sint32 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5668,7 +5668,7 @@
     const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
     Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = ((Sint32) SDL_SwapBE32(sample0));
         dst--;
         eps += srcsize;
@@ -5700,7 +5700,7 @@
     const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
     Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5734,7 +5734,7 @@
     Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = ((Sint32) SDL_SwapBE32(sample1));
         dst[0] = ((Sint32) SDL_SwapBE32(sample0));
         dst -= 2;
@@ -5771,7 +5771,7 @@
     Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
     Sint32 last_sample0 = sample0;
     Sint32 last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5812,7 +5812,7 @@
     Sint32 last_sample2 = sample2;
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = ((Sint32) SDL_SwapBE32(sample3));
         dst[2] = ((Sint32) SDL_SwapBE32(sample2));
         dst[1] = ((Sint32) SDL_SwapBE32(sample1));
@@ -5859,7 +5859,7 @@
     Sint32 last_sample1 = sample1;
     Sint32 last_sample2 = sample2;
     Sint32 last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -5910,7 +5910,7 @@
     Sint32 last_sample2 = sample2;
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = ((Sint32) SDL_SwapBE32(sample5));
         dst[4] = ((Sint32) SDL_SwapBE32(sample4));
         dst[3] = ((Sint32) SDL_SwapBE32(sample3));
@@ -5967,7 +5967,7 @@
     Sint32 last_sample3 = sample3;
     Sint32 last_sample4 = sample4;
     Sint32 last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6028,7 +6028,7 @@
     Sint32 last_sample2 = sample2;
     Sint32 last_sample1 = sample1;
     Sint32 last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = ((Sint32) SDL_SwapBE32(sample7));
         dst[6] = ((Sint32) SDL_SwapBE32(sample6));
         dst[5] = ((Sint32) SDL_SwapBE32(sample5));
@@ -6095,7 +6095,7 @@
     Sint32 last_sample5 = sample5;
     Sint32 last_sample6 = sample6;
     Sint32 last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6148,7 +6148,7 @@
     const float *target = ((const float *) cvt->buf) - 1;
     float sample0 = SDL_SwapFloatLE(src[0]);
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = SDL_SwapFloatLE(sample0);
         dst--;
         eps += srcsize;
@@ -6180,7 +6180,7 @@
     const float *target = (const float *) (cvt->buf + dstsize);
     float sample0 = SDL_SwapFloatLE(src[0]);
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6214,7 +6214,7 @@
     float sample0 = SDL_SwapFloatLE(src[0]);
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = SDL_SwapFloatLE(sample1);
         dst[0] = SDL_SwapFloatLE(sample0);
         dst -= 2;
@@ -6251,7 +6251,7 @@
     float sample1 = SDL_SwapFloatLE(src[1]);
     float last_sample0 = sample0;
     float last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6292,7 +6292,7 @@
     float last_sample2 = sample2;
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = SDL_SwapFloatLE(sample3);
         dst[2] = SDL_SwapFloatLE(sample2);
         dst[1] = SDL_SwapFloatLE(sample1);
@@ -6339,7 +6339,7 @@
     float last_sample1 = sample1;
     float last_sample2 = sample2;
     float last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6390,7 +6390,7 @@
     float last_sample2 = sample2;
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = SDL_SwapFloatLE(sample5);
         dst[4] = SDL_SwapFloatLE(sample4);
         dst[3] = SDL_SwapFloatLE(sample3);
@@ -6447,7 +6447,7 @@
     float last_sample3 = sample3;
     float last_sample4 = sample4;
     float last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6508,7 +6508,7 @@
     float last_sample2 = sample2;
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = SDL_SwapFloatLE(sample7);
         dst[6] = SDL_SwapFloatLE(sample6);
         dst[5] = SDL_SwapFloatLE(sample5);
@@ -6575,7 +6575,7 @@
     float last_sample5 = sample5;
     float last_sample6 = sample6;
     float last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6628,7 +6628,7 @@
     const float *target = ((const float *) cvt->buf) - 1;
     float sample0 = SDL_SwapFloatBE(src[0]);
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[0] = SDL_SwapFloatBE(sample0);
         dst--;
         eps += srcsize;
@@ -6660,7 +6660,7 @@
     const float *target = (const float *) (cvt->buf + dstsize);
     float sample0 = SDL_SwapFloatBE(src[0]);
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst < target) {
         src++;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6694,7 +6694,7 @@
     float sample0 = SDL_SwapFloatBE(src[0]);
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[1] = SDL_SwapFloatBE(sample1);
         dst[0] = SDL_SwapFloatBE(sample0);
         dst -= 2;
@@ -6731,7 +6731,7 @@
     float sample1 = SDL_SwapFloatBE(src[1]);
     float last_sample0 = sample0;
     float last_sample1 = sample1;
-    while (dst != target) {
+    while (dst < target) {
         src += 2;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6772,7 +6772,7 @@
     float last_sample2 = sample2;
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[3] = SDL_SwapFloatBE(sample3);
         dst[2] = SDL_SwapFloatBE(sample2);
         dst[1] = SDL_SwapFloatBE(sample1);
@@ -6819,7 +6819,7 @@
     float last_sample1 = sample1;
     float last_sample2 = sample2;
     float last_sample3 = sample3;
-    while (dst != target) {
+    while (dst < target) {
         src += 4;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6870,7 +6870,7 @@
     float last_sample2 = sample2;
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[5] = SDL_SwapFloatBE(sample5);
         dst[4] = SDL_SwapFloatBE(sample4);
         dst[3] = SDL_SwapFloatBE(sample3);
@@ -6927,7 +6927,7 @@
     float last_sample3 = sample3;
     float last_sample4 = sample4;
     float last_sample5 = sample5;
-    while (dst != target) {
+    while (dst < target) {
         src += 6;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
@@ -6988,7 +6988,7 @@
     float last_sample2 = sample2;
     float last_sample1 = sample1;
     float last_sample0 = sample0;
-    while (dst != target) {
+    while (dst > target) {
         dst[7] = SDL_SwapFloatBE(sample7);
         dst[6] = SDL_SwapFloatBE(sample6);
         dst[5] = SDL_SwapFloatBE(sample5);
@@ -7055,7 +7055,7 @@
     float last_sample5 = sample5;
     float last_sample6 = sample6;
     float last_sample7 = sample7;
-    while (dst != target) {
+    while (dst < target) {
         src += 8;
         eps += dstsize;
         if ((eps << 1) >= srcsize) {
--- a/src/audio/sdlgenaudiocvt.pl	Sat Sep 18 17:12:19 2010 -0700
+++ b/src/audio/sdlgenaudiocvt.pl	Sat Sep 18 18:15:08 2010 -0700
@@ -38,7 +38,7 @@
 /* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    Copyright (C) 1997-2010 Sam Lantinga
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -400,15 +400,19 @@
     register int eps = 0;
 EOF
 
+    my $endcomparison = '!=';
+
     # Upsampling (growing the buffer) needs to work backwards, since we
     #  overwrite the buffer as we go.
     if ($upsample) {
+        $endcomparison = '>';  # dst > target
         print <<EOF;
     $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
     const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
     const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
 EOF
     } else {
+        $endcomparison = '<';  # dst < target
         print <<EOF;
     $fctype *dst = ($fctype *) cvt->buf;
     const $fctype *src = ($fctype *) cvt->buf;
@@ -432,7 +436,7 @@
     }
 
     print <<EOF;
-    while (dst != target) {
+    while (dst $endcomparison target) {
 EOF
 
     if ($upsample) {