avoid some pedantic warnings in array initializers

This commit is contained in:
Ozkan Sezer 2021-02-08 00:20:56 +03:00
parent 9c3aa7f055
commit dc45a228b9
3 changed files with 9 additions and 3 deletions

View File

@ -92,8 +92,9 @@ static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
{ {
const SDL_bool blink = SDL_FALSE; const SDL_bool blink = SDL_FALSE;
Uint8 mode = (blink ? 0x02 : 0x06) + slot; 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)) { if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
return SDL_FALSE; return SDL_FALSE;
} }

View File

@ -66,8 +66,9 @@ static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
{ {
const SDL_bool blink = SDL_FALSE; const SDL_bool blink = SDL_FALSE;
Uint8 mode = (blink ? 0x02 : 0x06) + slot; 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)) { if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
return SDL_FALSE; return SDL_FALSE;
} }

View File

@ -163,7 +163,11 @@ SendAckIfNeeded(SDL_HIDAPI_Device *device, Uint8 *data, int size)
/* The Windows driver is taking care of acks */ /* The Windows driver is taking care of acks */
#else #else
if ((data[1] & 0x30) == 0x30) { 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 */ /* The initial ack needs 0x80 added to the response, for some reason */
if (data[0] == 0x04 && data[1] == 0xF0) { if (data[0] == 0x04 && data[1] == 0xF0) {