fix indentation and spaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c
index e5a835a..beef010 100644
--- a/src/haptic/darwin/SDL_syshaptic.c
+++ b/src/haptic/darwin/SDL_syshaptic.c
@@ -192,17 +192,17 @@ static SDL_hapticlist_item *
HapticByDevIndex(int device_index)
{
SDL_hapticlist_item *item = SDL_hapticlist;
-
+
if ((device_index < 0) || (device_index >= numhaptics)) {
return NULL;
}
-
+
while (device_index > 0) {
SDL_assert(item != NULL);
device_index--;
item = item->next;
}
-
+
return item;
}
@@ -232,7 +232,7 @@ MacHaptic_MaybeAddDevice( io_object_t device )
if (item == NULL) {
return SDL_SetError("Could not allocate haptic storage");
}
-
+
/* retain it as we are going to keep it around a while */
IOObjectRetain(device);
@@ -240,7 +240,7 @@ MacHaptic_MaybeAddDevice( io_object_t device )
HIDGetDeviceProduct(device, item->name);
item->dev = device;
item->haptic = NULL;
-
+
/* Set usage pages. */
hidProperties = 0;
refCF = 0;
@@ -268,14 +268,14 @@ MacHaptic_MaybeAddDevice( io_object_t device )
}
CFRelease(hidProperties);
}
-
+
if (SDL_hapticlist_tail == NULL) {
SDL_hapticlist = SDL_hapticlist_tail = item;
} else {
SDL_hapticlist_tail->next = item;
SDL_hapticlist_tail = item;
}
-
+
/* Device has been added. */
++numhaptics;
@@ -287,7 +287,7 @@ MacHaptic_MaybeRemoveDevice( io_object_t device )
{
SDL_hapticlist_item *item;
SDL_hapticlist_item *prev = NULL;
-
+
for (item = SDL_hapticlist; item != NULL; item = item->next) {
/* found it, remove it. */
if (IOObjectIsEqualTo((io_object_t) item->dev, device)) {
@@ -306,14 +306,14 @@ MacHaptic_MaybeRemoveDevice( io_object_t device )
/* Need to decrement the haptic count */
--numhaptics;
/* !!! TODO: Send a haptic remove event? */
-
+
IOObjectRelease(item->dev);
SDL_free(item);
return retval;
}
prev = item;
}
-
+
return -1;
}
diff --git a/src/haptic/dummy/SDL_syshaptic.c b/src/haptic/dummy/SDL_syshaptic.c
index 9830ac4..09839c6 100644
--- a/src/haptic/dummy/SDL_syshaptic.c
+++ b/src/haptic/dummy/SDL_syshaptic.c
@@ -42,7 +42,7 @@ SDL_SYS_HapticInit(void)
int
SDL_SYS_NumHaptics(void)
{
- return 0;
+ return 0;
}
const char *
diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c
index 247cb28..764434f 100644
--- a/src/haptic/linux/SDL_syshaptic.c
+++ b/src/haptic/linux/SDL_syshaptic.c
@@ -59,7 +59,7 @@ typedef struct SDL_hapticlist_item
{
char *fname; /* Dev path name (like /dev/input/event1) */
SDL_Haptic *haptic; /* Assosciated haptic. */
- struct SDL_hapticlist_item *next;
+ struct SDL_hapticlist_item *next;
} SDL_hapticlist_item;
@@ -172,16 +172,16 @@ SDL_SYS_HapticInit(void)
}
#if SDL_USE_LIBUDEV
- if (SDL_UDEV_Init() < 0) {
+ if (SDL_UDEV_Init() < 0) {
return SDL_SetError("Could not initialize UDEV");
}
- if ( SDL_UDEV_AddCallback(haptic_udev_callback) < 0) {
- SDL_UDEV_Quit();
- return SDL_SetError("Could not setup haptic <-> udev callback");
- }
+ if ( SDL_UDEV_AddCallback(haptic_udev_callback) < 0) {
+ SDL_UDEV_Quit();
+ return SDL_SetError("Could not setup haptic <-> udev callback");
+ }
#endif /* SDL_USE_LIBUDEV */
-
+
return numhaptics;
}
@@ -215,21 +215,21 @@ void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const
if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
return;
}
-
+
switch( udev_type )
{
case SDL_UDEV_DEVICEADDED:
MaybeAddDevice(devpath);
break;
-
+
case SDL_UDEV_DEVICEREMOVED:
MaybeRemoveDevice(devpath);
break;
-
+
default:
break;
}
-
+
}
#endif /* SDL_USE_LIBUDEV */
@@ -252,7 +252,7 @@ MaybeAddDevice(const char *path)
/* check to see if file exists */
if (stat(path, &sb) != 0) {
return -1;
- }
+ }
/* check for duplicates */
duplicate = 0;
@@ -269,7 +269,7 @@ MaybeAddDevice(const char *path)
fd = open(path, O_RDWR, 0);
if (fd < 0) {
return -1;
- }
+ }
#ifdef DEBUG_INPUT_EVENTS
printf("Checking %s\n", path);
@@ -375,11 +375,11 @@ SDL_SYS_HapticNameFromFD(int fd)
const char *
SDL_SYS_HapticName(int index)
{
- SDL_hapticlist_item *item;
+ SDL_hapticlist_item *item;
int fd;
const char *name;
- item = HapticByDevIndex(index);
+ item = HapticByDevIndex(index);
/* Open the haptic device. */
name = NULL;
fd = open(item->fname, O_RDONLY, 0);
@@ -456,9 +456,9 @@ SDL_SYS_HapticOpen(SDL_Haptic * haptic)
{
int fd;
int ret;
- SDL_hapticlist_item *item;
+ SDL_hapticlist_item *item;
- item = HapticByDevIndex(haptic->index);
+ item = HapticByDevIndex(haptic->index);
/* Open the character device */
fd = open(item->fname, O_RDWR, 0);
if (fd < 0) {
@@ -486,9 +486,8 @@ SDL_SYS_HapticMouse(void)
{
int fd;
int device_index = 0;
- SDL_hapticlist_item *item;
+ SDL_hapticlist_item *item;
-
for (item = SDL_hapticlist; item; item = item->next) {
/* Open the device. */
fd = open(item->fname, O_RDWR, 0);
@@ -505,7 +504,7 @@ SDL_SYS_HapticMouse(void)
close(fd);
- ++device_index;
+ ++device_index;
}
return -1;
@@ -546,16 +545,16 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
int device_index = 0;
int fd;
int ret;
- SDL_hapticlist_item *item;
+ SDL_hapticlist_item *item;
/* Find the joystick in the haptic list. */
for (item = SDL_hapticlist; item; item = item->next) {
- if (SDL_strcmp(item->fname, joystick->hwdata->fname) == 0) {
- haptic->index = device_index;
- break;
- }
- ++device_index;
+ if (SDL_strcmp(item->fname, joystick->hwdata->fname) == 0) {
+ haptic->index = device_index;
+ break;
+ }
+ ++device_index;
}
if (device_index >= MAX_HAPTICS) {
return SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities");
@@ -609,14 +608,14 @@ void
SDL_SYS_HapticQuit(void)
{
SDL_hapticlist_item *item = NULL;
- SDL_hapticlist_item *next = NULL;
+ SDL_hapticlist_item *next = NULL;
for (item = SDL_hapticlist; item; item = next) {
- next = item->next;
+ next = item->next;
/* Opened and not closed haptics are leaked, this is on purpose.
* Close your haptic devices after usage. */
- SDL_free(item->fname);
- item->fname = NULL;
+ SDL_free(item->fname);
+ item->fname = NULL;
}
#if SDL_USE_LIBUDEV
@@ -911,7 +910,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
dest->u.rumble.strong_magnitude = leftright->large_magnitude;
dest->u.rumble.weak_magnitude = leftright->small_magnitude;
- break;
+ break;
default: