Skip to content

Commit 0b5010c

Browse files
joschCalcProgrammer1
authored andcommitted
Controllers/MNTKeyboardController: MSVC does not like C99 variable length...
1 parent 246150b commit 0b5010c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Controllers/MNTKeyboardController/MNTKeyboardController.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ void MNTKeyboardController::SendColorMatrix(unsigned char *color_map)
2020
{
2121
unsigned char row_size = kbd_cols * KBD_COLOR_SIZE;
2222
unsigned char cmdbuf_size = CMD_OFFSET + row_size;
23-
unsigned char usb_buf[cmdbuf_size];
23+
unsigned char *usb_buf = new unsigned char[cmdbuf_size];
2424
memcpy(usb_buf, CMD_PREFIX, CMD_PREFIX_LEN);
2525
for(unsigned int row_idx = 0; row_idx < KBD_ROWS; row_idx++)
2626
{
2727
usb_buf[CMD_PREFIX_LEN] = row_idx;
2828
memcpy(usb_buf + CMD_OFFSET, color_map + row_idx * row_size, row_size);
2929
hid_write(dev, usb_buf, cmdbuf_size);
3030
}
31+
delete[] usb_buf;
3132
}

Controllers/MNTKeyboardController/RGBController_MNTKeyboard.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void RGBController_MNTKeyboard::SetupZones()
5252

5353
void RGBController_MNTKeyboard::DeviceUpdateLEDs()
5454
{
55-
unsigned char color_map[zones[0].leds_count * KBD_COLOR_SIZE];
55+
unsigned char *color_map = new unsigned char[zones[0].leds_count * KBD_COLOR_SIZE];
5656
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
5757
{
5858
RGBColor color = colors[led_idx];
@@ -62,6 +62,7 @@ void RGBController_MNTKeyboard::DeviceUpdateLEDs()
6262
color_map[offset + 0] = RGBGetBValue(color);
6363
}
6464
controller->SendColorMatrix(color_map);
65+
delete[] color_map;
6566
}
6667

6768
void RGBController_MNTKeyboard::ResizeZone(int, int)

0 commit comments

Comments
 (0)