Browse Source

avoid some pedantic warnings in array initializers

Ozkan Sezer 4 years ago
parent
commit
dc45a228b9

+ 2 - 1
src/joystick/hidapi/SDL_hidapi_xbox360.c

@@ -92,8 +92,9 @@ static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
 {
     const SDL_bool blink = SDL_FALSE;
     Uint8 mode = (blink ? 0x02 : 0x06) + slot;
-    const Uint8 led_packet[] = { 0x01, 0x03, mode };
+    Uint8 led_packet[] = { 0x01, 0x03, 0x00 };
 
+    led_packet[2] = mode;
     if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
         return SDL_FALSE;
     }

+ 2 - 1
src/joystick/hidapi/SDL_hidapi_xbox360w.c

@@ -66,8 +66,9 @@ static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
 {
     const SDL_bool blink = SDL_FALSE;
     Uint8 mode = (blink ? 0x02 : 0x06) + slot;
-    const Uint8 led_packet[] = { 0x00, 0x00, 0x08, (0x40 + (mode % 0x0e)), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+    Uint8 led_packet[] = { 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
+    led_packet[3] = 0x40 + (mode % 0x0e);
     if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
         return SDL_FALSE;
     }

+ 5 - 1
src/joystick/hidapi/SDL_hidapi_xboxone.c

@@ -163,7 +163,11 @@ SendAckIfNeeded(SDL_HIDAPI_Device *device, Uint8 *data, int size)
     /* The Windows driver is taking care of acks */
 #else
     if ((data[1] & 0x30) == 0x30) {
-        Uint8 ack_packet[] = { 0x01, 0x20, data[2], 0x09, 0x00, data[0], 0x20, data[3], 0x00, 0x00, 0x00, 0x00, 0x00 };
+        Uint8 ack_packet[] = { 0x01, 0x20, 0x00, 0x09, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+        ack_packet[2] = data[2];
+        ack_packet[5] = data[0];
+        ack_packet[7] = data[3];
 
         /* The initial ack needs 0x80 added to the response, for some reason */
         if (data[0] == 0x04 && data[1] == 0xF0) {