Fixed bug 1014 - SDL_ConvertAudio crashes
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Jan 2012 17:10:57 -0500
changeset 6194 ba275696ab7a
parent 6193 4da8077393c9
child 6195 9ee905f656b2
Fixed bug 1014 - SDL_ConvertAudio crashes The patch Mark attached looks good and valgrind gives it a clean bill of health: Mark.Howson@ntu.ac.uk 2010-12-15 07:45:25 PST Reproducible here under Windows and Linux. Looking at the code for SDL_Upsample_S16LSB_2c: const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; const Sint16 *target = ((const Sint16 *) cvt->buf) - 2; while (dst > target) { dst[1] = ((Sint16) SDL_SwapLE16(sample1)); dst[0] = ((Sint16) SDL_SwapLE16(sample0)); dst -= 2; ... if dstsize is odd (and therefore dst), it'll write to target[1] which is one byte before the allocated buf. The attached patch to sdlgenaudiocvt.pl changes dst > target to dst >= target, and removes the - $channels for the upsample case. The patch is not fully tested, but seems to work here.
src/audio/SDL_audiotypecvt.c
src/audio/sdlgenaudiocvt.pl
--- a/src/audio/SDL_audiotypecvt.c	Sun Jan 08 14:45:57 2012 -0500
+++ b/src/audio/SDL_audiotypecvt.c	Sun Jan 08 17:10:57 2012 -0500
@@ -2304,10 +2304,10 @@
     register int eps = 0;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Uint8 sample0 = src[0];
     Uint8 last_sample0 = sample0;
-    while (dst > target) {
+    while (dst >= target) {
         dst[0] = sample0;
         dst--;
         eps += srcsize;
@@ -2368,12 +2368,12 @@
     register int eps = 0;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Uint8 sample1 = src[1];
     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;
@@ -2442,7 +2442,7 @@
     register int eps = 0;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Uint8 sample3 = src[3];
     Uint8 sample2 = src[2];
     Uint8 sample1 = src[1];
@@ -2451,7 +2451,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;
@@ -2536,7 +2536,7 @@
     register int eps = 0;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Uint8 sample5 = src[5];
     Uint8 sample4 = src[4];
     Uint8 sample3 = src[3];
@@ -2549,7 +2549,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;
@@ -2650,7 +2650,7 @@
     register int eps = 0;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Uint8 sample7 = src[7];
     Uint8 sample6 = src[6];
     Uint8 sample5 = src[5];
@@ -2667,7 +2667,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;
@@ -2784,10 +2784,10 @@
     register int eps = 0;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint8 sample0 = ((Sint8) src[0]);
     Sint8 last_sample0 = sample0;
-    while (dst > target) {
+    while (dst >= target) {
         dst[0] = ((Sint8) sample0);
         dst--;
         eps += srcsize;
@@ -2848,12 +2848,12 @@
     register int eps = 0;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint8 sample1 = ((Sint8) src[1]);
     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;
@@ -2922,7 +2922,7 @@
     register int eps = 0;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint8 sample3 = ((Sint8) src[3]);
     Sint8 sample2 = ((Sint8) src[2]);
     Sint8 sample1 = ((Sint8) src[1]);
@@ -2931,7 +2931,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);
@@ -3016,7 +3016,7 @@
     register int eps = 0;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint8 sample5 = ((Sint8) src[5]);
     Sint8 sample4 = ((Sint8) src[4]);
     Sint8 sample3 = ((Sint8) src[3]);
@@ -3029,7 +3029,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);
@@ -3130,7 +3130,7 @@
     register int eps = 0;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint8 sample7 = ((Sint8) src[7]);
     Sint8 sample6 = ((Sint8) src[6]);
     Sint8 sample5 = ((Sint8) src[5]);
@@ -3147,7 +3147,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);
@@ -3264,10 +3264,10 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample0 = SDL_SwapLE16(src[0]);
     Uint16 last_sample0 = sample0;
-    while (dst > target) {
+    while (dst >= target) {
         dst[0] = SDL_SwapLE16(sample0);
         dst--;
         eps += srcsize;
@@ -3328,12 +3328,12 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample1 = SDL_SwapLE16(src[1]);
     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;
@@ -3402,7 +3402,7 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample3 = SDL_SwapLE16(src[3]);
     Uint16 sample2 = SDL_SwapLE16(src[2]);
     Uint16 sample1 = SDL_SwapLE16(src[1]);
@@ -3411,7 +3411,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);
@@ -3496,7 +3496,7 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample5 = SDL_SwapLE16(src[5]);
     Uint16 sample4 = SDL_SwapLE16(src[4]);
     Uint16 sample3 = SDL_SwapLE16(src[3]);
@@ -3509,7 +3509,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);
@@ -3610,7 +3610,7 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample7 = SDL_SwapLE16(src[7]);
     Uint16 sample6 = SDL_SwapLE16(src[6]);
     Uint16 sample5 = SDL_SwapLE16(src[5]);
@@ -3627,7 +3627,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);
@@ -3744,10 +3744,10 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     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;
@@ -3808,12 +3808,12 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
     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;
@@ -3882,7 +3882,7 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
     Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
     Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
@@ -3891,7 +3891,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));
@@ -3976,7 +3976,7 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
     Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
     Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
