Skip to content

Commit c76864d

Browse files
Warning fixes and cleanups
1 parent e388950 commit c76864d

6 files changed

Lines changed: 54 additions & 47 deletions

File tree

Controllers/LenovoControllers/LenovoLegionK510Controller/RGBController_LenovoK510.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void RGBController_LenovoK510::ReadAndUpdateCurrentDeviceState()
318318
current_active_mode.direction = current_active_mode.direction ? MODE_DIRECTION_UP : MODE_DIRECTION_DOWN;
319319
}
320320

321-
active_mode = i;
321+
active_mode = (int)i;
322322
break;
323323
}
324324
}

Controllers/LenovoControllers/LenovoUSBController_Gen7_8/RGBController_Lenovo_Gen7_8.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@ LenovoRGBController_Gen7_8::LenovoRGBController_Gen7_8(LenovoGen7And8USBControll
286286

287287
SetupZones();
288288

289-
/*-----------------*\
290-
| Initiliaze Static |
291-
\*-----------------*/
289+
/*-----------------------------------------------------*\
290+
| Initiliaze Static |
291+
\*-----------------------------------------------------*/
292292
active_mode = 0;
293293
for(size_t i = 0; i < modes.size(); i++)
294294
{
295295
if(modes[i].value == LENOVO_LEGION_GEN7_8_MODE_STATIC)
296296
{
297-
active_mode = i;
297+
active_mode = (int)i;
298298
break;
299299
}
300300
}
@@ -307,7 +307,6 @@ LenovoRGBController_Gen7_8::~LenovoRGBController_Gen7_8()
307307
delete controller;
308308
}
309309

