1.1 --- a/src/audio/SDL_audiotypecvt.c Fri Jan 02 07:34:01 2009 +0000
1.2 +++ b/src/audio/SDL_audiotypecvt.c Fri Jan 02 08:12:14 2009 +0000
1.3 @@ -65,8 +65,8 @@
1.4 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
1.5 #endif
1.6
1.7 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.8 - dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
1.9 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.10 + dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.11 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.12 const Uint16 val = (((Uint16) *src) << 8);
1.13 *dst = SDL_SwapLE16(val);
1.14 @@ -89,8 +89,8 @@
1.15 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
1.16 #endif
1.17
1.18 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.19 - dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
1.20 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.21 + dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.22 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.23 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
1.24 *dst = ((Sint16) SDL_SwapLE16(val));
1.25 @@ -113,8 +113,8 @@
1.26 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
1.27 #endif
1.28
1.29 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.30 - dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
1.31 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.32 + dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.33 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.34 const Uint16 val = (((Uint16) *src) << 8);
1.35 *dst = SDL_SwapBE16(val);
1.36 @@ -137,8 +137,8 @@
1.37 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
1.38 #endif
1.39
1.40 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.41 - dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
1.42 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.43 + dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.44 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.45 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
1.46 *dst = ((Sint16) SDL_SwapBE16(val));
1.47 @@ -161,8 +161,8 @@
1.48 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
1.49 #endif
1.50
1.51 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.52 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
1.53 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.54 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.55 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.56 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
1.57 *dst = ((Sint32) SDL_SwapLE32(val));
1.58 @@ -185,8 +185,8 @@
1.59 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
1.60 #endif
1.61
1.62 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.63 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
1.64 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.65 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.66 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.67 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
1.68 *dst = ((Sint32) SDL_SwapBE32(val));
1.69 @@ -209,8 +209,8 @@
1.70 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
1.71 #endif
1.72
1.73 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.74 - dst = (float *) (cvt->buf + cvt->len_cvt * 4);
1.75 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.76 + dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.77 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.78 const float val = ((((float) *src) * DIVBY127) - 1.0f);
1.79 *dst = SDL_SwapFloatLE(val);
1.80 @@ -233,8 +233,8 @@
1.81 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
1.82 #endif
1.83
1.84 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.85 - dst = (float *) (cvt->buf + cvt->len_cvt * 4);
1.86 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.87 + dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.88 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.89 const float val = ((((float) *src) * DIVBY127) - 1.0f);
1.90 *dst = SDL_SwapFloatBE(val);
1.91 @@ -280,8 +280,8 @@
1.92 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
1.93 #endif
1.94
1.95 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.96 - dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
1.97 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.98 + dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.99 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.100 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
1.101 *dst = SDL_SwapLE16(val);
1.102 @@ -304,8 +304,8 @@
1.103 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
1.104 #endif
1.105
1.106 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.107 - dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
1.108 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.109 + dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.110 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.111 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
1.112 *dst = ((Sint16) SDL_SwapLE16(val));
1.113 @@ -328,8 +328,8 @@
1.114 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
1.115 #endif
1.116
1.117 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.118 - dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
1.119 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.120 + dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.121 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.122 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
1.123 *dst = SDL_SwapBE16(val);
1.124 @@ -352,8 +352,8 @@
1.125 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
1.126 #endif
1.127
1.128 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.129 - dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
1.130 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.131 + dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.132 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.133 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
1.134 *dst = ((Sint16) SDL_SwapBE16(val));
1.135 @@ -376,8 +376,8 @@
1.136 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
1.137 #endif
1.138
1.139 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.140 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
1.141 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.142 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.143 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.144 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
1.145 *dst = ((Sint32) SDL_SwapLE32(val));
1.146 @@ -400,8 +400,8 @@
1.147 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
1.148 #endif
1.149
1.150 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.151 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
1.152 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.153 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.154 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.155 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
1.156 *dst = ((Sint32) SDL_SwapBE32(val));
1.157 @@ -424,8 +424,8 @@
1.158 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
1.159 #endif
1.160
1.161 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.162 - dst = (float *) (cvt->buf + cvt->len_cvt * 4);
1.163 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.164 + dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.165 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.166 const float val = (((float) ((Sint8) *src)) * DIVBY127);
1.167 *dst = SDL_SwapFloatLE(val);
1.168 @@ -448,8 +448,8 @@
1.169 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
1.170 #endif
1.171
1.172 - src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
1.173 - dst = (float *) (cvt->buf + cvt->len_cvt * 4);
1.174 + src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
1.175 + dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
1.176 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
1.177 const float val = (((float) ((Sint8) *src)) * DIVBY127);
1.178 *dst = SDL_SwapFloatBE(val);
1.179 @@ -589,8 +589,8 @@
1.180 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
1.181 #endif
1.182
1.183 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.184 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.185 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.186 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.187 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.188 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
1.189 *dst = ((Sint32) SDL_SwapLE32(val));
1.190 @@ -613,8 +613,8 @@
1.191 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
1.192 #endif
1.193
1.194 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.195 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.196 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.197 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.198 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.199 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
1.200 *dst = ((Sint32) SDL_SwapBE32(val));
1.201 @@ -637,8 +637,8 @@
1.202 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
1.203 #endif
1.204
1.205 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.206 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.207 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.208 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.209 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.210 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
1.211 *dst = SDL_SwapFloatLE(val);
1.212 @@ -661,8 +661,8 @@
1.213 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
1.214 #endif
1.215
1.216 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.217 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.218 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.219 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.220 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.221 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
1.222 *dst = SDL_SwapFloatBE(val);
1.223 @@ -802,8 +802,8 @@
1.224 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
1.225 #endif
1.226
1.227 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.228 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.229 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.230 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.231 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.232 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
1.233 *dst = ((Sint32) SDL_SwapLE32(val));
1.234 @@ -826,8 +826,8 @@
1.235 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
1.236 #endif
1.237
1.238 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.239 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.240 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.241 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.242 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.243 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
1.244 *dst = ((Sint32) SDL_SwapBE32(val));
1.245 @@ -850,8 +850,8 @@
1.246 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
1.247 #endif
1.248
1.249 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.250 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.251 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.252 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.253 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.254 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
1.255 *dst = SDL_SwapFloatLE(val);
1.256 @@ -874,8 +874,8 @@
1.257 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
1.258 #endif
1.259
1.260 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.261 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.262 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.263 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.264 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.265 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
1.266 *dst = SDL_SwapFloatBE(val);
1.267 @@ -1015,8 +1015,8 @@
1.268 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
1.269 #endif
1.270
1.271 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.272 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.273 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.274 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.275 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.276 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1.277 *dst = ((Sint32) SDL_SwapLE32(val));
1.278 @@ -1039,8 +1039,8 @@
1.279 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
1.280 #endif
1.281
1.282 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.283 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.284 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.285 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.286 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.287 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1.288 *dst = ((Sint32) SDL_SwapBE32(val));
1.289 @@ -1063,8 +1063,8 @@
1.290 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
1.291 #endif
1.292
1.293 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.294 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.295 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.296 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.297 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.298 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
1.299 *dst = SDL_SwapFloatLE(val);
1.300 @@ -1087,8 +1087,8 @@
1.301 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
1.302 #endif
1.303
1.304 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.305 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.306 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.307 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.308 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.309 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
1.310 *dst = SDL_SwapFloatBE(val);
1.311 @@ -1228,8 +1228,8 @@
1.312 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
1.313 #endif
1.314
1.315 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.316 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.317 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.318 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.319 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.320 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1.321 *dst = ((Sint32) SDL_SwapLE32(val));
1.322 @@ -1252,8 +1252,8 @@
1.323 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
1.324 #endif
1.325
1.326 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.327 - dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1.328 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.329 + dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.330 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.331 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1.332 *dst = ((Sint32) SDL_SwapBE32(val));
1.333 @@ -1276,8 +1276,8 @@
1.334 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
1.335 #endif
1.336
1.337 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.338 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.339 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.340 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.341 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.342 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1.343 *dst = SDL_SwapFloatLE(val);
1.344 @@ -1300,8 +1300,8 @@
1.345 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
1.346 #endif
1.347
1.348 - src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1.349 - dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1.350 + src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
1.351 + dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
1.352 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1.353 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1.354 *dst = SDL_SwapFloatBE(val);