@@ -3989,7 +3989,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));
@@ -4090,7 +4090,7 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
     Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
     Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
@@ -4107,7 +4107,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));
@@ -4224,10 +4224,10 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample0 = SDL_SwapBE16(src[0]);
     Uint16 last_sample0 = sample0;
-    while (dst > target) {
+    while (dst >= target) {
         dst[0] = SDL_SwapBE16(sample0);
         dst--;
         eps += srcsize;
@@ -4288,12 +4288,12 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample1 = SDL_SwapBE16(src[1]);
     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;
@@ -4362,7 +4362,7 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample3 = SDL_SwapBE16(src[3]);
     Uint16 sample2 = SDL_SwapBE16(src[2]);
     Uint16 sample1 = SDL_SwapBE16(src[1]);
@@ -4371,7 +4371,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);
@@ -4456,7 +4456,7 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample5 = SDL_SwapBE16(src[5]);
     Uint16 sample4 = SDL_SwapBE16(src[4]);
     Uint16 sample3 = SDL_SwapBE16(src[3]);
@@ -4469,7 +4469,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);
@@ -4570,7 +4570,7 @@
     register int eps = 0;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Uint16 sample7 = SDL_SwapBE16(src[7]);
     Uint16 sample6 = SDL_SwapBE16(src[6]);
     Uint16 sample5 = SDL_SwapBE16(src[5]);
@@ -4587,7 +4587,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);
@@ -4704,10 +4704,10 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     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;
@@ -4768,12 +4768,12 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
     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;
@@ -4842,7 +4842,7 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
     Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
     Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
@@ -4851,7 +4851,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));
@@ -4936,7 +4936,7 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
     Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
     Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
@@ -4949,7 +4949,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));
@@ -5050,7 +5050,7 @@
     register int eps = 0;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
     Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
     Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
@@ -5067,7 +5067,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));
@@ -5184,10 +5184,10 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     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;
@@ -5248,12 +5248,12 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
     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;
@@ -5322,7 +5322,7 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
     Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
     Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
@@ -5331,7 +5331,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));
@@ -5416,7 +5416,7 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
     Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
     Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
@@ -5429,7 +5429,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));
@@ -5530,7 +5530,7 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
     Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
     Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
@@ -5547,7 +5547,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));
@@ -5664,10 +5664,10 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     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;
@@ -5728,12 +5728,12 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
     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;
@@ -5802,7 +5802,7 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
     Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
     Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
@@ -5811,7 +5811,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));
@@ -5896,7 +5896,7 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
     Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
     Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
@@ -5909,7 +5909,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));
@@ -6010,7 +6010,7 @@
     register int eps = 0;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
     Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
     Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
