Fixed some warnings

This commit is contained in:
Cooper Hall 2023-03-11 23:25:26 +00:00 committed by Adam Honse
parent b0b20b9f06
commit 45be4329c5
10 changed files with 29 additions and 31 deletions

View file

@ -76,7 +76,7 @@ std::string PolychromeUSBController::GetSerialString()
{ {
return(""); return("");
} }
std::wstring return_wstring = serial_string; std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end()); std::string return_string(return_wstring.begin(), return_wstring.end());
@ -213,13 +213,13 @@ void PolychromeUSBController::WriteZone
unsigned char zone, unsigned char zone,
unsigned char mode, unsigned char mode,
unsigned char speed, unsigned char speed,
RGBColor rgb, RGBColor rgb,
bool allzone = false bool allzone = false
) )
{ {
/*----------------------------------------------------*\ /*----------------------------------------------------*\
| Get the device info so we can look up the zone type. | | Get the device info so we can look up the zone type. |
\*----------------------------------------------------*/ \*----------------------------------------------------*/
PolychromeDeviceInfo device_info = GetPolychromeDevices()[zone]; PolychromeDeviceInfo device_info = GetPolychromeDevices()[zone];
@ -234,7 +234,7 @@ void PolychromeUSBController::WriteZone
| Set up message packet with leading 00 | | Set up message packet with leading 00 |
\*-----------------------------------------------------*/ \*-----------------------------------------------------*/
usb_buf[0x01] = POLYCHROME_USB_SET_ZONE; usb_buf[0x01] = POLYCHROME_USB_SET_ZONE;
usb_buf[0x03] = device_info.zone_type; usb_buf[0x03] = device_info.zone_type;
usb_buf[0x04] = mode; usb_buf[0x04] = mode;
if(device_info.rgswap) if(device_info.rgswap)
@ -262,7 +262,7 @@ void PolychromeUSBController::WriteZone
void PolychromeUSBController::WriteAllZones void PolychromeUSBController::WriteAllZones
( (
const std::vector<PolychromeZoneInfo>& zones_info, const std::vector<PolychromeZoneInfo>& /*zones_info*/,
const std::vector<zone>& zones const std::vector<zone>& zones
) )
{ {
@ -434,7 +434,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
| Set up config table request packet | | Set up config table request packet |
\*-----------------------------------------------------*/ \*-----------------------------------------------------*/
usb_buf[0x01] = POLYCHROME_USB_READ_ZONE_CONFIG; usb_buf[0x01] = POLYCHROME_USB_READ_ZONE_CONFIG;
usb_buf[0x03] = device_info.zone_type; usb_buf[0x03] = device_info.zone_type;
/*-----------------------------------------------------*\ /*-----------------------------------------------------*\
| Send packet | | Send packet |
@ -446,7 +446,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
\*-----------------------------------------------------*/ \*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf)); memset(usb_buf, 0x00, sizeof(usb_buf));
hid_read(dev, usb_buf, 64); hid_read(dev, usb_buf, 64);
r = usb_buf[0x05]; r = usb_buf[0x05];
g = usb_buf[0x06]; g = usb_buf[0x06];
b = usb_buf[0x07]; b = usb_buf[0x07];

View file

@ -205,7 +205,7 @@ void RGBController_AuraMouse::DeviceUpdateLEDs()
} }
} }
void RGBController_AuraMouse::UpdateZoneLEDs(int zone) void RGBController_AuraMouse::UpdateZoneLEDs(int /*zone*/)
{ {
DeviceUpdateLEDs(); DeviceUpdateLEDs();
} }

View file

