mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Fix warnings in Windows build
This commit is contained in:
@@ -76,9 +76,9 @@ void ArcticController::SetChannels(std::vector<RGBColor> colors)
|
||||
{
|
||||
const unsigned int offset = ARCTIC_COMMAND_PAYLOAD_OFFSET + channel * 3;
|
||||
|
||||
buffer[offset + 0x00] = std::min<unsigned int>(254, RGBGetRValue(colors[channel]));
|
||||
buffer[offset + 0x01] = std::min<unsigned int>(254, RGBGetGValue(colors[channel]));
|
||||
buffer[offset + 0x02] = std::min<unsigned int>(254, RGBGetBValue(colors[channel]));
|
||||
buffer[offset + 0x00] = (char)std::min<unsigned int>(254, RGBGetRValue(colors[channel]));
|
||||
buffer[offset + 0x01] = (char)std::min<unsigned int>(254, RGBGetGValue(colors[channel]));
|
||||
buffer[offset + 0x02] = (char)std::min<unsigned int>(254, RGBGetBValue(colors[channel]));
|
||||
}
|
||||
|
||||
serialport.serial_write(buffer, sizeof(buffer));
|
||||
|
||||
@@ -93,9 +93,9 @@ void BlinkyTapeController::SetLEDs(std::vector<RGBColor> colors)
|
||||
{
|
||||
const unsigned int color_offset = color_idx * 3;
|
||||
|
||||
serial_buf[0x00 + color_offset] = std::min((unsigned int)254, RGBGetRValue(colors[color_idx]));
|
||||
serial_buf[0x01 + color_offset] = std::min((unsigned int)254, RGBGetGValue(colors[color_idx]));
|
||||
serial_buf[0x02 + color_offset] = std::min((unsigned int)254, RGBGetBValue(colors[color_idx]));
|
||||
serial_buf[0x00 + color_offset] = (unsigned char)std::min((unsigned int)254, RGBGetRValue(colors[color_idx]));
|
||||
serial_buf[0x01 + color_offset] = (unsigned char)std::min((unsigned int)254, RGBGetGValue(colors[color_idx]));
|
||||
serial_buf[0x02 + color_offset] = (unsigned char)std::min((unsigned int)254, RGBGetBValue(colors[color_idx]));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
|
||||
@@ -177,7 +177,7 @@ void GoveeController::SetColor(unsigned char red, unsigned char green, unsigned
|
||||
\*-----------------------------------------------------*/
|
||||
std::string command_str = command.dump();
|
||||
|
||||
port.udp_write((char *)command_str.c_str(), command_str.length() + 1);
|
||||
port.udp_write((char *)command_str.c_str(), (int)command_str.length() + 1);
|
||||
}
|
||||
|
||||
void GoveeController::SendRazerData(RGBColor* colors, unsigned int size)
|
||||
@@ -206,7 +206,7 @@ void GoveeController::SendRazerData(RGBColor* colors, unsigned int size)
|
||||
\*-----------------------------------------------------*/
|
||||
std::string command_str = command.dump();
|
||||
|
||||
port.udp_write((char *)command_str.c_str(), command_str.length() + 1);
|
||||
port.udp_write((char *)command_str.c_str(), (int)command_str.length() + 1);
|
||||
}
|
||||
|
||||
void GoveeController::SendRazerDisable()
|
||||
@@ -222,7 +222,7 @@ void GoveeController::SendRazerDisable()
|
||||
\*-----------------------------------------------------*/
|
||||
std::string command_str = command.dump();
|
||||
|
||||
port.udp_write((char *)command_str.c_str(), command_str.length() + 1);
|
||||
port.udp_write((char *)command_str.c_str(), (int)command_str.length() + 1);
|
||||
}
|
||||
|
||||
void GoveeController::SendRazerEnable()
|
||||
@@ -238,7 +238,7 @@ void GoveeController::SendRazerEnable()
|
||||
\*-----------------------------------------------------*/
|
||||
std::string command_str = command.dump();
|
||||
|
||||
port.udp_write((char *)command_str.c_str(), command_str.length() + 1);
|
||||
port.udp_write((char *)command_str.c_str(), (int)command_str.length() + 1);
|
||||
}
|
||||
|
||||
void GoveeController::SendScan()
|
||||
@@ -253,7 +253,7 @@ void GoveeController::SendScan()
|
||||
\*-----------------------------------------------------*/
|
||||
std::string command_str = command.dump();
|
||||
|
||||
broadcast_port.udp_write((char *)command_str.c_str(), command_str.length() + 1);
|
||||
broadcast_port.udp_write((char *)command_str.c_str(), (int)command_str.length() + 1);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
||||
@@ -99,7 +99,7 @@ void RGBController_Govee::DeviceUpdateLEDs()
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
|
||||
{
|
||||
controller->SendRazerData(&colors[0], colors.size());
|
||||
controller->SendRazerData(&colors[0], (unsigned int)colors.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +133,13 @@ void HyperXAlloyOriginsCoreController::SetLEDsDirect(std::vector<RGBColor> color
|
||||
| transfer the colors to the buffer. Max 94 colors to avoid buffer overflow. |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
if(colors.size() > 94)
|
||||
{
|
||||
total_colors = 94;
|
||||
}
|
||||
else
|
||||
total_colors = colors.size();
|
||||
{
|
||||
total_colors = (unsigned int)colors.size();
|
||||
}
|
||||
|
||||
for(unsigned int color_idx = 0; color_idx < total_colors; color_idx++)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ void LIFXController::SetColors(std::vector<RGBColor> colors)
|
||||
continue;
|
||||
}
|
||||
|
||||
SetZoneColor(colors[i], i);
|
||||
SetZoneColor(colors[i], (unsigned int)i);
|
||||
cached_colors[i] = colors[i];
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ void LIFXController::FetchZoneCount()
|
||||
GetColorZonesPacketSetStartIndex(0);
|
||||
GetColorZonesPacketSetEndIndex(0);
|
||||
|
||||
port.udp_write((char*)data, data_buf_size);
|
||||
port.udp_write((char*)data, (int)data_buf_size);
|
||||
delete[] data;
|
||||
|
||||
/*----------------------------*\
|
||||
@@ -139,7 +139,7 @@ void LIFXController::FetchZoneCount()
|
||||
memset(data, 0, data_buf_size);
|
||||
|
||||
port.set_receive_timeout(5, 0);
|
||||
port.udp_listen((char*)data, data_buf_size);
|
||||
port.udp_listen((char*)data, (int)data_buf_size);
|
||||
|
||||
/*-----------------*\
|
||||
| Validate response |
|
||||
@@ -170,7 +170,7 @@ void LIFXController::SetColor(RGBColor color)
|
||||
SetColorPacketSetHSBK(&hsbk);
|
||||
SetColorPacketSetDuration(0);
|
||||
|
||||
port.udp_write((char*)data, data_buf_size);
|
||||
port.udp_write((char*)data, (int)data_buf_size);
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ void LIFXController::SetZoneColor(RGBColor color, unsigned int zone)
|
||||
SetColorZonesPacketSetDuration(0);
|
||||
SetColorZonesPacketSetApply(LIFX_MULTIZONE_APPLICATION_REQUEST_APPLY);
|
||||
|
||||
port.udp_write((char*)data, data_buf_size);
|
||||
port.udp_write((char*)data, (int)data_buf_size);
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ void LIFXController::SetZoneColors(std::vector<RGBColor> colors)
|
||||
SetExtendedColorZonesPacketSetZoneIndex(0);
|
||||
SetExtendedColorZonesPacketSetColors(colors);
|
||||
|
||||
port.udp_write((char*)data, data_buf_size);
|
||||
port.udp_write((char*)data, (int)data_buf_size);
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void LIFXController::HeaderPacketSetDefaults(unsigned short packet_type)
|
||||
/*-----*\
|
||||
| Frame |
|
||||
\*-----*/
|
||||
HeaderPacketSetSize(data_buf_size);
|
||||
HeaderPacketSetSize((unsigned short)data_buf_size);
|
||||
HeaderPacketSetProtocol();
|
||||
HeaderPacketSetAddressable(true);
|
||||
HeaderPacketSetTagged(false);
|
||||
@@ -457,7 +457,7 @@ void LIFXController::SetExtendedColorZonesPacketSetZoneIndex(unsigned short zone
|
||||
|
||||
void LIFXController::SetExtendedColorZonesPacketSetColors(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char colors_count = colors.size();
|
||||
unsigned char colors_count = (unsigned char)colors.size();
|
||||
memcpy(&data[LIFX_SET_EXTENDED_COLOR_ZONES_PACKET_OFFSET_COLORS_COUNT], &colors_count, sizeof(unsigned char));
|
||||
|
||||
for(size_t i = 0; i < colors.size(); i++)
|
||||
|
||||
@@ -284,9 +284,9 @@ void MSIMysticLight761Controller::SetLedColor
|
||||
|
||||
if((candidate_index + 2) <= GetMaxDirectLeds(zone))
|
||||
{
|
||||
set_data_color(ptr, candidate_index, red);
|
||||
set_data_color(ptr, candidate_index + 1, grn);
|
||||
set_data_color(ptr, candidate_index + 2, blu);
|
||||
set_data_color(ptr, (int)candidate_index, red);
|
||||
set_data_color(ptr, (int)candidate_index + 1, grn);
|
||||
set_data_color(ptr, (int)candidate_index + 2, blu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio
|
||||
for(std::size_t led_idx = 0; led_idx < led_alt_names.size(); led_idx++)
|
||||
{
|
||||
data_size += sizeof(unsigned short);
|
||||
data_size += strlen(led_alt_names[led_idx].c_str()) + 1;
|
||||
data_size += (unsigned int)strlen(led_alt_names[led_idx].c_str()) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@ unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_versio
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in LED alternate name (size+data) |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned short string_length = strlen(led_alt_names[led_idx].c_str()) + 1;
|
||||
unsigned short string_length = (unsigned short)strlen(led_alt_names[led_idx].c_str()) + 1;
|
||||
|
||||
memcpy(&data_buf[data_ptr], &string_length, sizeof(string_length));
|
||||
data_ptr += sizeof(string_length);
|
||||
@@ -1773,7 +1773,7 @@ unsigned char * RGBController::GetSegmentDescription(int zone, segment new_segme
|
||||
/*---------------------------------------------------------*\
|
||||
| Segment name string data |
|
||||
\*---------------------------------------------------------*/
|
||||
data_size += strlen(new_segment.name.c_str()) + 1;
|
||||
data_size += (unsigned int)strlen(new_segment.name.c_str()) + 1;
|
||||
|
||||
data_size += sizeof(new_segment.type);
|
||||
data_size += sizeof(new_segment.start_idx);
|
||||
@@ -1799,7 +1799,7 @@ unsigned char * RGBController::GetSegmentDescription(int zone, segment new_segme
|
||||
/*---------------------------------------------------------*\
|
||||
| Length of segment name string |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned short segment_name_length = strlen(new_segment.name.c_str()) + 1;
|
||||
unsigned short segment_name_length = (unsigned short)strlen(new_segment.name.c_str()) + 1;
|
||||
|
||||
memcpy(&data_buf[data_ptr], &segment_name_length, sizeof(segment_name_length));
|
||||
data_ptr += sizeof(segment_name_length);
|
||||
@@ -1904,7 +1904,7 @@ void RGBController::SetupColors()
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
total_led_count += GetLEDsInZone(zone_idx);
|
||||
total_led_count += GetLEDsInZone((unsigned int)zone_idx);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
@@ -1920,7 +1920,7 @@ void RGBController::SetupColors()
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
zones[zone_idx].start_idx = total_led_count;
|
||||
zone_led_count = GetLEDsInZone(zone_idx);
|
||||
zone_led_count = GetLEDsInZone((unsigned int)zone_idx);
|
||||
|
||||
if((colors.size() > 0) && (zone_led_count > 0))
|
||||
{
|
||||
|
||||
@@ -228,7 +228,7 @@ static const std::map<std::string, led_label> led_label_lookup =
|
||||
{ KEY_ES_OPEN_QUESTION_MARK,{ "¿" , "¡" }},
|
||||
{ KEY_ES_TILDE, { "´" , "¨" }},
|
||||
{ KEY_ES_ENIE, { "ñ" , "Ñ" }},
|
||||
{ KEY_BR_TILDE, { "~" , "~" }}
|
||||
{ KEY_BR_TILDE, { "~" , "~" }}
|
||||
};
|
||||
|
||||
void DeviceView::setController(RGBController * controller_ptr)
|
||||
@@ -306,7 +306,7 @@ void DeviceView::InitDeviceView()
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int count = controller->GetLEDsInZone(zone_idx);
|
||||
unsigned int count = controller->GetLEDsInZone((unsigned int)zone_idx);
|
||||
zone_pos[zone_idx].matrix_w = std::min(count, (unsigned int)MAX_COLS);
|
||||
totalHeight += (count / MAX_COLS) + ((count % MAX_COLS) > 0);
|
||||
}
|
||||
@@ -474,7 +474,7 @@ void DeviceView::InitDeviceView()
|
||||
/*-----------------------------------------------------*\
|
||||
| Calculate LED box positions for single/linear zones |
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned int leds_count = controller->GetLEDsInZone(zone_idx);
|
||||
unsigned int leds_count = controller->GetLEDsInZone((unsigned int)zone_idx);
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < leds_count; led_idx++)
|
||||
{
|
||||
@@ -499,7 +499,7 @@ void DeviceView::InitDeviceView()
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < controller->leds.size(); led_idx++)
|
||||
{
|
||||
std::map<std::string, led_label>::const_iterator it = led_label_lookup.find(controller->GetLEDName(led_idx));
|
||||
std::map<std::string, led_label>::const_iterator it = led_label_lookup.find(controller->GetLEDName((unsigned int)led_idx));
|
||||
|
||||
if(it != led_label_lookup.end())
|
||||
{
|
||||
@@ -838,7 +838,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */)
|
||||
{
|
||||
painter.setPen(palette().windowText().color());
|
||||
}
|
||||
painter.drawText(posx, posy + posh, QString(controller->GetZoneName(zone_idx).c_str()));
|
||||
painter.drawText(posx, posy + posh, QString(controller->GetZoneName((unsigned int)zone_idx).c_str()));
|
||||
|
||||
for(std::size_t segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++)
|
||||
{
|
||||
@@ -1049,10 +1049,10 @@ bool DeviceView::selectZone(int zone, bool add)
|
||||
|
||||
for(std::size_t led_idx = 0; led_idx < controller->GetLEDsInZone(zone); led_idx++)
|
||||
{
|
||||
if(!selectionFlags[zoneStart + led_idx])
|
||||
if(!selectionFlags[zoneStart + (int)led_idx])
|
||||
{
|
||||
selectedLeds.push_back(zoneStart + led_idx);
|
||||
selectionFlags[zoneStart + led_idx] = 1;
|
||||
selectedLeds.push_back(zoneStart + (int)led_idx);
|
||||
selectionFlags[zoneStart + (int)led_idx] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
|
||||
|
||||
for(std::size_t i = 0; i < device->modes.size(); i++)
|
||||
{
|
||||
ui->ModeBox->addItem(device->GetModeName(i).c_str());
|
||||
ui->ModeBox->addItem(device->GetModeName((unsigned int)i).c_str());
|
||||
ui->ModeBox->setItemData((int)i, ModeDescription(device->modes[i]), Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ void OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int index)
|
||||
\*-------------------------------------*/
|
||||
for(std::size_t i = 0; i < device->leds.size(); i++)
|
||||
{
|
||||
ui->LEDBox->addItem(device->GetLEDName(i).c_str());
|
||||
ui->LEDBox->addItem(device->GetLEDName((unsigned int)i).c_str());
|
||||
}
|
||||
|
||||
/*-------------------------------------*\
|
||||
@@ -1059,7 +1059,7 @@ void OpenRGBDevicePage::UpdateModeUi()
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < device->zones.size(); zone_idx++)
|
||||
{
|
||||
ui->ZoneBox->addItem(device->GetZoneName(zone_idx).c_str());
|
||||
ui->ZoneBox->addItem(device->GetZoneName((unsigned int)zone_idx).c_str());
|
||||
|
||||
for(std::size_t segment_idx = 0; segment_idx < device->zones[zone_idx].segments.size(); segment_idx++)
|
||||
{
|
||||
|
||||
@@ -46,8 +46,10 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
||||
QDirIterator file(":/i18n/", QDirIterator::Subdirectories);
|
||||
while(file.hasNext())
|
||||
{
|
||||
translator.load(file.next());
|
||||
map.insert(translator.translate("OpenRGBSettingsPage", "English - US"), file.filePath());
|
||||
if(translator.load(file.next()))
|
||||
{
|
||||
map.insert(translator.translate("OpenRGBSettingsPage", "English - US"), file.filePath());
|
||||
}
|
||||
}
|
||||
|
||||
ui->ComboBoxLanguage->blockSignals(true);
|
||||
|
||||
Reference in New Issue
Block a user