@@ -6027,7 +6027,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));
@@ -6144,10 +6144,10 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf) - 1;
+    const float *target = ((const float *) cvt->buf);
     float sample0 = SDL_SwapFloatLE(src[0]);
     float last_sample0 = sample0;
-    while (dst > target) {
+    while (dst >= target) {
         dst[0] = SDL_SwapFloatLE(sample0);
         dst--;
         eps += srcsize;
@@ -6208,12 +6208,12 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf) - 2;
+    const float *target = ((const float *) cvt->buf);
     float sample1 = SDL_SwapFloatLE(src[1]);
     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;
@@ -6282,7 +6282,7 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf) - 4;
+    const float *target = ((const float *) cvt->buf);
     float sample3 = SDL_SwapFloatLE(src[3]);
     float sample2 = SDL_SwapFloatLE(src[2]);
     float sample1 = SDL_SwapFloatLE(src[1]);
@@ -6291,7 +6291,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);
@@ -6376,7 +6376,7 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf) - 6;
+    const float *target = ((const float *) cvt->buf);
     float sample5 = SDL_SwapFloatLE(src[5]);
     float sample4 = SDL_SwapFloatLE(src[4]);
     float sample3 = SDL_SwapFloatLE(src[3]);
@@ -6389,7 +6389,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);
@@ -6490,7 +6490,7 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf) - 8;
+    const float *target = ((const float *) cvt->buf);
     float sample7 = SDL_SwapFloatLE(src[7]);
     float sample6 = SDL_SwapFloatLE(src[6]);
     float sample5 = SDL_SwapFloatLE(src[5]);
@@ -6507,7 +6507,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);
@@ -6624,10 +6624,10 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf) - 1;
+    const float *target = ((const float *) cvt->buf);
     float sample0 = SDL_SwapFloatBE(src[0]);
     float last_sample0 = sample0;
-    while (dst > target) {
+    while (dst >= target) {
         dst[0] = SDL_SwapFloatBE(sample0);
         dst--;
         eps += srcsize;
@@ -6688,12 +6688,12 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf) - 2;
+    const float *target = ((const float *) cvt->buf);
     float sample1 = SDL_SwapFloatBE(src[1]);
     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;
@@ -6762,7 +6762,7 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf) - 4;
+    const float *target = ((const float *) cvt->buf);
     float sample3 = SDL_SwapFloatBE(src[3]);
     float sample2 = SDL_SwapFloatBE(src[2]);
     float sample1 = SDL_SwapFloatBE(src[1]);
@@ -6771,7 +6771,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);
@@ -6856,7 +6856,7 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf) - 6;
+    const float *target = ((const float *) cvt->buf);
     float sample5 = SDL_SwapFloatBE(src[5]);
     float sample4 = SDL_SwapFloatBE(src[4]);
     float sample3 = SDL_SwapFloatBE(src[3]);
@@ -6869,7 +6869,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);
@@ -6970,7 +6970,7 @@
     register int eps = 0;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf) - 8;
+    const float *target = ((const float *) cvt->buf);
     float sample7 = SDL_SwapFloatBE(src[7]);
     float sample6 = SDL_SwapFloatBE(src[6]);
     float sample5 = SDL_SwapFloatBE(src[5]);
@@ -6987,7 +6987,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);
@@ -7105,9 +7105,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample0 = (Sint16) src[0];
         src--;
         dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
@@ -7158,9 +7158,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample0 = (Sint16) src[0];
         src--;
         dst[3] = (Uint8) sample0;
@@ -7213,10 +7213,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample1 = (Sint16) src[1];
         const Sint16 sample0 = (Sint16) src[0];
         src -= 2;
@@ -7275,10 +7275,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample1 = (Sint16) src[1];
         const Sint16 sample0 = (Sint16) src[0];
         src -= 2;
