Fixed memory corruption in the upsampling code, caught by valgrind
authorSam Lantinga
Sun, 08 Jan 2012 17:31:11 -0500
changeset 6196f1a312da2669
parent 6195 9ee905f656b2
child 6197 5666b486b9c7
Fixed memory corruption in the upsampling code, caught by valgrind
src/audio/SDL_audiotypecvt.c
src/audio/sdlgenaudiocvt.pl
     1.1 --- a/src/audio/SDL_audiotypecvt.c	Sun Jan 08 17:20:33 2012 -0500
     1.2 +++ b/src/audio/SDL_audiotypecvt.c	Sun Jan 08 17:31:11 2012 -0500
     1.3 @@ -7103,7 +7103,7 @@
     1.4  #endif
     1.5  
     1.6      const int dstsize = cvt->len_cvt * 2;
     1.7 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
     1.8 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2;
     1.9      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
    1.10      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.11      Sint16 last_sample0 = (Sint16) src[0];
    1.12 @@ -7156,7 +7156,7 @@
    1.13  #endif
    1.14  
    1.15      const int dstsize = cvt->len_cvt * 4;
    1.16 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
    1.17 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4;
    1.18      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
    1.19      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.20      Sint16 last_sample0 = (Sint16) src[0];
    1.21 @@ -7211,7 +7211,7 @@
    1.22  #endif
    1.23  
    1.24      const int dstsize = cvt->len_cvt * 2;
    1.25 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
    1.26 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2;
    1.27      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
    1.28      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.29      Sint16 last_sample1 = (Sint16) src[1];
    1.30 @@ -7273,7 +7273,7 @@
    1.31  #endif
    1.32  
    1.33      const int dstsize = cvt->len_cvt * 4;
    1.34 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
    1.35 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4;
    1.36      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
    1.37      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.38      Sint16 last_sample1 = (Sint16) src[1];
    1.39 @@ -7339,7 +7339,7 @@
    1.40  #endif
    1.41  
    1.42      const int dstsize = cvt->len_cvt * 2;
    1.43 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
    1.44 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2;
    1.45      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
    1.46      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.47      Sint16 last_sample3 = (Sint16) src[3];
    1.48 @@ -7419,7 +7419,7 @@
    1.49  #endif
    1.50  
    1.51      const int dstsize = cvt->len_cvt * 4;
    1.52 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
    1.53 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4;
    1.54      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
    1.55      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.56      Sint16 last_sample3 = (Sint16) src[3];
    1.57 @@ -7507,7 +7507,7 @@
    1.58  #endif
    1.59  
    1.60      const int dstsize = cvt->len_cvt * 2;
    1.61 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
    1.62 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2;
    1.63      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
    1.64      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.65      Sint16 last_sample5 = (Sint16) src[5];
    1.66 @@ -7605,7 +7605,7 @@
    1.67  #endif
    1.68  
    1.69      const int dstsize = cvt->len_cvt * 4;
    1.70 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
    1.71 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4;
    1.72      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
    1.73      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.74      Sint16 last_sample5 = (Sint16) src[5];
    1.75 @@ -7715,7 +7715,7 @@
    1.76  #endif
    1.77  
    1.78      const int dstsize = cvt->len_cvt * 2;
    1.79 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
    1.80 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2;
    1.81      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
    1.82      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.83      Sint16 last_sample7 = (Sint16) src[7];
    1.84 @@ -7831,7 +7831,7 @@
    1.85  #endif
    1.86  
    1.87      const int dstsize = cvt->len_cvt * 4;
    1.88 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
    1.89 +    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4;
    1.90      const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
    1.91      const Uint8 *target = ((const Uint8 *) cvt->buf);
    1.92      Sint16 last_sample7 = (Sint16) src[7];
    1.93 @@ -7963,7 +7963,7 @@
    1.94  #endif
    1.95  
    1.96      const int dstsize = cvt->len_cvt * 2;
    1.97 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
    1.98 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2;
    1.99      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.100      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.101      Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
   1.102 @@ -8016,7 +8016,7 @@
   1.103  #endif
   1.104  
   1.105      const int dstsize = cvt->len_cvt * 4;
   1.106 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
   1.107 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4;
   1.108      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.109      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.110      Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
   1.111 @@ -8071,7 +8071,7 @@
   1.112  #endif
   1.113  
   1.114      const int dstsize = cvt->len_cvt * 2;
   1.115 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
   1.116 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2;
   1.117      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.118      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.119      Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
   1.120 @@ -8133,7 +8133,7 @@
   1.121  #endif
   1.122  
   1.123      const int dstsize = cvt->len_cvt * 4;
   1.124 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
   1.125 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4;
   1.126      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.127      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.128      Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
   1.129 @@ -8199,7 +8199,7 @@
   1.130  #endif
   1.131  
   1.132      const int dstsize = cvt->len_cvt * 2;
   1.133 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
   1.134 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2;
   1.135      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.136      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.137      Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
   1.138 @@ -8279,7 +8279,7 @@
   1.139  #endif
   1.140  
   1.141      const int dstsize = cvt->len_cvt * 4;
   1.142 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
   1.143 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4;
   1.144      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.145      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.146      Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
   1.147 @@ -8367,7 +8367,7 @@
   1.148  #endif
   1.149  
   1.150      const int dstsize = cvt->len_cvt * 2;
   1.151 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
   1.152 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2;
   1.153      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.154      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.155      Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
   1.156 @@ -8465,7 +8465,7 @@
   1.157  #endif
   1.158  
   1.159      const int dstsize = cvt->len_cvt * 4;
   1.160 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
   1.161 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4;
   1.162      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.163      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.164      Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
   1.165 @@ -8575,7 +8575,7 @@
   1.166  #endif
   1.167  
   1.168      const int dstsize = cvt->len_cvt * 2;
   1.169 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
   1.170 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2;
   1.171      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.172      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.173      Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
   1.174 @@ -8691,7 +8691,7 @@
   1.175  #endif
   1.176  
   1.177      const int dstsize = cvt->len_cvt * 4;
   1.178 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
   1.179 +    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4;
   1.180      const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.181      const Sint8 *target = ((const Sint8 *) cvt->buf);
   1.182      Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
   1.183 @@ -8823,7 +8823,7 @@
   1.184  #endif
   1.185  
   1.186      const int dstsize = cvt->len_cvt * 2;
   1.187 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
   1.188 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2;
   1.189      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.190      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.191      Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
   1.192 @@ -8876,7 +8876,7 @@
   1.193  #endif
   1.194  
   1.195      const int dstsize = cvt->len_cvt * 4;
   1.196 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
   1.197 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4;
   1.198      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.199      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.200      Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
   1.201 @@ -8931,7 +8931,7 @@
   1.202  #endif
   1.203  
   1.204      const int dstsize = cvt->len_cvt * 2;
   1.205 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
   1.206 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2;
   1.207      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.208      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.209      Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
   1.210 @@ -8993,7 +8993,7 @@
   1.211  #endif
   1.212  
   1.213      const int dstsize = cvt->len_cvt * 4;
   1.214 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
   1.215 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4;
   1.216      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.217      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.218      Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
   1.219 @@ -9059,7 +9059,7 @@
   1.220  #endif
   1.221  
   1.222      const int dstsize = cvt->len_cvt * 2;
   1.223 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
   1.224 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2;
   1.225      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.226      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.227      Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
   1.228 @@ -9139,7 +9139,7 @@
   1.229  #endif
   1.230  
   1.231      const int dstsize = cvt->len_cvt * 4;
   1.232 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
   1.233 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4;
   1.234      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.235      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.236      Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
   1.237 @@ -9227,7 +9227,7 @@
   1.238  #endif
   1.239  
   1.240      const int dstsize = cvt->len_cvt * 2;
   1.241 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
   1.242 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2;
   1.243      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.244      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.245      Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
   1.246 @@ -9325,7 +9325,7 @@
   1.247  #endif
   1.248  
   1.249      const int dstsize = cvt->len_cvt * 4;
   1.250 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
   1.251 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4;
   1.252      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.253      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.254      Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
   1.255 @@ -9435,7 +9435,7 @@
   1.256  #endif
   1.257  
   1.258      const int dstsize = cvt->len_cvt * 2;
   1.259 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
   1.260 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2;
   1.261      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.262      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.263      Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
   1.264 @@ -9551,7 +9551,7 @@
   1.265  #endif
   1.266  
   1.267      const int dstsize = cvt->len_cvt * 4;
   1.268 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
   1.269 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4;
   1.270      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.271      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.272      Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
   1.273 @@ -9683,7 +9683,7 @@
   1.274  #endif
   1.275  
   1.276      const int dstsize = cvt->len_cvt * 2;
   1.277 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
   1.278 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2;
   1.279      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.280      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.281      Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
   1.282 @@ -9736,7 +9736,7 @@
   1.283  #endif
   1.284  
   1.285      const int dstsize = cvt->len_cvt * 4;
   1.286 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
   1.287 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4;
   1.288      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.289      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.290      Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
   1.291 @@ -9791,7 +9791,7 @@
   1.292  #endif
   1.293  
   1.294      const int dstsize = cvt->len_cvt * 2;
   1.295 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
   1.296 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2;
   1.297      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.298      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.299      Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
   1.300 @@ -9853,7 +9853,7 @@
   1.301  #endif
   1.302  
   1.303      const int dstsize = cvt->len_cvt * 4;
   1.304 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
   1.305 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4;
   1.306      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.307      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.308      Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
   1.309 @@ -9919,7 +9919,7 @@
   1.310  #endif
   1.311  
   1.312      const int dstsize = cvt->len_cvt * 2;
   1.313 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
   1.314 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2;
   1.315      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.316      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.317      Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
   1.318 @@ -9999,7 +9999,7 @@
   1.319  #endif
   1.320  
   1.321      const int dstsize = cvt->len_cvt * 4;
   1.322 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
   1.323 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4;
   1.324      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.325      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.326      Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
   1.327 @@ -10087,7 +10087,7 @@
   1.328  #endif
   1.329  
   1.330      const int dstsize = cvt->len_cvt * 2;
   1.331 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
   1.332 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2;
   1.333      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.334      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.335      Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
   1.336 @@ -10185,7 +10185,7 @@
   1.337  #endif
   1.338  
   1.339      const int dstsize = cvt->len_cvt * 4;
   1.340 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
   1.341 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4;
   1.342      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.343      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.344      Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
   1.345 @@ -10295,7 +10295,7 @@
   1.346  #endif
   1.347  
   1.348      const int dstsize = cvt->len_cvt * 2;
   1.349 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
   1.350 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2;
   1.351      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.352      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.353      Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
   1.354 @@ -10411,7 +10411,7 @@
   1.355  #endif
   1.356  
   1.357      const int dstsize = cvt->len_cvt * 4;
   1.358 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
   1.359 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4;
   1.360      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.361      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.362      Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
   1.363 @@ -10543,7 +10543,7 @@
   1.364  #endif
   1.365  
   1.366      const int dstsize = cvt->len_cvt * 2;
   1.367 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
   1.368 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2;
   1.369      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.370      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.371      Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
   1.372 @@ -10596,7 +10596,7 @@
   1.373  #endif
   1.374  
   1.375      const int dstsize = cvt->len_cvt * 4;
   1.376 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
   1.377 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4;
   1.378      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.379      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.380      Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
   1.381 @@ -10651,7 +10651,7 @@
   1.382  #endif
   1.383  
   1.384      const int dstsize = cvt->len_cvt * 2;
   1.385 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
   1.386 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2;
   1.387      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.388      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.389      Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
   1.390 @@ -10713,7 +10713,7 @@
   1.391  #endif
   1.392  
   1.393      const int dstsize = cvt->len_cvt * 4;
   1.394 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
   1.395 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4;
   1.396      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.397      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.398      Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
   1.399 @@ -10779,7 +10779,7 @@
   1.400  #endif
   1.401  
   1.402      const int dstsize = cvt->len_cvt * 2;
   1.403 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
   1.404 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2;
   1.405      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.406      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.407      Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
   1.408 @@ -10859,7 +10859,7 @@
   1.409  #endif
   1.410  
   1.411      const int dstsize = cvt->len_cvt * 4;
   1.412 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
   1.413 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4;
   1.414      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.415      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.416      Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
   1.417 @@ -10947,7 +10947,7 @@
   1.418  #endif
   1.419  
   1.420      const int dstsize = cvt->len_cvt * 2;
   1.421 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
   1.422 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2;
   1.423      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.424      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.425      Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
   1.426 @@ -11045,7 +11045,7 @@
   1.427  #endif
   1.428  
   1.429      const int dstsize = cvt->len_cvt * 4;
   1.430 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
   1.431 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4;
   1.432      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.433      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.434      Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
   1.435 @@ -11155,7 +11155,7 @@
   1.436  #endif
   1.437  
   1.438      const int dstsize = cvt->len_cvt * 2;
   1.439 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
   1.440 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2;
   1.441      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.442      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.443      Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
   1.444 @@ -11271,7 +11271,7 @@
   1.445  #endif
   1.446  
   1.447      const int dstsize = cvt->len_cvt * 4;
   1.448 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
   1.449 +    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4;
   1.450      const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.451      const Uint16 *target = ((const Uint16 *) cvt->buf);
   1.452      Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
   1.453 @@ -11403,7 +11403,7 @@
   1.454  #endif
   1.455  
   1.456      const int dstsize = cvt->len_cvt * 2;
   1.457 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
   1.458 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2;
   1.459      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.460      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.461      Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
   1.462 @@ -11456,7 +11456,7 @@
   1.463  #endif
   1.464  
   1.465      const int dstsize = cvt->len_cvt * 4;
   1.466 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
   1.467 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4;
   1.468      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.469      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.470      Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
   1.471 @@ -11511,7 +11511,7 @@
   1.472  #endif
   1.473  
   1.474      const int dstsize = cvt->len_cvt * 2;
   1.475 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
   1.476 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2;
   1.477      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.478      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.479      Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
   1.480 @@ -11573,7 +11573,7 @@
   1.481  #endif
   1.482  
   1.483      const int dstsize = cvt->len_cvt * 4;
   1.484 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
   1.485 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4;
   1.486      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.487      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.488      Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
   1.489 @@ -11639,7 +11639,7 @@
   1.490  #endif
   1.491  
   1.492      const int dstsize = cvt->len_cvt * 2;
   1.493 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
   1.494 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2;
   1.495      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.496      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.497      Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
   1.498 @@ -11719,7 +11719,7 @@
   1.499  #endif
   1.500  
   1.501      const int dstsize = cvt->len_cvt * 4;
   1.502 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
   1.503 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4;
   1.504      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.505      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.506      Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
   1.507 @@ -11807,7 +11807,7 @@
   1.508  #endif
   1.509  
   1.510      const int dstsize = cvt->len_cvt * 2;
   1.511 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
   1.512 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2;
   1.513      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.514      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.515      Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
   1.516 @@ -11905,7 +11905,7 @@
   1.517  #endif
   1.518  
   1.519      const int dstsize = cvt->len_cvt * 4;
   1.520 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
   1.521 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4;
   1.522      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.523      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.524      Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
   1.525 @@ -12015,7 +12015,7 @@
   1.526  #endif
   1.527  
   1.528      const int dstsize = cvt->len_cvt * 2;
   1.529 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
   1.530 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2;
   1.531      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.532      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.533      Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
   1.534 @@ -12131,7 +12131,7 @@
   1.535  #endif
   1.536  
   1.537      const int dstsize = cvt->len_cvt * 4;
   1.538 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
   1.539 +    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4;
   1.540      const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.541      const Sint16 *target = ((const Sint16 *) cvt->buf);
   1.542      Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
   1.543 @@ -12263,7 +12263,7 @@
   1.544  #endif
   1.545  
   1.546      const int dstsize = cvt->len_cvt * 2;
   1.547 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
   1.548 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2;
   1.549      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.550      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.551      Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
   1.552 @@ -12316,7 +12316,7 @@
   1.553  #endif
   1.554  
   1.555      const int dstsize = cvt->len_cvt * 4;
   1.556 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
   1.557 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4;
   1.558      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.559      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.560      Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
   1.561 @@ -12371,7 +12371,7 @@
   1.562  #endif
   1.563  
   1.564      const int dstsize = cvt->len_cvt * 2;
   1.565 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
   1.566 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2;
   1.567      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.568      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.569      Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
   1.570 @@ -12433,7 +12433,7 @@
   1.571  #endif
   1.572  
   1.573      const int dstsize = cvt->len_cvt * 4;
   1.574 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
   1.575 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4;
   1.576      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.577      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.578      Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
   1.579 @@ -12499,7 +12499,7 @@
   1.580  #endif
   1.581  
   1.582      const int dstsize = cvt->len_cvt * 2;
   1.583 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
   1.584 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2;
   1.585      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.586      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.587      Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
   1.588 @@ -12579,7 +12579,7 @@
   1.589  #endif
   1.590  
   1.591      const int dstsize = cvt->len_cvt * 4;
   1.592 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
   1.593 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4;
   1.594      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.595      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.596      Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
   1.597 @@ -12667,7 +12667,7 @@
   1.598  #endif
   1.599  
   1.600      const int dstsize = cvt->len_cvt * 2;
   1.601 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
   1.602 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2;
   1.603      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.604      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.605      Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
   1.606 @@ -12765,7 +12765,7 @@
   1.607  #endif
   1.608  
   1.609      const int dstsize = cvt->len_cvt * 4;
   1.610 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
   1.611 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4;
   1.612      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.613      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.614      Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
   1.615 @@ -12875,7 +12875,7 @@
   1.616  #endif
   1.617  
   1.618      const int dstsize = cvt->len_cvt * 2;
   1.619 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
   1.620 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2;
   1.621      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.622      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.623      Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
   1.624 @@ -12991,7 +12991,7 @@
   1.625  #endif
   1.626  
   1.627      const int dstsize = cvt->len_cvt * 4;
   1.628 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
   1.629 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4;
   1.630      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.631      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.632      Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
   1.633 @@ -13123,7 +13123,7 @@
   1.634  #endif
   1.635  
   1.636      const int dstsize = cvt->len_cvt * 2;
   1.637 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
   1.638 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2;
   1.639      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.640      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.641      Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
   1.642 @@ -13176,7 +13176,7 @@
   1.643  #endif
   1.644  
   1.645      const int dstsize = cvt->len_cvt * 4;
   1.646 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
   1.647 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4;
   1.648      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.649      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.650      Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
   1.651 @@ -13231,7 +13231,7 @@
   1.652  #endif
   1.653  
   1.654      const int dstsize = cvt->len_cvt * 2;
   1.655 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
   1.656 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2;
   1.657      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.658      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.659      Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
   1.660 @@ -13293,7 +13293,7 @@
   1.661  #endif
   1.662  
   1.663      const int dstsize = cvt->len_cvt * 4;
   1.664 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
   1.665 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4;
   1.666      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
   1.667      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.668      Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
   1.669 @@ -13359,7 +13359,7 @@
   1.670  #endif
   1.671  
   1.672      const int dstsize = cvt->len_cvt * 2;
   1.673 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
   1.674 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2;
   1.675      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.676      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.677      Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
   1.678 @@ -13439,7 +13439,7 @@
   1.679  #endif
   1.680  
   1.681      const int dstsize = cvt->len_cvt * 4;
   1.682 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
   1.683 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4;
   1.684      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
   1.685      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.686      Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
   1.687 @@ -13527,7 +13527,7 @@
   1.688  #endif
   1.689  
   1.690      const int dstsize = cvt->len_cvt * 2;
   1.691 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
   1.692 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2;
   1.693      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.694      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.695      Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
   1.696 @@ -13625,7 +13625,7 @@
   1.697  #endif
   1.698  
   1.699      const int dstsize = cvt->len_cvt * 4;
   1.700 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
   1.701 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4;
   1.702      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
   1.703      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.704      Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
   1.705 @@ -13735,7 +13735,7 @@
   1.706  #endif
   1.707  
   1.708      const int dstsize = cvt->len_cvt * 2;
   1.709 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
   1.710 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2;
   1.711      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.712      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.713      Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
   1.714 @@ -13851,7 +13851,7 @@
   1.715  #endif
   1.716  
   1.717      const int dstsize = cvt->len_cvt * 4;
   1.718 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
   1.719 +    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4;
   1.720      const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
   1.721      const Sint32 *target = ((const Sint32 *) cvt->buf);
   1.722      Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
   1.723 @@ -13983,7 +13983,7 @@
   1.724  #endif
   1.725  
   1.726      const int dstsize = cvt->len_cvt * 2;
   1.727 -    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
   1.728 +    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2;
   1.729      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
   1.730      const float *target = ((const float *) cvt->buf);
   1.731      double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
   1.732 @@ -14036,7 +14036,7 @@
   1.733  #endif
   1.734  
   1.735      const int dstsize = cvt->len_cvt * 4;
   1.736 -    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
   1.737 +    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4;
   1.738      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
   1.739      const float *target = ((const float *) cvt->buf);
   1.740      double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
   1.741 @@ -14091,7 +14091,7 @@
   1.742  #endif
   1.743  
   1.744      const int dstsize = cvt->len_cvt * 2;
   1.745 -    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
   1.746 +    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2;
   1.747      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
   1.748      const float *target = ((const float *) cvt->buf);
   1.749      double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
   1.750 @@ -14153,7 +14153,7 @@
   1.751  #endif
   1.752  
   1.753      const int dstsize = cvt->len_cvt * 4;
   1.754 -    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
   1.755 +    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4;
   1.756      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
   1.757      const float *target = ((const float *) cvt->buf);
   1.758      double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
   1.759 @@ -14219,7 +14219,7 @@
   1.760  #endif
   1.761  
   1.762      const int dstsize = cvt->len_cvt * 2;
   1.763 -    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
   1.764 +    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2;
   1.765      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
   1.766      const float *target = ((const float *) cvt->buf);
   1.767      double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
   1.768 @@ -14299,7 +14299,7 @@
   1.769  #endif
   1.770  
   1.771      const int dstsize = cvt->len_cvt * 4;
   1.772 -    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
   1.773 +    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4;
   1.774      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
   1.775      const float *target = ((const float *) cvt->buf);
   1.776      double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
   1.777 @@ -14387,7 +14387,7 @@
   1.778  #endif
   1.779  
   1.780      const int dstsize = cvt->len_cvt * 2;
   1.781 -    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
   1.782 +    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2;
   1.783      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
   1.784      const float *target = ((const float *) cvt->buf);
   1.785      double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
   1.786 @@ -14485,7 +14485,7 @@
   1.787  #endif
   1.788  
   1.789      const int dstsize = cvt->len_cvt * 4;
   1.790 -    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
   1.791 +    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4;
   1.792      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
   1.793      const float *target = ((const float *) cvt->buf);
   1.794      double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
   1.795 @@ -14595,7 +14595,7 @@
   1.796  #endif
   1.797  
   1.798      const int dstsize = cvt->len_cvt * 2;
   1.799 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
   1.800 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2;
   1.801      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
   1.802      const float *target = ((const float *) cvt->buf);
   1.803      double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
   1.804 @@ -14711,7 +14711,7 @@
   1.805  #endif
   1.806  
   1.807      const int dstsize = cvt->len_cvt * 4;
   1.808 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
   1.809 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4;
   1.810      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
   1.811      const float *target = ((const float *) cvt->buf);
   1.812      double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
   1.813 @@ -14843,7 +14843,7 @@
   1.814  #endif
   1.815  
   1.816      const int dstsize = cvt->len_cvt * 2;
   1.817 -    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
   1.818 +    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2;
   1.819      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
   1.820      const float *target = ((const float *) cvt->buf);
   1.821      double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
   1.822 @@ -14896,7 +14896,7 @@
   1.823  #endif
   1.824  
   1.825      const int dstsize = cvt->len_cvt * 4;
   1.826 -    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
   1.827 +    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4;
   1.828      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
   1.829      const float *target = ((const float *) cvt->buf);
   1.830      double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
   1.831 @@ -14951,7 +14951,7 @@
   1.832  #endif
   1.833  
   1.834      const int dstsize = cvt->len_cvt * 2;
   1.835 -    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
   1.836 +    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2;
   1.837      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
   1.838      const float *target = ((const float *) cvt->buf);
   1.839      double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
   1.840 @@ -15013,7 +15013,7 @@
   1.841  #endif
   1.842  
   1.843      const int dstsize = cvt->len_cvt * 4;
   1.844 -    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
   1.845 +    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4;
   1.846      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
   1.847      const float *target = ((const float *) cvt->buf);
   1.848      double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
   1.849 @@ -15079,7 +15079,7 @@
   1.850  #endif
   1.851  
   1.852      const int dstsize = cvt->len_cvt * 2;
   1.853 -    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
   1.854 +    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2;
   1.855      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
   1.856      const float *target = ((const float *) cvt->buf);
   1.857      double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
   1.858 @@ -15159,7 +15159,7 @@
   1.859  #endif
   1.860  
   1.861      const int dstsize = cvt->len_cvt * 4;
   1.862 -    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
   1.863 +    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4;
   1.864      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
   1.865      const float *target = ((const float *) cvt->buf);
   1.866      double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
   1.867 @@ -15247,7 +15247,7 @@
   1.868  #endif
   1.869  
   1.870      const int dstsize = cvt->len_cvt * 2;
   1.871 -    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
   1.872 +    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2;
   1.873      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
   1.874      const float *target = ((const float *) cvt->buf);
   1.875      double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
   1.876 @@ -15345,7 +15345,7 @@
   1.877  #endif
   1.878  
   1.879      const int dstsize = cvt->len_cvt * 4;
   1.880 -    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
   1.881 +    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4;
   1.882      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
   1.883      const float *target = ((const float *) cvt->buf);
   1.884      double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
   1.885 @@ -15455,7 +15455,7 @@
   1.886  #endif
   1.887  
   1.888      const int dstsize = cvt->len_cvt * 2;
   1.889 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
   1.890 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2;
   1.891      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
   1.892      const float *target = ((const float *) cvt->buf);
   1.893      double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
   1.894 @@ -15571,7 +15571,7 @@
   1.895  #endif
   1.896  
   1.897      const int dstsize = cvt->len_cvt * 4;
   1.898 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
   1.899 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4;
   1.900      const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
   1.901      const float *target = ((const float *) cvt->buf);
   1.902      double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
     2.1 --- a/src/audio/sdlgenaudiocvt.pl	Sun Jan 08 17:20:33 2012 -0500
     2.2 +++ b/src/audio/sdlgenaudiocvt.pl	Sun Jan 08 17:31:11 2012 -0500
     2.3 @@ -546,7 +546,7 @@
     2.4      if ($upsample) {
     2.5          $endcomparison = '>=';  # dst > target
     2.6          print <<EOF;
     2.7 -    $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
     2.8 +    $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels * $multiple;
     2.9      const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
    2.10      const $fctype *target = ((const $fctype *) cvt->buf);
    2.11  EOF