# HG changeset patch # User Edgar Simo # Date 1217960771 0 # Node ID eec0c81ede0653db19e0300cf749c8864871fdc3 # Parent 7c7a63f22afab5255f58ad1a07a2529834e8f25a CONVERT now checks for overflows. diff -r 7c7a63f22afa -r eec0c81ede06 src/haptic/darwin/SDL_syshaptic.c --- a/src/haptic/darwin/SDL_syshaptic.c Tue Aug 05 18:01:09 2008 +0000 +++ b/src/haptic/darwin/SDL_syshaptic.c Tue Aug 05 18:26:11 2008 +0000 @@ -576,7 +576,7 @@ } } -#define CONVERT(x) (((x)*10000) / 0x7FFF) +#define CONVERT(x) (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF) /* * Creates the FFEFFECT from a SDL_HapticEffect. */ diff -r 7c7a63f22afa -r eec0c81ede06 src/haptic/win32/SDL_syshaptic.c --- a/src/haptic/win32/SDL_syshaptic.c Tue Aug 05 18:01:09 2008 +0000 +++ b/src/haptic/win32/SDL_syshaptic.c Tue Aug 05 18:26:11 2008 +0000 @@ -575,7 +575,7 @@ } } -#define CONVERT(x) (((x)*10000) / 0x7FFF) +#define CONVERT(x) (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF) /* * Creates the DIEFFECT from a SDL_HapticEffect. */