@@ -7341,12 +7341,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample3 = (Sint16) src[3];
     Sint16 last_sample2 = (Sint16) src[2];
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample3 = (Sint16) src[3];
         const Sint16 sample2 = (Sint16) src[2];
         const Sint16 sample1 = (Sint16) src[1];
@@ -7421,12 +7421,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample3 = (Sint16) src[3];
     Sint16 last_sample2 = (Sint16) src[2];
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample3 = (Sint16) src[3];
         const Sint16 sample2 = (Sint16) src[2];
         const Sint16 sample1 = (Sint16) src[1];
@@ -7509,14 +7509,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample5 = (Sint16) src[5];
     Sint16 last_sample4 = (Sint16) src[4];
     Sint16 last_sample3 = (Sint16) src[3];
     Sint16 last_sample2 = (Sint16) src[2];
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample5 = (Sint16) src[5];
         const Sint16 sample4 = (Sint16) src[4];
         const Sint16 sample3 = (Sint16) src[3];
@@ -7607,14 +7607,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample5 = (Sint16) src[5];
     Sint16 last_sample4 = (Sint16) src[4];
     Sint16 last_sample3 = (Sint16) src[3];
     Sint16 last_sample2 = (Sint16) src[2];
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample5 = (Sint16) src[5];
         const Sint16 sample4 = (Sint16) src[4];
         const Sint16 sample3 = (Sint16) src[3];
@@ -7717,7 +7717,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample7 = (Sint16) src[7];
     Sint16 last_sample6 = (Sint16) src[6];
     Sint16 last_sample5 = (Sint16) src[5];
@@ -7726,7 +7726,7 @@
     Sint16 last_sample2 = (Sint16) src[2];
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample7 = (Sint16) src[7];
         const Sint16 sample6 = (Sint16) src[6];
         const Sint16 sample5 = (Sint16) src[5];
@@ -7833,7 +7833,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
+    const Uint8 *target = ((const Uint8 *) cvt->buf);
     Sint16 last_sample7 = (Sint16) src[7];
     Sint16 last_sample6 = (Sint16) src[6];
     Sint16 last_sample5 = (Sint16) src[5];
@@ -7842,7 +7842,7 @@
     Sint16 last_sample2 = (Sint16) src[2];
     Sint16 last_sample1 = (Sint16) src[1];
     Sint16 last_sample0 = (Sint16) src[0];
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample7 = (Sint16) src[7];
         const Sint16 sample6 = (Sint16) src[6];
         const Sint16 sample5 = (Sint16) src[5];
@@ -7965,9 +7965,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
         src--;
         dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
@@ -8018,9 +8018,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
         src--;
         dst[3] = (Sint8) sample0;
@@ -8073,10 +8073,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
         const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
         src -= 2;
@@ -8135,10 +8135,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
         const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
         src -= 2;
@@ -8201,12 +8201,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
     Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
         const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
         const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
@@ -8281,12 +8281,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
     Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
         const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
         const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
@@ -8369,14 +8369,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
     Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
     Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
     Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
         const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
         const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
@@ -8467,14 +8467,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
     Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
     Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
     Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
         const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
         const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
@@ -8577,7 +8577,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
     Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
     Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
@@ -8586,7 +8586,7 @@
     Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
         const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
         const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
@@ -8693,7 +8693,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
+    const Sint8 *target = ((const Sint8 *) cvt->buf);
     Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
     Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
     Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
@@ -8702,7 +8702,7 @@
     Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
     Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
     Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
         const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
         const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
@@ -8825,9 +8825,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
         src--;
         dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
@@ -8878,9 +8878,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
         src--;
         dst[3] = (Uint16) sample0;
@@ -8933,10 +8933,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
         const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
         src -= 2;
@@ -8995,10 +8995,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
         const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
         src -= 2;
@@ -9061,12 +9061,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
         const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
         const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
@@ -9141,12 +9141,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
         const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
         const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
@@ -9229,14 +9229,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
     Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
     Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
         const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
         const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
@@ -9327,14 +9327,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
     Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
     Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
         const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
         const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
@@ -9437,7 +9437,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
     Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
     Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
