From 32309de915bce65aa49f2e271ca960ffbed1ecb6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 10 Nov 2003 04:33:21 +0000 Subject: [PATCH] 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/effect_position.c b/effect_position.c index 6d7da0df..9578cbbc 100644 --- a/effect_position.c +++ b/effect_position.c @@ -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); @@ -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);