Fixed whitespace in SDL_evdev.c
authorSam Lantinga <slouken@libsdl.org>
Wed, 24 Jun 2015 17:55:38 -0700
changeset 9780 7f9b74280df6
parent 9779 49b5a975a238
child 9781 02273530b7bf
Fixed whitespace in SDL_evdev.c
src/core/linux/SDL_evdev.c
--- a/src/core/linux/SDL_evdev.c	Wed Jun 24 17:54:39 2015 -0700
+++ b/src/core/linux/SDL_evdev.c	Wed Jun 24 17:55:38 2015 -0700
@@ -364,7 +364,7 @@
     
     /* Try a few consoles to see which one we have read access to */
     
-    for( i = 0; i < SDL_arraysize(EVDEV_consoles); i++) {
+    for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) {
         fd = open(EVDEV_consoles[i], O_RDONLY);
         if (fd >= 0) {
             if (IS_CONSOLE(fd)) return fd;
@@ -374,7 +374,7 @@
     
     /* Try stdin, stdout, stderr */
     
-    for( fd = 0; fd < 3; fd++) {
+    for(fd = 0; fd < 3; fd++) {
         if (IS_CONSOLE(fd)) return fd;
     }
     
@@ -468,7 +468,7 @@
         }
 
         /* Set up the udev callback */
-        if ( SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) {
+        if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) {
             SDL_EVDEV_Quit();
             return -1;
         }
@@ -614,7 +614,7 @@
                     if (scan_code != SDL_SCANCODE_UNKNOWN) {
                         if (events[i].value == 0) {
                             SDL_SendKeyboardKey(SDL_RELEASED, scan_code);
-                        } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */ ) {
+                        } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */) {
                             SDL_SendKeyboardKey(SDL_PRESSED, scan_code);
 #ifdef SDL_INPUT_LINUXKD
                             if (_this->console_fd >= 0) {
@@ -625,12 +625,12 @@
                                 kbe.kb_table = 0;
                                 
                                 /* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */
-                                kbe.kb_table |= -( (modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
-                                kbe.kb_table |= -( (modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
-                                kbe.kb_table |= -( (modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
-                                kbe.kb_table |= -( (modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
-                                kbe.kb_table |= -( (modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
-                                kbe.kb_table |= -( (modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
+                                kbe.kb_table |= -((modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
+                                kbe.kb_table |= -((modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
+                                kbe.kb_table |= -((modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
+                                kbe.kb_table |= -((modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
+                                kbe.kb_table |= -((modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
+                                kbe.kb_table |= -((modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
 
                                 if (ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 && 
                                     ((KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER))) 
@@ -641,8 +641,8 @@
                                      * because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table 
                                      * So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale!
                                      */
-                                    if ( modstate & KMOD_CAPS && isalpha(kval) ) {
-                                        if ( isupper(kval) ) {
+                                    if (modstate & KMOD_CAPS && isalpha(kval)) {
+                                        if (isupper(kval)) {
                                             kval = tolower(kval);
                                         } else {
                                             kval = toupper(kval);
@@ -650,7 +650,7 @@
                                     }
                                      
                                     /* Convert to UTF-8 and send */
-                                    end = SDL_UCS4ToUTF8( kval, keysym);
+                                    end = SDL_UCS4ToUTF8(kval, keysym);
                                     *end = '\0';
                                     SDL_SendKeyboardText(keysym);
                                 }
@@ -732,7 +732,7 @@
 
     /* Check to make sure it's not already in list. */
     for (item = _this->first; item != NULL; item = item->next) {
-        if (strcmp(devpath, item->path) == 0) {
+        if (SDL_strcmp(devpath, item->path) == 0) {
             return -1;  /* already have this one */
         }
     }
@@ -779,7 +779,7 @@
 
     for (item = _this->first; item != NULL; item = item->next) {
         /* found it, remove it. */
-        if ( strcmp(devpath, item->path) ==0 ) {
+        if (SDL_strcmp(devpath, item->path) == 0) {
             if (prev != NULL) {
                 prev->next = item->next;
             } else {