@@ -9446,7 +9446,7 @@
     Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
         const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
         const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
@@ -9553,7 +9553,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
     Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
     Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
@@ -9562,7 +9562,7 @@
     Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
         const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
         const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
@@ -9685,9 +9685,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
         src--;
         dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
@@ -9738,9 +9738,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
         src--;
         dst[3] = (Sint16) sample0;
@@ -9793,10 +9793,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
         src -= 2;
@@ -9855,10 +9855,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
         src -= 2;
@@ -9921,12 +9921,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
         const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
@@ -10001,12 +10001,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
         const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
@@ -10089,14 +10089,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
     Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
         const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
@@ -10187,14 +10187,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
     Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
         const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
@@ -10297,7 +10297,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
     Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
@@ -10306,7 +10306,7 @@
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
         const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
@@ -10413,7 +10413,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
     Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
@@ -10422,7 +10422,7 @@
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
         const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
@@ -10545,9 +10545,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
         src--;
         dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
@@ -10598,9 +10598,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
         src--;
         dst[3] = (Uint16) sample0;
@@ -10653,10 +10653,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
         const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
         src -= 2;
@@ -10715,10 +10715,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
         const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
         src -= 2;
@@ -10781,12 +10781,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
         const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
         const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
@@ -10861,12 +10861,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
         const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
         const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
@@ -10949,14 +10949,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
     Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
     Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
         const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
         const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
@@ -11047,14 +11047,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
     Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
     Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
     Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
         const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
         const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
@@ -11157,7 +11157,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
     Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
     Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
@@ -11166,7 +11166,7 @@
     Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
         const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
         const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
@@ -11273,7 +11273,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+    const Uint16 *target = ((const Uint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
     Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
     Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
@@ -11282,7 +11282,7 @@
     Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
     Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
     Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
         const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
         const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
@@ -11405,9 +11405,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
         src--;
         dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
@@ -11458,9 +11458,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
         src--;
         dst[3] = (Sint16) sample0;
@@ -11513,10 +11513,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
         src -= 2;
@@ -11575,10 +11575,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
         const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
         src -= 2;
@@ -11641,12 +11641,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
         const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
@@ -11721,12 +11721,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
         const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
         const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
@@ -11809,14 +11809,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
     Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
         const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
@@ -11907,14 +11907,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
     Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
     Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
         const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
         const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
@@ -12017,7 +12017,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
     Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
@@ -12026,7 +12026,7 @@
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
         const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
@@ -12133,7 +12133,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+    const Sint16 *target = ((const Sint16 *) cvt->buf);
     Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
     Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
     Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
@@ -12142,7 +12142,7 @@
     Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
     Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
     Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
         const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
         const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
@@ -12265,9 +12265,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
         src--;
         dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
@@ -12318,9 +12318,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
         src--;
         dst[3] = (Sint32) sample0;
@@ -12373,10 +12373,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
         src -= 2;
@@ -12435,10 +12435,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
         src -= 2;
@@ -12501,12 +12501,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
         const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
@@ -12581,12 +12581,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
         const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
@@ -12669,14 +12669,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
     Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
         const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
@@ -12767,14 +12767,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
     Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
         const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
@@ -12877,7 +12877,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
     Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
@@ -12886,7 +12886,7 @@
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
         const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
@@ -12993,7 +12993,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
     Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
@@ -13002,7 +13002,7 @@
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
         const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
@@ -13125,9 +13125,9 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
         src--;
         dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
@@ -13178,9 +13178,9 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
         src--;
         dst[3] = (Sint32) sample0;
@@ -13233,10 +13233,10 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
         src -= 2;
@@ -13295,10 +13295,10 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
         const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
         src -= 2;
@@ -13361,12 +13361,12 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
         const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
@@ -13441,12 +13441,12 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
         const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
         const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
@@ -13529,14 +13529,14 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
     Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
         const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
@@ -13627,14 +13627,14 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
     Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
     Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
         const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
         const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
@@ -13737,7 +13737,7 @@
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
     Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
@@ -13746,7 +13746,7 @@
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
         const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
@@ -13853,7 +13853,7 @@
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+    const Sint32 *target = ((const Sint32 *) cvt->buf);
     Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
     Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
     Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
@@ -13862,7 +13862,7 @@
     Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
     Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
     Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst > target) {
+    while (dst >= target) {
         const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
         const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
         const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
@@ -13985,9 +13985,9 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf) - 1;
+    const float *target = ((const float *) cvt->buf);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample0 = (double) SDL_SwapFloatLE(src[0]);
         src--;
         dst[1] = (float) ((sample0 + last_sample0) * 0.5);
@@ -14038,9 +14038,9 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf) - 1;
+    const float *target = ((const float *) cvt->buf);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample0 = (double) SDL_SwapFloatLE(src[0]);
         src--;
         dst[3] = (float) sample0;
@@ -14093,10 +14093,10 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf) - 2;
+    const float *target = ((const float *) cvt->buf);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample1 = (double) SDL_SwapFloatLE(src[1]);
         const double sample0 = (double) SDL_SwapFloatLE(src[0]);
         src -= 2;
