diff --git a/Controllers/AorusCPUCoolerController/ATC800Controller.cpp b/Controllers/AorusCPUCoolerController/ATC800Controller.cpp index 89e12bf5..32a2a704 100644 --- a/Controllers/AorusCPUCoolerController/ATC800Controller.cpp +++ b/Controllers/AorusCPUCoolerController/ATC800Controller.cpp @@ -24,7 +24,7 @@ ATC800Controller::~ATC800Controller() void ATC800Controller::SendCoolerMode ( unsigned char mode, - unsigned short speed, + unsigned short /*speed*/, unsigned char channel, unsigned char red, unsigned char green, diff --git a/Controllers/AuraSMBusController/AuraSMBusController.cpp b/Controllers/AuraSMBusController/AuraSMBusController.cpp index dc5ce949..12adb52e 100644 --- a/Controllers/AuraSMBusController/AuraSMBusController.cpp +++ b/Controllers/AuraSMBusController/AuraSMBusController.cpp @@ -10,6 +10,21 @@ #include "AuraSMBusController.h" #include +static const char* aura_channels[] = /* Aura channel strings */ +{ + "Audio", + "Backplate", + "Back I/O", + "Center", + "Center", + "DRAM", + "PCIe", + "RGB Header", + "RGB Header 2", + "RGB Header", + "Unknown", +}; + AuraSMBusController::AuraSMBusController(i2c_smbus_interface* bus, aura_dev_id dev) { this->bus = bus; diff --git a/Controllers/AuraSMBusController/AuraSMBusController.h b/Controllers/AuraSMBusController/AuraSMBusController.h index c5ba8e87..92c82d7e 100644 --- a/Controllers/AuraSMBusController/AuraSMBusController.h +++ b/Controllers/AuraSMBusController/AuraSMBusController.h @@ -66,21 +66,6 @@ enum AURA_LED_CHANNEL_RGB_HEADER_3 = 0x91, /* RGB Header 3 LED channel */ }; -static const char* aura_channels[] = /* Aura channel strings */ -{ - "Audio", - "Backplate", - "Back I/O", - "Center", - "Center", - "DRAM", - "PCIe", - "RGB Header", - "RGB Header 2", - "RGB Header", - "Unknown", -}; - enum { AURA_CONFIG_LED_COUNT = 0x02, /* LED Count configuration offset */ diff --git a/Controllers/AuraUSBController/AuraAddressableController.cpp b/Controllers/AuraUSBController/AuraAddressableController.cpp index ca265ca4..f3aed010 100644 --- a/Controllers/AuraUSBController/AuraAddressableController.cpp +++ b/Controllers/AuraUSBController/AuraAddressableController.cpp @@ -40,7 +40,7 @@ void AuraAddressableController::SetChannelLEDs(unsigned char channel, RGBColor * leds_to_send = num_colors - leds_sent; } - for(int led_idx = 0; led_idx < leds_to_send; led_idx++) + for(unsigned int led_idx = 0; led_idx < leds_to_send; led_idx++) { led_data[(led_idx * 3) + 0] = RGBGetRValue(colors[led_idx + leds_sent]); led_data[(led_idx * 3) + 1] = RGBGetGValue(colors[led_idx + leds_sent]); diff --git a/Controllers/AuraUSBController/AuraMainboardController.cpp b/Controllers/AuraUSBController/AuraMainboardController.cpp index 7345fd54..e5c66b19 100644 --- a/Controllers/AuraUSBController/AuraMainboardController.cpp +++ b/Controllers/AuraUSBController/AuraMainboardController.cpp @@ -44,7 +44,7 @@ void AuraMainboardController::SetChannelLEDs(unsigned char channel, RGBColor * c leds_to_send = num_colors - leds_sent; } - for(int led_idx = 0; led_idx < leds_to_send; led_idx++) + for(unsigned int led_idx = 0; led_idx < leds_to_send; led_idx++) { led_data[(led_idx * 3) + 0] = RGBGetRValue(colors[led_idx + leds_sent]); led_data[(led_idx * 3) + 1] = RGBGetGValue(colors[led_idx + leds_sent]); diff --git a/Controllers/CoolerMasterController/CMMP750Controller.cpp b/Controllers/CoolerMasterController/CMMP750Controller.cpp index 1c6dea24..92c10c19 100644 --- a/Controllers/CoolerMasterController/CMMP750Controller.cpp +++ b/Controllers/CoolerMasterController/CMMP750Controller.cpp @@ -9,18 +9,38 @@ #include "CMMP750Controller.h" +static unsigned char colour_mode_data[][6] = +{ + { 0x01, 0x04, 0xFF, 0x00, 0xFF, 0x00 }, /* Static */ + { 0x02, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Blinking */ + { 0x03, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Breathing */ + { 0x04, 0x04, 0x80, 0x00, 0x00, 0x00 }, /* Colour Cycle */ + { 0x05, 0x04, 0x80, 0x00, 0x00, 0x00 } /* Colour Breath */ +}; + +static unsigned char speed_mode_data[][9] = +{ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },/* Static */ + { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Blinking */ + { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Breathing */ + { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Colour Cycle */ + { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 } /* Colour Breath */ +}; + CMMP750Controller::CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path) { - int tmp_size = wcslen(_vendor); - dev = dev_handle; - location = _path; + std::size_t tmp_size = wcslen(_vendor); + dev = dev_handle; + location = _path; - for (int i=0; ( i= buffer[6]; i++) + for(int i = 0; speed_mode_data[current_mode][i] >= buffer[6]; i++) + { current_speed = i; + } } else { //Code should never reach here however just in case there is a failure set something - current_mode = MP750_MODE_COLOR_CYCLE; //Unicorn Spew + current_mode = MP750_MODE_COLOR_CYCLE; //Unicorn Spew current_red = 0xFF; current_green = 0xFF; current_blue = 0xFF; @@ -122,7 +144,7 @@ void CMMP750Controller::SendUpdate() unsigned char buffer[0x40] = { 0x00 }; int buffer_size = (sizeof(buffer) / sizeof(buffer[0])); - for(int i = 0; i < CM_COLOUR_MODE_DATA_SIZE; i++) + for(std::size_t i = 0; i < CM_COLOUR_MODE_DATA_SIZE; i++) { buffer[i] = colour_mode_data[current_mode][i]; } @@ -130,16 +152,16 @@ void CMMP750Controller::SendUpdate() if(current_mode > MP750_MODE_BREATHING) { //If the mode is random colours set SPEED at BYTE2 - buffer[CM_RED_BYTE] = speed_mode_data[current_mode][current_speed]; + buffer[CM_RED_BYTE] = speed_mode_data[current_mode][current_speed]; } else { //Otherwise SPEED is BYTE5 - buffer[CM_RED_BYTE] = current_red; - buffer[CM_GREEN_BYTE] = current_green; - buffer[CM_BLUE_BYTE] = current_blue; - buffer[CM_SPEED_BYTE] = speed_mode_data[current_mode][current_speed]; + buffer[CM_RED_BYTE] = current_red; + buffer[CM_GREEN_BYTE] = current_green; + buffer[CM_BLUE_BYTE] = current_blue; + buffer[CM_SPEED_BYTE] = speed_mode_data[current_mode][current_speed]; } hid_write(dev, buffer, buffer_size); -} \ No newline at end of file +} diff --git a/Controllers/CoolerMasterController/CMMP750Controller.h b/Controllers/CoolerMasterController/CMMP750Controller.h index 4f3383af..87552568 100644 --- a/Controllers/CoolerMasterController/CMMP750Controller.h +++ b/Controllers/CoolerMasterController/CMMP750Controller.h @@ -44,24 +44,6 @@ enum MP750_MODE_BREATH_CYCLE = 0x04 //Breathing Cycle Mode }; -static unsigned char colour_mode_data[][6] = -{ - { 0x01, 0x04, 0xFF, 0x00, 0xFF, 0x00 }, /* Static */ - { 0x02, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Blinking */ - { 0x03, 0x04, 0xFF, 0x00, 0xFF, 0x80 }, /* Breathing */ - { 0x04, 0x04, 0x80, 0x00, 0x00, 0x00 }, /* Colour Cycle */ - { 0x05, 0x04, 0x80, 0x00, 0x00, 0x00 } /* Colour Breath */ -}; - -static unsigned char speed_mode_data[][9] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },/* Static */ - { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Blinking */ - { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Breathing */ - { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 },/* Colour Cycle */ - { 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 } /* Colour Breath */ -}; - enum { MP750_SPEED_SLOWEST = 0x00, /* Slowest speed */ diff --git a/Controllers/EKController/EKController.cpp b/Controllers/EKController/EKController.cpp index 06afeb8d..051bbb1c 100644 --- a/Controllers/EKController/EKController.cpp +++ b/Controllers/EKController/EKController.cpp @@ -9,25 +9,60 @@ #include "EKController.h" +static unsigned char colour_mode_data[][16] = +{ + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x01, 0x00, 0xFF, 0x64}, // Static + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x02, 0x00, 0xFF, 0x64}, // Breathing + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x03, 0xFF, 0xFF, 0x64}, // Fading + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x04, 0x00, 0xFF, 0x64}, // Marquee + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x05, 0x00, 0xFF, 0x64}, // Covering Marquee + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x06, 0x00, 0xFF, 0x64}, // Pulse + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x07, 0x00, 0xFF, 0x64}, // Wave + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x08, 0x00, 0xFF, 0x64}, // Alternating + { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, + 0x00, 0x10, 0x20, 0x01, 0x09, 0x00, 0xFF, 0x64}, // Candle +}; + +static unsigned char speed_mode_data[][9] = +{ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Static + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Breathing + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Fading + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Marquee + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Covering Marquee + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Pulse + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Wave + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Alternating + { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 } // Candle +}; + EKController::EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path) { - int tmp_size = wcslen(_vendor); + std::size_t tmp_size = wcslen(_vendor); dev = dev_handle; - for(int i=0; (i < tmp_size) && (i < EK_DEVICE_NAME_SIZE); i++) + for(std::size_t i = 0; (i < tmp_size) && (i < EK_DEVICE_NAME_SIZE); i++) { device_name[i] = (char)_vendor[i]; } - for(int j=0; (j < wcslen(_vendor)) && ((tmp_size + j) < EK_DEVICE_NAME_SIZE); j++) + for(std::size_t j = 0; (j < wcslen(_vendor)) && ((tmp_size + j) < EK_DEVICE_NAME_SIZE); j++) { - device_name[tmp_size+j] = (char)_device_name[j]; + device_name[tmp_size + j] = (char)_device_name[j]; } location = _path; - current_mode = EK_MODE_STATIC; + current_mode = EK_MODE_STATIC; current_speed = EK_SPEED_NORMAL; } @@ -76,15 +111,15 @@ void EKController::SendUpdate() unsigned char buffer[EK_PACKET_LENGTH] = { 0x00 }; int buffer_size = (sizeof(buffer) / sizeof(buffer[0])); - for(int i = 0; i < EK_COLOUR_MODE_DATA_SIZE; i++) + for(std::size_t i = 0; i < EK_COLOUR_MODE_DATA_SIZE; i++) { buffer[i] = colour_mode_data[current_mode][i]; } //Set the relevant colour info - buffer[EK_RED_BYTE] = current_red; + buffer[EK_RED_BYTE] = current_red; buffer[EK_GREEN_BYTE] = current_green; - buffer[EK_BLUE_BYTE] = current_blue; + buffer[EK_BLUE_BYTE] = current_blue; buffer[EK_SPEED_BYTE] = speed_mode_data[current_mode][current_speed]; buffer[10] = 0x10; diff --git a/Controllers/EKController/EKController.h b/Controllers/EKController/EKController.h index 2c821117..ee89f255 100644 --- a/Controllers/EKController/EKController.h +++ b/Controllers/EKController/EKController.h @@ -39,41 +39,6 @@ enum EK_MODE_CANDLE = 0x08 //Candle Mode }; -static unsigned char colour_mode_data[][16] = -{ - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x01, 0x00, 0xFF, 0x64}, // Static - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x02, 0x00, 0xFF, 0x64}, // Breathing - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x03, 0xFF, 0xFF, 0x64}, // Fading - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x04, 0x00, 0xFF, 0x64}, // Marquee - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x05, 0x00, 0xFF, 0x64}, // Covering Marquee - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x06, 0x00, 0xFF, 0x64}, // Pulse - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x07, 0x00, 0xFF, 0x64}, // Wave - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x08, 0x00, 0xFF, 0x64}, // Alternating - { 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60, - 0x00, 0x10, 0x20, 0x01, 0x09, 0x00, 0xFF, 0x64}, // Candle -}; - -static unsigned char speed_mode_data[][9] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Static - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Breathing - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Fading - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Marquee - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Covering Marquee - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Pulse - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Wave - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Alternating - { 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 } // Candle -}; - enum { EK_SPEED_SLOWEST = 0x00, // Slowest speed diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp index 18d08b87..e313ab7e 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp @@ -116,7 +116,7 @@ void HyperXAlloyOriginsController::SendDirectColorPacket /*-----------------------------------------------------*\ | Copy in color data | \*-----------------------------------------------------*/ - for(int color_idx = 0; color_idx < color_count; color_idx++) + for(unsigned int color_idx = 0; color_idx < color_count; color_idx++) { buf[(color_idx * 4) + 1] = 0x81; buf[(color_idx * 4) + 2] = RGBGetRValue(color_data[color_idx]); @@ -128,4 +128,4 @@ void HyperXAlloyOriginsController::SendDirectColorPacket | Send packet | \*-----------------------------------------------------*/ hid_send_feature_report(dev, buf, 65); -} \ No newline at end of file +} diff --git a/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp b/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp index 62b9df59..86f420fd 100644 --- a/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp +++ b/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp @@ -65,7 +65,7 @@ std::string NZXTHue2Controller::GetFirmwareVersion() void NZXTHue2Controller::SendFan ( unsigned char port, - unsigned char mode, + unsigned char /*mode*/, unsigned char speed ) { @@ -120,7 +120,7 @@ void NZXTHue2Controller::UpdateDeviceList() ret_val = hid_read(dev, usb_buf, sizeof(usb_buf)); } while( (ret_val != 64) || (usb_buf[0] != 0x21) || (usb_buf[1] != 0x03) ); - for(int chan = 0; chan < num_rgb_channels; chan++) + for(unsigned int chan = 0; chan < num_rgb_channels; chan++) { unsigned int start = 0x0F + (6 * chan); unsigned int num_leds_on_channel = 0; @@ -179,7 +179,7 @@ void NZXTHue2Controller::UpdateStatus() /*-----------------------------------------------------*\ | Extract fan information | \*-----------------------------------------------------*/ - for(int fan_idx = 0; fan_idx < num_fan_channels; fan_idx++) + for(unsigned int fan_idx = 0; fan_idx < num_fan_channels; fan_idx++) { unsigned char cmd; unsigned short rpm; diff --git a/Controllers/RGBFusion2DRAMController/RGBFusion2DRAMController.cpp b/Controllers/RGBFusion2DRAMController/RGBFusion2DRAMController.cpp index 22d72bde..85a64807 100644 --- a/Controllers/RGBFusion2DRAMController/RGBFusion2DRAMController.cpp +++ b/Controllers/RGBFusion2DRAMController/RGBFusion2DRAMController.cpp @@ -61,9 +61,9 @@ void RGBFusion2DRAMController::Apply() void RGBFusion2DRAMController::SetLEDEffect ( - unsigned int led, + unsigned int /*led*/, int mode, - unsigned int speed, + unsigned int /*speed*/, unsigned char red, unsigned char green, unsigned char blue @@ -75,4 +75,4 @@ void RGBFusion2DRAMController::SetLEDEffect led_data[RGB_FUSION_2_DRAM_IDX_BLUE] = blue; bus->i2c_smbus_write_block_data(dev, RGB_FUSION_2_DRAM_LED_START_ADDR, 32, led_data); -} \ No newline at end of file +} diff --git a/Controllers/SapphireGPUController/SapphireGPUController.cpp b/Controllers/SapphireGPUController/SapphireGPUController.cpp index a189eaca..a1328868 100644 --- a/Controllers/SapphireGPUController/SapphireGPUController.cpp +++ b/Controllers/SapphireGPUController/SapphireGPUController.cpp @@ -52,7 +52,7 @@ void SapphireGPUController::SetColor(unsigned char red, unsigned char green, uns bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_BLUE, blue); } -void SapphireGPUController::SetMode(unsigned char mode, unsigned char speed) +void SapphireGPUController::SetMode(unsigned char mode, unsigned char /*speed*/) { bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_MODE, mode); } diff --git a/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp b/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp index 765ac807..0aa28e2c 100644 --- a/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp +++ b/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp @@ -18,12 +18,12 @@ bool TestForSapphireGPUController(i2c_smbus_interface* bus, unsigned char address) { - bool pass = false; - int res; + //bool pass = false; + //int res; if(bus->i2c_smbus_read_byte_data(address, 0x06) == 0xCC) { - pass = true; + //pass = true; } return(false); //TODO - better detection, leaving disabled for now diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp b/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp index bb3edaf2..af61183d 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp @@ -13,7 +13,7 @@ static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size) { - char* usb_pkt = new char[16]; + unsigned char usb_pkt[16]; memset(usb_pkt, 0x00, sizeof(usb_pkt)); // Report number @@ -30,9 +30,7 @@ static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size) usb_pkt[4 + i] = data_pkt[1 + i]; } - hid_write(dev, (unsigned char *)usb_pkt, 16); - - delete[] usb_pkt; + hid_write(dev, usb_pkt, 16); } SteelSeriesSiberiaController::SteelSeriesSiberiaController diff --git a/Controllers/TecknetController/TecknetController.cpp b/Controllers/TecknetController/TecknetController.cpp index 5d909687..14281c74 100644 --- a/Controllers/TecknetController/TecknetController.cpp +++ b/Controllers/TecknetController/TecknetController.cpp @@ -9,6 +9,18 @@ #include "TecknetController.h" +static unsigned char tecknet_colour_mode_data[][16] = +{ + { 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Static + { 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Breathing +}; + +static unsigned char tecknet_speed_mode_data[][9] = +{ + { 0x00, 0x00, 0x00, 0x00 }, // Static + { 0x00, 0x06, 0x03, 0x01 }, // Breathing +}; + TecknetController::TecknetController(hid_device* dev_handle, char *_path) { const int szTemp = 256; @@ -79,17 +91,17 @@ void TecknetController::SendUpdate() unsigned char buffer[TECKNET_PACKET_LENGTH] = { 0x00 }; int buffer_size = (sizeof(buffer) / sizeof(buffer[0])); - for(int i = 0; i < TECKNET_COLOUR_MODE_DATA_SIZE; i++) + for(std::size_t i = 0; i < TECKNET_COLOUR_MODE_DATA_SIZE; i++) { buffer[i] = tecknet_colour_mode_data[current_mode][i]; } //Set the relevant colour info - buffer[TECKNET_RED_BYTE] = current_red; - buffer[TECKNET_GREEN_BYTE] = current_green; - buffer[TECKNET_BLUE_BYTE] = current_blue; + buffer[TECKNET_RED_BYTE] = current_red; + buffer[TECKNET_GREEN_BYTE] = current_green; + buffer[TECKNET_BLUE_BYTE] = current_blue; buffer[TECKNET_BRIGHTNESS_BYTE] = current_brightness; - buffer[TECKNET_SPEED_BYTE] = tecknet_speed_mode_data[current_mode][current_speed]; + buffer[TECKNET_SPEED_BYTE] = tecknet_speed_mode_data[current_mode][current_speed]; hid_send_feature_report(dev, buffer, buffer_size); } diff --git a/Controllers/TecknetController/TecknetController.h b/Controllers/TecknetController/TecknetController.h index 264b144b..cbedba4f 100644 --- a/Controllers/TecknetController/TecknetController.h +++ b/Controllers/TecknetController/TecknetController.h @@ -41,18 +41,6 @@ enum TECKNET_BRIGHTNESS_HIGH = 0x03 }; -static unsigned char tecknet_colour_mode_data[][16] = -{ - { 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Static - { 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Breathing -}; - -static unsigned char tecknet_speed_mode_data[][9] = -{ - { 0x00, 0x00, 0x00, 0x00 }, // Static - { 0x00, 0x06, 0x03, 0x01 }, // Breathing -}; - enum { TECKNET_SPEED_OFF = 0x00, // Breathe Off diff --git a/Controllers/TecknetController/TecknetControllerDetect.cpp b/Controllers/TecknetController/TecknetControllerDetect.cpp index 4f2f322c..d051f73d 100644 --- a/Controllers/TecknetController/TecknetControllerDetect.cpp +++ b/Controllers/TecknetController/TecknetControllerDetect.cpp @@ -29,7 +29,7 @@ enum TECKNET_USAGE_PAGE = 3 }; -static const unsigned int tecknet_pids[][4] = +static const int tecknet_pids[][4] = { // PID, Interface, Usage, Usage_Page { TECKNET_M0008_PID, 0, TECKNET_M0008_U, TECKNET_M0008_UPG } //Tecknet M008 Mouse }; diff --git a/NetworkClient.cpp b/NetworkClient.cpp index 23638247..8146dc84 100644 --- a/NetworkClient.cpp +++ b/NetworkClient.cpp @@ -373,7 +373,7 @@ void NetworkClient::ListenThreadFunction() { int tmp_bytes_read = 0; - tmp_bytes_read = recv_select(client_sock, &data[bytes_read], header.pkt_size - bytes_read, 0); + tmp_bytes_read = recv_select(client_sock, &data[(unsigned int)bytes_read], header.pkt_size - bytes_read, 0); if(tmp_bytes_read <= 0) { @@ -404,9 +404,9 @@ listen_done: server_initialized = false; server_connected = false; - for(int server_controller_idx = 0; server_controller_idx < server_controllers.size(); server_controller_idx++) + for(size_t server_controller_idx = 0; server_controller_idx < server_controllers.size(); server_controller_idx++) { - for(int controller_idx = 0; controller_idx < controllers.size(); controller_idx++) + for(size_t controller_idx = 0; controller_idx < controllers.size(); controller_idx++) { if(controllers[controller_idx] == server_controllers[server_controller_idx]) { diff --git a/NetworkServer.cpp b/NetworkServer.cpp index bad804ff..f5caaabe 100644 --- a/NetworkServer.cpp +++ b/NetworkServer.cpp @@ -438,7 +438,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info) { int tmp_bytes_read = 0; - tmp_bytes_read = recv_select(client_sock, &data[bytes_read], header.pkt_size - bytes_read, 0); + tmp_bytes_read = recv_select(client_sock, &data[(unsigned int)bytes_read], header.pkt_size - bytes_read, 0); if(tmp_bytes_read <= 0) { diff --git a/OpenRGB.pro b/OpenRGB.pro index 55fe7d8b..9c593312 100644 --- a/OpenRGB.pro +++ b/OpenRGB.pro @@ -231,6 +231,7 @@ HEADERS += \ RGBController/RGBController_SteelSeriesApex.h \ RGBController/RGBController_Tecknet.h \ RGBController/RGBController_ThermaltakeRiing.h \ + RGBController/OpenRazerDevices.h \ SOURCES += \ dependencies/dmiinfo.cpp \ diff --git a/RGBController/OpenRazerDevices.h b/RGBController/OpenRazerDevices.h index 0b0d9731..b2b243fb 100644 --- a/RGBController/OpenRazerDevices.h +++ b/RGBController/OpenRazerDevices.h @@ -1,5 +1,8 @@ #define RAZER_MAX_ZONES 6 +#include +#include "RGBController.h" + typedef struct { std::string name; diff --git a/RGBController/RGBController.cpp b/RGBController/RGBController.cpp index 7d42ae4a..d3f1d82d 100644 --- a/RGBController/RGBController.cpp +++ b/RGBController/RGBController.cpp @@ -357,7 +357,7 @@ unsigned char * RGBController::GetDeviceDescription() /*---------------------------------------------------------*\ | Copy in matrix map | \*---------------------------------------------------------*/ - for(int matrix_idx = 0; matrix_idx < (zones[zone_index].matrix_map->height * zones[zone_index].matrix_map->width); matrix_idx++) + for(unsigned int matrix_idx = 0; matrix_idx < (zones[zone_index].matrix_map->height * zones[zone_index].matrix_map->width); matrix_idx++) { memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->map[matrix_idx], sizeof(zones[zone_index].matrix_map->map[matrix_idx])); data_ptr += sizeof(zones[zone_index].matrix_map->map[matrix_idx]); @@ -677,7 +677,7 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf) \*---------------------------------------------------------*/ new_map->map = new unsigned int[new_map->height * new_map->width]; - for(int matrix_idx = 0; matrix_idx < (new_map->height * new_map->width); matrix_idx++) + for(unsigned int matrix_idx = 0; matrix_idx < (new_map->height * new_map->width); matrix_idx++) { memcpy(&new_map->map[matrix_idx], &data_buf[data_ptr], sizeof(new_map->map[matrix_idx])); data_ptr += sizeof(new_map->map[matrix_idx]); diff --git a/RGBController/RGBController_AuraCore.cpp b/RGBController/RGBController_AuraCore.cpp index 098628fc..a825eded 100644 --- a/RGBController/RGBController_AuraCore.cpp +++ b/RGBController/RGBController_AuraCore.cpp @@ -51,7 +51,7 @@ void RGBController_AuraCore::SetupZones() Keyboard.matrix_map = NULL; zones.push_back(Keyboard); - for(int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++) + for(unsigned int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++) { led KeyLED; KeyLED.name = "Keyboard LED "; diff --git a/RGBController/RGBController_CorsairHydro.cpp b/RGBController/RGBController_CorsairHydro.cpp index 8383ca77..a4baf117 100644 --- a/RGBController/RGBController_CorsairHydro.cpp +++ b/RGBController/RGBController_CorsairHydro.cpp @@ -98,12 +98,12 @@ void RGBController_CorsairHydro::DeviceUpdateLEDs() DeviceUpdateMode(); } -void RGBController_CorsairHydro::UpdateZoneLEDs(int zone) +void RGBController_CorsairHydro::UpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_CorsairHydro::UpdateSingleLED(int led) +void RGBController_CorsairHydro::UpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -133,4 +133,4 @@ void RGBController_CorsairHydro::DeviceUpdateMode() corsair->SetPulse(modes[active_mode].colors, modes[active_mode].speed); break; } -} \ No newline at end of file +} diff --git a/RGBController/RGBController_DuckyKeyboard.cpp b/RGBController/RGBController_DuckyKeyboard.cpp index 07694f3c..c6ad3771 100644 --- a/RGBController/RGBController_DuckyKeyboard.cpp +++ b/RGBController/RGBController_DuckyKeyboard.cpp @@ -227,16 +227,18 @@ void RGBController_DuckyKeyboard::SetupZones() SetupColors(); } -void RGBController_DuckyKeyboard::ResizeZone(int zone, int new_size) +void RGBController_DuckyKeyboard::ResizeZone(int /*zone*/, int /*new_size*/) { - + /*---------------------------------------------------------*\ + | This device does not support resizing zones | + \*---------------------------------------------------------*/ } void RGBController_DuckyKeyboard::DeviceUpdateLEDs() { unsigned char colordata[155*3]; - for(int color_idx = 0; color_idx < colors.size(); color_idx++) + for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++) { colordata[(color_idx*3)+0] = RGBGetRValue(colors[color_idx]); colordata[(color_idx*3)+1] = RGBGetGValue(colors[color_idx]); @@ -246,12 +248,12 @@ void RGBController_DuckyKeyboard::DeviceUpdateLEDs() ducky->SendColors(colordata, sizeof(colordata)); } -void RGBController_DuckyKeyboard::UpdateZoneLEDs(int zone) +void RGBController_DuckyKeyboard::UpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_DuckyKeyboard::UpdateSingleLED(int led) +void RGBController_DuckyKeyboard::UpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } @@ -264,4 +266,4 @@ void RGBController_DuckyKeyboard::SetCustomMode() void RGBController_DuckyKeyboard::DeviceUpdateMode() { -} \ No newline at end of file +} diff --git a/RGBController/RGBController_E131.cpp b/RGBController/RGBController_E131.cpp index 5f292cf2..0fd81b3d 100644 --- a/RGBController/RGBController_E131.cpp +++ b/RGBController/RGBController_E131.cpp @@ -106,7 +106,7 @@ RGBController_E131::RGBController_E131(std::vector device_list) case E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT: for(unsigned int y = 0; y < new_map->height; y++) { - for(unsigned int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map->width - 1; x >= 0; x--) { new_map->map[(y * new_map->width) + x] = led_idx; led_idx++; @@ -114,7 +114,7 @@ RGBController_E131::RGBController_E131(std::vector device_list) } break; case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT: - for(unsigned int y = new_map->height; y >= 0; y--) + for(int y = new_map->height; y >= 0; y--) { for(unsigned int x = 0; x < new_map->width; x++) { @@ -124,9 +124,9 @@ RGBController_E131::RGBController_E131(std::vector device_list) } break; case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT: - for(unsigned int y = new_map->height; y >= 0; y--) + for(int y = new_map->height; y >= 0; y--) { - for(unsigned int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map->width - 1; x >= 0; x--) { new_map->map[(y * new_map->width) + x] = led_idx; led_idx++; @@ -144,7 +144,7 @@ RGBController_E131::RGBController_E131(std::vector device_list) } break; case E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT: - for(unsigned int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map->width - 1; x >= 0; x--) { for(unsigned int y = 0; y < new_map->height; y++) { @@ -156,7 +156,7 @@ RGBController_E131::RGBController_E131(std::vector device_list) case E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT: for(unsigned int x = 0; x < new_map->width; x++) { - for(unsigned int y = new_map->height - 1; y >= 0; y++) + for(int y = new_map->height - 1; y >= 0; y--) { new_map->map[(y * new_map->width) + x] = led_idx; led_idx++; @@ -164,9 +164,9 @@ RGBController_E131::RGBController_E131(std::vector device_list) } break; case E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT: - for(unsigned int x = new_map->width - 1; x >= 0; x--) + for(int x = new_map->width - 1; x >= 0; x--) { - for(unsigned int y = new_map->height - 1; y >= 0; y--) + for(int y = new_map->height - 1; y >= 0; y--) { new_map->map[(y * new_map->width) + x] = led_idx; led_idx++; diff --git a/RGBController/RGBController_GalaxGPU.cpp b/RGBController/RGBController_GalaxGPU.cpp index 58ac4320..482c2df3 100644 --- a/RGBController/RGBController_GalaxGPU.cpp +++ b/RGBController/RGBController_GalaxGPU.cpp @@ -12,7 +12,6 @@ int RGBController_GalaxGPU::GetDeviceMode() { int modereg1 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_1); int modereg2 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_2); - int color_mode = MODE_COLORS_PER_LED; if (modereg1 == GALAX_MODE_STATIC_VALUE_1 && modereg2 == GALAX_MODE_STATIC_VALUE_2) { @@ -38,7 +37,6 @@ int RGBController_GalaxGPU::GetDeviceMode() modes[active_mode].color_mode = MODE_COLORS_NONE; } - return(active_mode); } @@ -46,7 +44,6 @@ RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_pt { galax_gpu = galax_gpu_ptr; - name = galax_gpu->GetDeviceName(); type = DEVICE_TYPE_GPU; description = "GALAX / KFA2 RTX GPU"; diff --git a/RGBController/RGBController_HyperXAlloyOrigins.cpp b/RGBController/RGBController_HyperXAlloyOrigins.cpp index 376a5cbc..8fabf307 100644 --- a/RGBController/RGBController_HyperXAlloyOrigins.cpp +++ b/RGBController/RGBController_HyperXAlloyOrigins.cpp @@ -269,9 +269,11 @@ void RGBController_HyperXAlloyOrigins::SetupZones() SetupColors(); } -void RGBController_HyperXAlloyOrigins::ResizeZone(int zone, int new_size) +void RGBController_HyperXAlloyOrigins::ResizeZone(int /*zone*/, int /*new_size*/) { - + /*---------------------------------------------------------*\ + | This device does not support resizing zones | + \*---------------------------------------------------------*/ } void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs() @@ -279,12 +281,12 @@ void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs() hyperx->SetLEDsDirect(colors); } -void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int zone) +void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int /*zone*/) { DeviceUpdateLEDs(); } -void RGBController_HyperXAlloyOrigins::UpdateSingleLED(int led) +void RGBController_HyperXAlloyOrigins::UpdateSingleLED(int /*led*/) { DeviceUpdateLEDs(); } diff --git a/RGBController/RGBController_LogitechG810.cpp b/RGBController/RGBController_LogitechG810.cpp index 9a4c5c38..7f70c3ca 100644 --- a/RGBController/RGBController_LogitechG810.cpp +++ b/RGBController/RGBController_LogitechG810.cpp @@ -286,7 +286,7 @@ void RGBController_LogitechG810::DeviceUpdateLEDs() /*---------------------------------------------------------*\ | TODO: Send packets with multiple LED frames | \*---------------------------------------------------------*/ - for(int led_idx = 0; led_idx < leds.size(); led_idx++) + for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++) { zone = ( leds[led_idx].value >> 8 ); idx = ( leds[led_idx].value & 0xFF ); diff --git a/RGBController/RGBController_OpenRazer.cpp b/RGBController/RGBController_OpenRazer.cpp index 24bb6da3..6818b553 100644 --- a/RGBController/RGBController_OpenRazer.cpp +++ b/RGBController/RGBController_OpenRazer.cpp @@ -8,6 +8,7 @@ \*-----------------------------------------*/ #include "RGBController_OpenRazer.h" +#include "OpenRazerDevices.h" #include #include @@ -398,9 +399,9 @@ void RGBController_OpenRazer::SetupZones() new_map->map = new unsigned int[new_map->height * new_map->width]; - for(int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_map->height; y++) { - for(int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_map->width; x++) { new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; } @@ -428,7 +429,7 @@ void RGBController_OpenRazer::SetupZones() if(device_list[device_index]->keymap != NULL) { - for(int i = 0; i < device_list[device_index]->keymap_size; i++) + for(unsigned int i = 0; i < device_list[device_index]->keymap_size; i++) { if(zone_id == device_list[device_index]->keymap[i].zone && row_id == device_list[device_index]->keymap[i].row && @@ -468,7 +469,7 @@ void RGBController_OpenRazer::SetCustomMode() \*---------------------------------------------------------*/ else { - for(int i = 0; i < modes.size(); i++) + for(unsigned int i = 0; i < modes.size(); i++) { if(modes[i].value == RAZER_MODE_STATIC) { diff --git a/RGBController/RGBController_OpenRazer.h b/RGBController/RGBController_OpenRazer.h index aa8cff94..2ce7f22d 100644 --- a/RGBController/RGBController_OpenRazer.h +++ b/RGBController/RGBController_OpenRazer.h @@ -10,7 +10,6 @@ #pragma once #include "RGBController.h" -#include "OpenRazerDevices.h" #include diff --git a/RGBController/RGBController_OpenRazerWindows.cpp b/RGBController/RGBController_OpenRazerWindows.cpp index 5d41886e..930c57d2 100644 --- a/RGBController/RGBController_OpenRazerWindows.cpp +++ b/RGBController/RGBController_OpenRazerWindows.cpp @@ -346,9 +346,9 @@ void RGBController_OpenRazer::SetupZones() new_map->map = new unsigned int[new_map->height * new_map->width]; - for(int y = 0; y < new_map->height; y++) + for(unsigned int y = 0; y < new_map->height; y++) { - for(int x = 0; x < new_map->width; x++) + for(unsigned int x = 0; x < new_map->width; x++) { new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x; } @@ -376,7 +376,7 @@ void RGBController_OpenRazer::SetupZones() if(device_list[device_index]->keymap != NULL) { - for(int i = 0; i < device_list[device_index]->keymap_size; i++) + for(unsigned int i = 0; i < device_list[device_index]->keymap_size; i++) { if(zone_id == device_list[device_index]->keymap[i].zone && row_id == device_list[device_index]->keymap[i].row && @@ -416,7 +416,7 @@ void RGBController_OpenRazer::SetCustomMode() \*---------------------------------------------------------*/ else { - for(int i = 0; i < modes.size(); i++) + for(unsigned int i = 0; i < modes.size(); i++) { if(modes[i].value == RAZER_MODE_STATIC) { diff --git a/RGBController/RGBController_RGBFusion2USB.cpp b/RGBController/RGBController_RGBFusion2USB.cpp index 18873829..11f43295 100644 --- a/RGBController/RGBController_RGBFusion2USB.cpp +++ b/RGBController/RGBController_RGBFusion2USB.cpp @@ -203,7 +203,7 @@ void RGBController_RGBFusion2USB::Init_Controller() std::vector lp = zl->second; int LED_count = 0; //We're going to count the leds in the zone bool boolSingleLED = true; //If all the Ledport.count == 1 then the zone is ZONE_TYPE_SINGLE - for(int lp_idx = 0; lp_idx < lp.size(); lp_idx++) + for(std::size_t lp_idx = 0; lp_idx < lp.size(); lp_idx++) { int lp_count = lp[lp_idx].count; boolSingleLED = boolSingleLED && (lp_count == 1); //Is this a single LED zone?? @@ -241,7 +241,7 @@ void RGBController_RGBFusion2USB::SetupZones() controller->DisableBuiltinEffect(0, 0x3); } - for(int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++) + for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++) { led new_led; @@ -310,7 +310,7 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone) unsigned char grn = 0; unsigned char blu = 0; - for(size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++) + for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++) { /*---------------------------------------------------------*\ | Initialize mode value | @@ -455,11 +455,12 @@ void RGBController_RGBFusion2USB::DeviceUpdateMode() int RGBController_RGBFusion2USB::GetLED_Zone(int led_idx) { //This may be more useful in the abstract RGBController.cpp - for(int zone_idx = 0; zone_idx < zones.size(); zone_idx++) + for(size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++) { int zone_start = zones[zone_idx].start_idx; int zone_end = zone_start + zones[zone_idx].leds_count - 1; if( zone_start <= led_idx && zone_end >= led_idx) return(zone_idx); } + return -1; // NotFound error? } diff --git a/RGBController/RGBController_SteelSeriesRival.cpp b/RGBController/RGBController_SteelSeriesRival.cpp index 1b1e25f4..91026166 100644 --- a/RGBController/RGBController_SteelSeriesRival.cpp +++ b/RGBController/RGBController_SteelSeriesRival.cpp @@ -125,7 +125,7 @@ void RGBController_SteelSeriesRival::DeviceUpdateMode() { /* Strictly, the device actually does support different modes for the * different zones, but we don't support that. */ - steelseries_type mouse_type = rival->GetMouseType(); + //steelseries_type mouse_type = rival->GetMouseType(); switch (modes[active_mode].value) { case STEELSERIES_RIVAL_STATIC: diff --git a/cli.cpp b/cli.cpp index 78d6b755..6226b317 100644 --- a/cli.cpp +++ b/cli.cpp @@ -700,7 +700,7 @@ int ProcessOptions(int argc, char *argv[], Options *options, std::vector= 1024 && port <= 65535) + try { - options->servOpts.port = port; - } - else + int port = std::stoi(argument); + if (port >= 1024 && port <= 65535) + { + options->servOpts.port = port; + } + else + { + std::cout << "Error: Port out of range: " << port << " (1024-65535)" << std::endl; + return RET_FLAG_PRINT_HELP; + } + } + catch(std::invalid_argument& e) { - std::cout << "Error: port out of range: " << port << " (1024-65535)" << std::endl; + std::cout << "Error: Invalid data in --server-port argument (expected a number in range 1024-65535)" << std::endl; return RET_FLAG_PRINT_HELP; } } diff --git a/i2c_smbus/i2c_smbus.cpp b/i2c_smbus/i2c_smbus.cpp index 0db701a4..e747180d 100644 --- a/i2c_smbus/i2c_smbus.cpp +++ b/i2c_smbus/i2c_smbus.cpp @@ -159,8 +159,6 @@ s32 i2c_smbus_interface::i2c_smbus_write_i2c_block_data(u8 addr, u8 command, u8 s32 i2c_smbus_interface::i2c_smbus_xfer_call(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data) { - s32 ret_val = 0; - i2c_smbus_xfer_mutex.lock(); i2c_addr = addr; @@ -179,8 +177,6 @@ s32 i2c_smbus_interface::i2c_smbus_xfer_call(u8 addr, char read_write, u8 comman i2c_smbus_done_cv.wait(done_lock, [this]{ return i2c_smbus_done.load(); }); i2c_smbus_done = false; - ret_val = i2c_ret; - i2c_smbus_xfer_mutex.unlock(); return(i2c_ret); diff --git a/main.cpp b/main.cpp index 93ee28bc..b67e5d72 100644 --- a/main.cpp +++ b/main.cpp @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) dlg.AddClientTab(); - for(int client_idx = 0; client_idx < clients.size(); client_idx++) + for(std::size_t client_idx = 0; client_idx < clients.size(); client_idx++) { dlg.AddClient(clients[client_idx]); } diff --git a/qt/OpenRGBClientInfoPage.cpp b/qt/OpenRGBClientInfoPage.cpp index e84defc6..b7de4ac6 100644 --- a/qt/OpenRGBClientInfoPage.cpp +++ b/qt/OpenRGBClientInfoPage.cpp @@ -18,8 +18,8 @@ public: OpenRGBClientInfoPage::OpenRGBClientInfoPage(std::vector& control, QWidget *parent) : QFrame(parent), - controllers(control), - ui(new Ui::OpenRGBClientInfoPageUi) + ui(new Ui::OpenRGBClientInfoPageUi), + controllers(control) { /*-----------------------------------------------------*\ | Set initial values for GUI fields | @@ -80,7 +80,7 @@ void OpenRGBClientInfoPage::UpdateInfo() /*-----------------------------------------------------*\ | Loop through all clients in list and display them | \*-----------------------------------------------------*/ - for(int client_idx = 0; client_idx < rgb_clients.size(); client_idx++) + for(std::size_t client_idx = 0; client_idx < rgb_clients.size(); client_idx++) { /*-----------------------------------------------------*\ | Create the top level tree widget items and display the| @@ -106,7 +106,7 @@ void OpenRGBClientInfoPage::UpdateInfo() /*-----------------------------------------------------*\ | Add child items for each device in the client | \*-----------------------------------------------------*/ - for(int dev_idx = 0; dev_idx < rgb_clients[client_idx]->server_controllers.size(); dev_idx++) + for(std::size_t dev_idx = 0; dev_idx < rgb_clients[client_idx]->server_controllers.size(); dev_idx++) { /*-----------------------------------------------------*\ | Create child tree widget items and display the device | @@ -118,7 +118,7 @@ void OpenRGBClientInfoPage::UpdateInfo() /*-----------------------------------------------------*\ | Add child items for each zone in the device | \*-----------------------------------------------------*/ - for(int zone_idx = 0; zone_idx < rgb_clients[client_idx]->server_controllers[dev_idx]->zones.size(); zone_idx++) + for(std::size_t zone_idx = 0; zone_idx < rgb_clients[client_idx]->server_controllers[dev_idx]->zones.size(); zone_idx++) { /*-----------------------------------------------------*\ | Create child tree widget items and display the zone | diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index 98b7e226..44d52d86 100644 --- a/qt/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage.cpp @@ -205,6 +205,11 @@ void Ui::OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int /*index*/) void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index) { + if(index < 0) + { + return; + } + /*-----------------------------------------------------*\ | Read selected mode | \*-----------------------------------------------------*/ @@ -214,11 +219,11 @@ void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index) { case MODE_COLORS_PER_LED: { - int selected_zone = ui->ZoneBox->currentIndex(); - bool multiple = index == device->leds.size() + 1; + int selected_zone = ui->ZoneBox->currentIndex(); + bool multiple = (std::size_t(index) == (device->leds.size() + 1)); - RGBColor color = 0x00000000; - bool updateColor = 0; + RGBColor color = 0x00000000; + bool updateColor = 0; if(device->zones.size() > 1) { diff --git a/qt/OpenRGBSystemInfoPage.cpp b/qt/OpenRGBSystemInfoPage.cpp index b05a8f86..b7c9b233 100644 --- a/qt/OpenRGBSystemInfoPage.cpp +++ b/qt/OpenRGBSystemInfoPage.cpp @@ -50,7 +50,7 @@ void Ui::OpenRGBSystemInfoPage::on_DetectButton_clicked() current_index = 0; } - if(busses.size() > current_index) + if((int)(busses.size()) > current_index) { i2c_smbus_interface* bus = busses[current_index]; @@ -80,7 +80,7 @@ void Ui::OpenRGBSystemInfoPage::on_DumpButton_clicked() current_index = 0; } - if(busses.size() > current_index) + if((int)(busses.size()) > current_index) { i2c_smbus_interface* bus = busses[current_index]; unsigned char address = ui->DumpAddressBox->value(); @@ -98,7 +98,7 @@ void Ui::OpenRGBSystemInfoPage::on_ReadButton_clicked() current_index = 0; } - if(busses.size() > current_index) + if((int)(busses.size()) > current_index) { i2c_smbus_interface* bus = busses[current_index]; unsigned char address = ui->ReadAddressBox->value();