From 53d23216983a3339cc1ac2953b027c5376d4efd2 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sat, 16 Sep 2023 23:37:54 -0500 Subject: [PATCH] Fix issue in ArcticController where it was trying to create a variable-length buffer and breaking Windows build --- Controllers/ArcticController/ArcticController.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Controllers/ArcticController/ArcticController.cpp b/Controllers/ArcticController/ArcticController.cpp index aebc9585..de80a060 100644 --- a/Controllers/ArcticController/ArcticController.cpp +++ b/Controllers/ArcticController/ArcticController.cpp @@ -46,9 +46,9 @@ const unsigned char identify_payload[] = }; ArcticController::ArcticController(const std::string &portname) -: port_name(portname), - serialport(portname.c_str(), 250000, SERIAL_PORT_PARITY_NONE, SERIAL_PORT_SIZE_8, SERIAL_PORT_STOP_BITS_2, false) +: serialport(portname.c_str(), 250000, SERIAL_PORT_PARITY_NONE, SERIAL_PORT_SIZE_8, SERIAL_PORT_STOP_BITS_2, false) { + port_name = portname; serialport.serial_set_dtr(true); } @@ -65,7 +65,7 @@ static void FormatCommandBuffer(char *buffer, char command) void ArcticController::SetChannels(std::vector colors) { - char buffer[ARCTIC_COMMAND_BUFFER_LENGTH(colors.size() * 3)]; + char* buffer = new char[ARCTIC_COMMAND_BUFFER_LENGTH(colors.size() * 3)]; FormatCommandBuffer(buffer, ARCTIC_COMMAND_SET_RGB); @@ -79,6 +79,8 @@ void ArcticController::SetChannels(std::vector colors) } serialport.serial_write(buffer, sizeof(buffer)); + + delete[] buffer; } static char XORChecksum(char *data, int length)