@@ -14155,10 +14155,10 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf) - 2;
+    const float *target = ((const float *) cvt->buf);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample1 = (double) SDL_SwapFloatLE(src[1]);
         const double sample0 = (double) SDL_SwapFloatLE(src[0]);
         src -= 2;
@@ -14221,12 +14221,12 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf) - 4;
+    const float *target = ((const float *) cvt->buf);
     double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample3 = (double) SDL_SwapFloatLE(src[3]);
         const double sample2 = (double) SDL_SwapFloatLE(src[2]);
         const double sample1 = (double) SDL_SwapFloatLE(src[1]);
@@ -14301,12 +14301,12 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf) - 4;
+    const float *target = ((const float *) cvt->buf);
     double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample3 = (double) SDL_SwapFloatLE(src[3]);
         const double sample2 = (double) SDL_SwapFloatLE(src[2]);
         const double sample1 = (double) SDL_SwapFloatLE(src[1]);
@@ -14389,14 +14389,14 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf) - 6;
+    const float *target = ((const float *) cvt->buf);
     double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
     double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
     double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample5 = (double) SDL_SwapFloatLE(src[5]);
         const double sample4 = (double) SDL_SwapFloatLE(src[4]);
         const double sample3 = (double) SDL_SwapFloatLE(src[3]);
@@ -14487,14 +14487,14 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf) - 6;
+    const float *target = ((const float *) cvt->buf);
     double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
     double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
     double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample5 = (double) SDL_SwapFloatLE(src[5]);
         const double sample4 = (double) SDL_SwapFloatLE(src[4]);
         const double sample3 = (double) SDL_SwapFloatLE(src[3]);
@@ -14597,7 +14597,7 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf) - 8;
+    const float *target = ((const float *) cvt->buf);
     double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
     double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
     double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
@@ -14606,7 +14606,7 @@
     double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample7 = (double) SDL_SwapFloatLE(src[7]);
         const double sample6 = (double) SDL_SwapFloatLE(src[6]);
         const double sample5 = (double) SDL_SwapFloatLE(src[5]);
@@ -14713,7 +14713,7 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf) - 8;
+    const float *target = ((const float *) cvt->buf);
     double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
     double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
     double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
@@ -14722,7 +14722,7 @@
     double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample7 = (double) SDL_SwapFloatLE(src[7]);
         const double sample6 = (double) SDL_SwapFloatLE(src[6]);
         const double sample5 = (double) SDL_SwapFloatLE(src[5]);
@@ -14845,9 +14845,9 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf) - 1;
+    const float *target = ((const float *) cvt->buf);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample0 = (double) SDL_SwapFloatBE(src[0]);
         src--;
         dst[1] = (float) ((sample0 + last_sample0) * 0.5);
@@ -14898,9 +14898,9 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf) - 1;
+    const float *target = ((const float *) cvt->buf);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample0 = (double) SDL_SwapFloatBE(src[0]);
         src--;
         dst[3] = (float) sample0;
