src/haptic/linux/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2519 af9df9662807
parent 2518 07a5b225b9c9
child 2523 366d84fdf8d1
--- a/src/haptic/linux/SDL_syshaptic.c	Tue Jul 15 11:24:25 2008 +0000
+++ b/src/haptic/linux/SDL_syshaptic.c	Tue Jul 15 15:53:48 2008 +0000
@@ -672,17 +672,15 @@
  * Runs an effect.
  */
 int
-SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, int iterations)
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect,
+                        Uint32 iterations)
 {
    struct input_event run;
 
    /* Prepare to run the effect */
    run.type = EV_FF;
    run.code = effect->hweffect->effect.id;
-   if (iterations == SDL_HAPTIC_INFINITY)
-      run.value = INT_MAX;
-   else
-      run.value = iterations;
+   run.value = (iterations > INT_MAX) ? INT_MAX : iterations;
 
    if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) {
       SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));