310-
311310
void LenovoRGBController_Gen7_8::SetupZones()
312311
{
313312
vector<lenovo_zone> lenovo_zones;
@@ -363,9 +362,9 @@ void LenovoRGBController_Gen7_8::SetupZones()
363362
new_led.value = lenovo_zones[i].id << 8 | lenovo_zones[i].leds[led_idx].led_num ;
364363
leds.push_back(new_led);
365364

366-
/*---------------------------------------------------------*\
367-
| create led id to index map for fast look up |
368-
\*---------------------------------------------------------*/
365+
/*---------------------------------------------*\
366+
| create led id to index map for fast look up |
367+
\*---------------------------------------------*/
369368
led_id_to_index[new_led.value]=leds.size() - 1;
370369
}
371370
}
@@ -449,9 +448,10 @@ void LenovoRGBController_Gen7_8::DeviceUpdateLEDs()
449448
{
450449
if(controller->getPid() == LEGION_7GEN10)
451450
{
452-
/*---------------------------------------------------------*\
453-
| Gen10 may ignore A1 updates unless D0 is reasserted. |
454-
\*---------------------------------------------------------*/
451+
/*---------------------------------------------*\
452+
| Gen10 may ignore A1 updates unless D0 is |
453+
| reasserted. |
454+
\*---------------------------------------------*/
455455
controller->setLedsDirectOn(profile_id);
456456
direct_enabled = true;
457457
}
@@ -585,9 +585,9 @@ std::vector<led_group> LenovoRGBController_Gen7_8::GetLedGroups()
585585
size_t start = 0;
586586
size_t end = leds.size();
587587

588-
/*---------------------------------------------------------*\
589-
| Riplle and Type only apply to keyboard |
590-
\*---------------------------------------------------------*/
588+
/*-------------------------------------------------*\
589+
| Riplle and Type only apply to keyboard |
590+
\*-------------------------------------------------*/
591591
if(modes[active_mode].value == LENOVO_LEGION_GEN7_8_MODE_RIPPLE ||
592592
modes[active_mode].value == LENOVO_LEGION_GEN7_8_MODE_TYPE)
593593
{

Controllers/LianLiController/LianLiUniHubSLController/RGBController_LianLiUniHubSL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ void RGBController_LianLiUniHubSL::SetupZones()
321321
new_led.name = zones[zone_idx].name;
322322
new_led.name.append(", Fan ");
323323
new_led.name.append(std::to_string(led_idx + 1));
324-
new_led.value = zone_idx;
324+
new_led.value = (unsigned int)zone_idx;
325325

326326
leds.push_back(new_led);
327327
}

Controllers/MountainKeyboardController/RGBController_Mountain60Keyboard.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
using namespace std::chrono_literals;
1717

18-
/*-------------------------------*\
19-
| TODO: Detect detached keypad |
20-
\*-------------------------------*/
18+
/*---------------------------------------------------------*\
19+
| TODO: Detect detached keypad |
20+
\*---------------------------------------------------------*/
2121

2222
std::vector<unsigned int> mountain60_keyboard_key_id_values =
2323
{
@@ -37,9 +37,9 @@ layout_values mountain60_layout =
3737
{
3838
mountain60_keyboard_key_id_values,
3939
{
40-
/*------------------------------------------*\
41-
| No regional layout fix for the moment |
42-
\*------------------------------------------*/
40+
/*---------------------------------------------*\
41+
| No regional layout fix for the moment |
42+
\*---------------------------------------------*/
4343
},
4444
};
4545

@@ -348,9 +348,9 @@ RGBController_Mountain60Keyboard::~RGBController_Mountain60Keyboard()
348348
mountain_thread->join();
349349
delete mountain_thread;
350350

351-
/*---------------------------------------------------------*\
352-
| Delete the matrix map |
353-
\*---------------------------------------------------------*/
351+
/*-----------------------------------------------------*\
352+
| Delete the matrix map |
353+
\*-----------------------------------------------------*/
354354
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
355355
{
356356
if(zones[zone_index].type == ZONE_TYPE_MATRIX)
@@ -406,10 +406,10 @@ void RGBController_Mountain60Keyboard::DeviceUpdateLEDs()
406406
{
407407
unsigned char* color_data = new unsigned char[(leds.size()*4)];
408408

409-
/*---------------------------------------------------------*\
410-
| Filling the color_data vector with progressive index |
411-
| leaving space for RGB data |
412-
\*---------------------------------------------------------*/
409+
/*-----------------------------------------------------*\
410+
| Filling the color_data vector with progressive index |
411+
| leaving space for RGB data |
412+
\*-----------------------------------------------------*/
413413
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
414414
{
415415
const unsigned int idx = led_idx * 4;
@@ -419,7 +419,7 @@ void RGBController_Mountain60Keyboard::DeviceUpdateLEDs()
419419
color_data[idx + 3] = RGBGetBValue(colors[led_idx]);
420420
}
421421

422-
controller->SendDirect(modes[active_mode].brightness, color_data, (leds.size()*4));
422+
controller->SendDirect(modes[active_mode].brightness, color_data, ((unsigned int)leds.size() * 4));
423423
delete[] color_data;
424424
}
425425

SPDAccessor/SPDAccessor.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121

2222
using namespace std::chrono_literals;
2323

24-
25-
// Sources for define values:
26-
// - https://en.wikipedia.org/wiki/Serial_presence_detect
27-
// - JEDEC DDR5 Serial Presence Detect (SPD): Table of contents
28-
24+
/*---------------------------------------------------------*\
25+
| Sources for define values: |
26+
| - https://en.wikipedia.org/wiki/Serial_presence_detect |
27+
| - JEDEC DDR5 Serial Presence Detect (SPD): Table of |
28+
| contents |
29+
\*---------------------------------------------------------*/
2930
#define BASIC_MEMORY_TYPE_ADDR (0x02)
3031

3132
#define DDR4_JEDEC_ID_ADDR (0x140)
@@ -121,17 +122,21 @@ std::string SPDAccessor::read_part_nr_at(uint16_t address, std::size_t len)
121122
part_number += (char)this->at(spd_addr);
122123
}
123124

124-
// Find the true end of string & truncate it to that point.
125-
// Part number should be padded with 0x20 (space) for DDR4 (Source: Wikipedia)
126-
// It may be padded with 0x00 (Source: real-life tests on DDR5 memory)
127-
// Note: To prevent infinite loop, end_of_string_idx MUST be signed.
128-
int end_of_string_idx = part_number.length()-1;
125+
/*-----------------------------------------------------*\
126+
| Find the true end of string and truncate it to that |
127+
| point. Part number should be padded with 0x20 |
128+
| (space) for DDR4 (Source: Wikipedia). |
129+
| It may be padded with 0x00 (Source: real-life tests |
130+
| on DDR5 memory). |
131+
| Note: To prevent infinite loop, end_of_string_idx |
132+
| MUST be signed. |
133+
\*-----------------------------------------------------*/
134+
std::size_t end_of_string_idx = part_number.length() - 1;
135+
129136
for(; end_of_string_idx >= 0; end_of_string_idx--)
130137
{
131-
if(
132-
part_number[end_of_string_idx] != '\0' &&
133-
part_number[end_of_string_idx] != ' '
134-
)
138+
if((part_number[end_of_string_idx] != '\0')
139+
&& (part_number[end_of_string_idx] != ' '))
135140
{
136141
break;
137142
}

startup/startup.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ int startup(int argc, char* argv[], unsigned int ret_flags)
6262
LOG_TRACE("[main] initializing GUI");
6363

6464
/*-------------------------------------------------*\
65-
| Enable high DPI scaling support |
65+
| Enable high DPI scaling support (Qt5 only) |
6666
\*-------------------------------------------------*/
67-
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
68-
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
67+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
68+
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
69+
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
70+
#endif
6971

7072
/*-------------------------------------------------*\
7173
| Enable high DPI fractional scaling support on |

0 commit comments

Comments
 (0)