# HG changeset patch # User Edgar Simo # Date 1218398038 0 # Node ID 668fee3b268a83394c9be4fda94354e5ca45262f # Parent db93456d4b26dfaee4245b24f975d77fd0d7e421 Casting for warnings. Fixed possible segfault. diff -r db93456d4b26 -r 668fee3b268a src/haptic/darwin/SDL_syshaptic.c --- a/src/haptic/darwin/SDL_syshaptic.c Sun Aug 10 19:47:02 2008 +0000 +++ b/src/haptic/darwin/SDL_syshaptic.c Sun Aug 10 19:53:58 2008 +0000 @@ -162,6 +162,11 @@ } /* IOServiceGetMatchingServices consumes dictionary. */ + if (!iter) { /* No iterator. */ + numhaptics = 0; + return 0; + } + numhaptics = 0; while ((device = IOIteratorNext(iter)) != IO_OBJECT_NULL) { @@ -459,7 +464,8 @@ int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { - if (IOObjectIsEqualTo(haptic->hwdata->device, joystick->hwdata->ffservice)) + if (IOObjectIsEqualTo((io_object_t) haptic->hwdata->device, + joystick->hwdata->ffservice)) return 1; return 0; } diff -r db93456d4b26 -r 668fee3b268a src/joystick/darwin/SDL_sysjoystick.c --- a/src/joystick/darwin/SDL_sysjoystick.c Sun Aug 10 19:47:02 2008 +0000 +++ b/src/joystick/darwin/SDL_sysjoystick.c Sun Aug 10 19:53:58 2008 +0000 @@ -649,7 +649,7 @@ /* We have to do some storage of the io_service_t for * SDL_HapticOpenFromJoystick */ - if (FFIsForceFeedback(device) == FF_OK) { + if (FFIsForceFeedback((io_service_t)device) == FF_OK) { device->ffservice = ioHIDDeviceObject; } else {