@@ -14953,10 +14953,10 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf) - 2;
+    const float *target = ((const float *) cvt->buf);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample1 = (double) SDL_SwapFloatBE(src[1]);
         const double sample0 = (double) SDL_SwapFloatBE(src[0]);
         src -= 2;
@@ -15015,10 +15015,10 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf) - 2;
+    const float *target = ((const float *) cvt->buf);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample1 = (double) SDL_SwapFloatBE(src[1]);
         const double sample0 = (double) SDL_SwapFloatBE(src[0]);
         src -= 2;
@@ -15081,12 +15081,12 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf) - 4;
+    const float *target = ((const float *) cvt->buf);
     double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample3 = (double) SDL_SwapFloatBE(src[3]);
         const double sample2 = (double) SDL_SwapFloatBE(src[2]);
         const double sample1 = (double) SDL_SwapFloatBE(src[1]);
@@ -15161,12 +15161,12 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf) - 4;
+    const float *target = ((const float *) cvt->buf);
     double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample3 = (double) SDL_SwapFloatBE(src[3]);
         const double sample2 = (double) SDL_SwapFloatBE(src[2]);
         const double sample1 = (double) SDL_SwapFloatBE(src[1]);
@@ -15249,14 +15249,14 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf) - 6;
+    const float *target = ((const float *) cvt->buf);
     double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
     double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
     double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample5 = (double) SDL_SwapFloatBE(src[5]);
         const double sample4 = (double) SDL_SwapFloatBE(src[4]);
         const double sample3 = (double) SDL_SwapFloatBE(src[3]);
@@ -15347,14 +15347,14 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf) - 6;
+    const float *target = ((const float *) cvt->buf);
     double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
     double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
     double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
     double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample5 = (double) SDL_SwapFloatBE(src[5]);
         const double sample4 = (double) SDL_SwapFloatBE(src[4]);
         const double sample3 = (double) SDL_SwapFloatBE(src[3]);
@@ -15457,7 +15457,7 @@
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf) - 8;
+    const float *target = ((const float *) cvt->buf);
     double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
     double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
     double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
@@ -15466,7 +15466,7 @@
     double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample7 = (double) SDL_SwapFloatBE(src[7]);
         const double sample6 = (double) SDL_SwapFloatBE(src[6]);
         const double sample5 = (double) SDL_SwapFloatBE(src[5]);
@@ -15573,7 +15573,7 @@
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf) - 8;
+    const float *target = ((const float *) cvt->buf);
     double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
     double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
     double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
@@ -15582,7 +15582,7 @@
     double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
     double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
     double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst > target) {
+    while (dst >= target) {
         const double sample7 = (double) SDL_SwapFloatBE(src[7]);
         const double sample6 = (double) SDL_SwapFloatBE(src[6]);
         const double sample5 = (double) SDL_SwapFloatBE(src[5]);
--- a/src/audio/sdlgenaudiocvt.pl	Sun Jan 08 14:45:57 2012 -0500
+++ b/src/audio/sdlgenaudiocvt.pl	Sun Jan 08 17:10:57 2012 -0500
@@ -404,11 +404,11 @@
     # Upsampling (growing the buffer) needs to work backwards, since we
     #  overwrite the buffer as we go.
     if ($upsample) {
-        $endcomparison = '>';  # dst > target
+        $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;
+    const $fctype *target = ((const $fctype *) cvt->buf);
 EOF
     } else {
         $endcomparison = '<';  # dst < target
@@ -544,11 +544,11 @@
     # Upsampling (growing the buffer) needs to work backwards, since we
     #  overwrite the buffer as we go.
     if ($upsample) {
-        $endcomparison = '>';  # dst > target
+        $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;
+    const $fctype *target = ((const $fctype *) cvt->buf);
 EOF
     } else {
         $endcomparison = '<';  # dst < target