Skip to content

Commit

Permalink
Hi,
Browse files Browse the repository at this point in the history
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
  • Loading branch information
icculus committed Nov 10, 2003
1 parent 27a604b commit 32309de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions effect_position.c
Expand Up @@ -272,9 +272,9 @@ static void _Eff_position_s16lsb(int chan, void *stream, int len, void *udata)
int i;

for (i = 0; i < len; i += sizeof (Sint16) * 2) {
Sint16 swapl = (Sint16) ((((float) SDL_SwapLE16(*(ptr+0))) *
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
args->left_f) * args->distance_f);
Sint16 swapr = (Sint16) ((((float) SDL_SwapLE16(*(ptr+1))) *
Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
args->right_f) * args->distance_f);
*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
Expand Down Expand Up @@ -310,9 +310,9 @@ static void _Eff_position_s16msb(int chan, void *stream, int len, void *udata)
int i;

for (i = 0; i < len; i += sizeof (Sint16) * 2) {
Sint16 swapl = (Sint16) ((((float) SDL_SwapBE16(*(ptr+0))) *
Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
args->left_f) * args->distance_f);
Sint16 swapr = (Sint16) ((((float) SDL_SwapBE16(*(ptr+1))) *
Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+1))) *
args->right_f) * args->distance_f);
*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
Expand Down

0 comments on commit 32309de

Please sign in to comment.