@ -429,7 +429,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs()
{ {
std::vector<led_color> led_color_list = {}; std::vector<led_color> led_color_list = {};
for(int i = 0; i < colors.size(); i++) for(size_t i = 0; i < colors.size(); i++)
{ {
led_color_list.push_back({ leds[i].value, colors[i] }); led_color_list.push_back({ leds[i].value, colors[i] });
} }

View file

@ -54,7 +54,6 @@ void HyperXQuadcastSController::SaveColors(std::vector<RGBColor> colors, unsigne
unsigned int num_color_packets = 0; unsigned int num_color_packets = 0;
unsigned int frame = 0; unsigned int frame = 0;
unsigned char color[HYPERX_QUADCAST_S_PACKET_SIZE] = {0}; unsigned char color[HYPERX_QUADCAST_S_PACKET_SIZE] = {0};
unsigned char empty[HYPERX_QUADCAST_S_PACKET_SIZE] = {0};
num_color_packets = num_frames/8; num_color_packets = num_frames/8;
if(num_frames % 8) if(num_frames % 8)
@ -137,7 +136,6 @@ void HyperXQuadcastSController::SendDirect(std::vector<RGBColor> colors)
return; return;
} }
int res;
RGBColor c1 = colors[0]; RGBColor c1 = colors[0];
RGBColor c2 = colors[1]; RGBColor c2 = colors[1];
uint8_t buffer[HYPERX_QUADCAST_S_PACKET_SIZE]; uint8_t buffer[HYPERX_QUADCAST_S_PACKET_SIZE];
@ -158,7 +156,7 @@ void HyperXQuadcastSController::SendDirect(std::vector<RGBColor> colors)
lock.lock(); lock.lock();
res = wrapper.hid_send_feature_report(dev, buffer, HYPERX_QUADCAST_S_PACKET_SIZE); wrapper.hid_send_feature_report(dev, buffer, HYPERX_QUADCAST_S_PACKET_SIZE);
std::this_thread::sleep_for(15ms); std::this_thread::sleep_for(15ms);
SendToRegister(0xF2, 0, 1); SendToRegister(0xF2, 0, 1);

View file

@ -73,7 +73,7 @@ void IonicoController::SetColors(int device, std::vector<RGBColor> array_colors,
{ {
uint8_t usb_buf[IONICO_REPORT_SIZE]; uint8_t usb_buf[IONICO_REPORT_SIZE];
memset(usb_buf, 0x00, IONICO_REPORT_SIZE); memset(usb_buf, 0x00, IONICO_REPORT_SIZE);
for(int i = 0; i < array_colors.size(); i++) for(size_t i = 0; i < array_colors.size(); i++)
{ {
usb_buf[1] = IONICO_DIRECT_CMD; usb_buf[1] = IONICO_DIRECT_CMD;
usb_buf[3] = i+1; usb_buf[3] = i+1;
@ -96,7 +96,7 @@ void IonicoController::SetColors(int device, std::vector<RGBColor> array_colors,
uint8_t usb_buf_led[IONICO_DIRECT_REPORT_SIZE]; uint8_t usb_buf_led[IONICO_DIRECT_REPORT_SIZE];
memset(usb_buf_led, 0x00, IONICO_DIRECT_REPORT_SIZE); memset(usb_buf_led, 0x00, IONICO_DIRECT_REPORT_SIZE);
for(int i = 0; i < array_colors.size(); i++) for(size_t i = 0; i < array_colors.size(); i++)
{ {
usb_buf_led[1 + 3 * i] = RGBGetRValue(array_colors[i]); usb_buf_led[1 + 3 * i] = RGBGetRValue(array_colors[i]);
usb_buf_led[2 + 3 * i] = RGBGetBValue(array_colors[i]); usb_buf_led[2 + 3 * i] = RGBGetBValue(array_colors[i]);

View file

@ -143,7 +143,7 @@ void RGBController_Ionico::SetupZones()
zone_keyboard.leds_count = leds.size(); zone_keyboard.leds_count = leds.size();
zone_keyboard.matrix_map = nullptr; zone_keyboard.matrix_map = nullptr;
zones.emplace_back(zone_keyboard); zones.emplace_back(zone_keyboard);
for(int i = 0; i < leds.size(); ++i) for(size_t i = 0; i < leds.size(); ++i)
{ {
leds[i].name = "Keyboard Zone " + std::to_string(i+1); leds[i].name = "Keyboard Zone " + std::to_string(i+1);
} }
@ -159,7 +159,7 @@ void RGBController_Ionico::SetupZones()
zone_bar.leds_count = leds.size(); zone_bar.leds_count = leds.size();
zone_bar.matrix_map = nullptr; zone_bar.matrix_map = nullptr;
zones.emplace_back(zone_bar); zones.emplace_back(zone_bar);
for(int i = 0; i < leds.size(); ++i) for(size_t i = 0; i < leds.size(); ++i)
{ {
leds[i].name = "Bar Led " + std::to_string(i+1); leds[i].name = "Bar Led " + std::to_string(i+1);
} }
@ -187,12 +187,12 @@ void RGBController_Ionico::DeviceSaveMode()
controller->SaveBios(); controller->SaveBios();
} }
void RGBController_Ionico::UpdateZoneLEDs(int zone) void RGBController_Ionico::UpdateZoneLEDs(int /*zone*/)
{ {
DeviceUpdateLEDs(); DeviceUpdateLEDs();
} }
void RGBController_Ionico::UpdateSingleLED(int led) void RGBController_Ionico::UpdateSingleLED(int /*led*/)
{ {
// //
} }

View file

@ -741,7 +741,7 @@ void RGBController_MountainKeyboard::DeviceUpdate(const mode& current_mode)
unsigned char color_data[MOUNTAIN_KEYBOARD_TRANSFER_BUFFER_SIZE] = {0}; unsigned char color_data[MOUNTAIN_KEYBOARD_TRANSFER_BUFFER_SIZE] = {0};
unsigned char color_edge_data[MOUNTAIN_KEYBOARD_TRANSFER_EDGE_BUFFER_SIZE] = {0}; unsigned char color_edge_data[MOUNTAIN_KEYBOARD_TRANSFER_EDGE_BUFFER_SIZE] = {0};
for(int led_idx = 0; led_idx < colors.size(); led_idx++) for(unsigned int led_idx = 0; led_idx < colors.size(); led_idx++)
{ {
if(led_idx < zones[0].leds_count) if(led_idx < zones[0].leds_count)
{ {

View file

@ -119,7 +119,7 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio
for(int zone_index = 0; zone_index < num_zones; zone_index++) for(int zone_index = 0; zone_index < num_zones; zone_index++)
{ {
zone_name_len[zone_index] = strlen(zones[zone_index].name.c_str()) + 1; zone_name_len[zone_index] = strlen(zones[zone_index].name.c_str()) + 1;
data_size += zone_name_len[zone_index] + sizeof(zone_name_len[zone_index]); data_size += zone_name_len[zone_index] + sizeof(zone_name_len[zone_index]);
data_size += sizeof(zones[zone_index].type); data_size += sizeof(zones[zone_index].type);
data_size += sizeof(zones[zone_index].leds_min); data_size += sizeof(zones[zone_index].leds_min);
@ -145,7 +145,7 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
data_size += sizeof(unsigned short); data_size += sizeof(unsigned short);
for(int segment_index = 0; segment_index < zones[zone_index].segments.size(); segment_index++) for(size_t segment_index = 0; segment_index < zones[zone_index].segments.size(); segment_index++)
{ {
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Length of segment name string | | Length of segment name string |
@ -224,7 +224,7 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio
strcpy((char *)&data_buf[data_ptr], description.c_str()); strcpy((char *)&data_buf[data_ptr], description.c_str());
data_ptr += description_len; data_ptr += description_len;
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Copy in version (size+data) | | Copy in version (size+data) |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
@ -469,7 +469,7 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio
| Length of segment name string | | Length of segment name string |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
unsigned short segment_name_length = strlen(zones[zone_index].segments[segment_index].name.c_str()) + 1; unsigned short segment_name_length = strlen(zones[zone_index].segments[segment_index].name.c_str()) + 1;
memcpy(&data_buf[data_ptr], &segment_name_length, sizeof(segment_name_length)); memcpy(&data_buf[data_ptr], &segment_name_length, sizeof(segment_name_length));
data_ptr += sizeof(segment_name_length); data_ptr += sizeof(segment_name_length);
@ -610,7 +610,7 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int
version = (char *)&data_buf[data_ptr]; version = (char *)&data_buf[data_ptr];
data_ptr += version_len; data_ptr += version_len;
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Copy in serial | | Copy in serial |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
@ -857,7 +857,7 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int
{ {
new_zone.matrix_map = NULL; new_zone.matrix_map = NULL;
} }
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Copy in segments | | Copy in segments |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
@ -1099,7 +1099,7 @@ unsigned char * RGBController::GetModeDescription(int mode, unsigned int protoco
memcpy(&data_buf[data_ptr], &modes[mode].brightness, sizeof(modes[mode].brightness)); memcpy(&data_buf[data_ptr], &modes[mode].brightness, sizeof(modes[mode].brightness));
data_ptr += sizeof(modes[mode].brightness); data_ptr += sizeof(modes[mode].brightness);
} }
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Copy in mode direction (data) | | Copy in mode direction (data) |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
@ -1156,7 +1156,7 @@ void RGBController::SetModeDescription(unsigned char* data_buf, unsigned int pro
| Get pointer to target mode | | Get pointer to target mode |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
mode * new_mode = &modes[mode_idx]; mode * new_mode = &modes[mode_idx];
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Set active mode to the new mode | | Set active mode to the new mode |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
@ -1208,7 +1208,7 @@ void RGBController::SetModeDescription(unsigned char* data_buf, unsigned int pro
memcpy(&new_mode->brightness_max, &data_buf[data_ptr], sizeof(new_mode->brightness_max)); memcpy(&new_mode->brightness_max, &data_buf[data_ptr], sizeof(new_mode->brightness_max));
data_ptr += sizeof(new_mode->brightness_max); data_ptr += sizeof(new_mode->brightness_max);
} }
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Copy in mode colors_min (data) | | Copy in mode colors_min (data) |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
@ -1235,7 +1235,7 @@ void RGBController::SetModeDescription(unsigned char* data_buf, unsigned int pro
memcpy(&new_mode->brightness, &data_buf[data_ptr], sizeof(new_mode->brightness)); memcpy(&new_mode->brightness, &data_buf[data_ptr], sizeof(new_mode->brightness));
data_ptr += sizeof(new_mode->brightness); data_ptr += sizeof(new_mode->brightness);
} }
/*---------------------------------------------------------*\ /*---------------------------------------------------------*\
| Copy in mode direction (data) | | Copy in mode direction (data) |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/

View file

@ -1264,7 +1264,7 @@ void ResourceManager::DetectDevicesThreadFunction()
| Load the libhidapi-libusb library | | Load the libhidapi-libusb library |
\*-------------------------------------------------*/ \*-------------------------------------------------*/
#ifdef __GLIBC__ #ifdef __GLIBC__
if(dyn_handle = dlopen("libhidapi-libusb.so", RTLD_NOW | RTLD_NODELETE | RTLD_DEEPBIND)) if((dyn_handle = dlopen("libhidapi-libusb.so", RTLD_NOW | RTLD_NODELETE | RTLD_DEEPBIND)))
#else #else
if(dyn_handle = dlopen("libhidapi-libusb.so", RTLD_NOW | RTLD_NODELETE )) if(dyn_handle = dlopen("libhidapi-libusb.so", RTLD_NOW | RTLD_NODELETE ))
#endif #endif

View file

@ -1046,7 +1046,7 @@ void ApplyOptions(DeviceOptions& options, std::vector<RGBController *>& rgb_cont
| supports that colour mode then swich to it before | | supports that colour mode then swich to it before |
| evaluating if a colour needs to be set | | evaluating if a colour needs to be set |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
if((options.brightness >= 0) && (device->modes[mode].flags & MODE_FLAG_HAS_BRIGHTNESS)) if((device->modes[mode].flags & MODE_FLAG_HAS_BRIGHTNESS))
{ {
unsigned int new_brightness = device->modes[mode].brightness_max - device->modes[mode].brightness_min; unsigned int new_brightness = device->modes[mode].brightness_max - device->modes[mode].brightness_min;
new_brightness *= options.brightness; new_brightness *= options.brightness;