Hi,
authorRyan C. Gordon <icculus@icculus.org>
Mon, 10 Nov 2003 04:33:21 +0000
changeset 2382eae977be9d0
parent 237 5fb7a859f158
child 239 a39ea7c6f912
Hi,

The attached patch for SDL_mixer CVS adds missing casts in two
effect_position.c functions; without them, the result is noise, as
SDL_SwapLE16's return value is unsigned. Because SDL_SwapLE16 currently
does nothing on LE systems, this error only shows up on BE systems.

Maybe for consistency, all of the SDL_endian.h functions / macros should
cast their results to Uint16/32/64?

Thanks,


Steven Fuller
effect_position.c
     1.1 --- a/effect_position.c	Sun Nov 09 20:11:30 2003 +0000
     1.2 +++ b/effect_position.c	Mon Nov 10 04:33:21 2003 +0000
     1.3 @@ -272,9 +272,9 @@
     1.4      int i;
     1.5  
     1.6      for (i = 0; i < len; i += sizeof (Sint16) * 2) {
     1.7 -        Sint16 swapl = (Sint16) ((((float) SDL_SwapLE16(*(ptr+0))) *
     1.8 +        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
     1.9                                      args->left_f) * args->distance_f);
    1.10 -        Sint16 swapr = (Sint16) ((((float) SDL_SwapLE16(*(ptr+1))) *
    1.11 +        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
    1.12                                      args->right_f) * args->distance_f);
    1.13          *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
    1.14          *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
    1.15 @@ -310,9 +310,9 @@
    1.16      int i;
    1.17  
    1.18      for (i = 0; i < len; i += sizeof (Sint16) * 2) {
    1.19 -        Sint16 swapl = (Sint16) ((((float) SDL_SwapBE16(*(ptr+0))) *
    1.20 +        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
    1.21                                      args->left_f) * args->distance_f);
    1.22 -        Sint16 swapr = (Sint16) ((((float) SDL_SwapBE16(*(ptr+1))) *
    1.23 +        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+1))) *
    1.24                                      args->right_f) * args->distance_f);
    1.25          *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
    1.26          *(ptr++) = (Sint16) SDL_SwapBE16(swapr);