chore(cpn): stop compiler warnings (#6523)

This commit is contained in:
Neil Horne
2025-08-17 20:17:47 +10:00
committed by GitHub
parent d6b765f677
commit a9a0edefe8
3 changed files with 18 additions and 4 deletions
+12 -1
View File
@@ -436,7 +436,7 @@ void GeneralSettings::convert(RadioDataConversionState & cstate)
// Try to intelligently copy any custom controls
// step 1 clear current config
memset(&inputConfig[0], 0, sizeof(InputConfig) * CPN_MAX_INPUTS);
memset(&switchConfig[0], 0, sizeof(SwitchConfig) * CPN_MAX_SWITCHES);
switchConfigClear();
// step 2 load default config
setDefaultControlTypes(cstate.toType);
// step 3 copy matching config based on tags
@@ -1006,3 +1006,14 @@ AbstractStaticItemModel * GeneralSettings::templateSetupItemModel()
mdl->loadItemList();
return mdl;
}
GeneralSettings::SwitchConfig::SwitchConfig()
{
memset((void*)this, 0, sizeof(SwitchConfig));
}
void GeneralSettings::switchConfigClear()
{
for (int i = 0; i < CPN_MAX_SWITCHES; i++)
switchConfig[i] = SwitchConfig();
}
@@ -379,9 +379,12 @@ class GeneralSettings {
unsigned int offColorLuaOverride;
RGBLedColor onColor;
RGBLedColor offColor;
SwitchConfig();
};
SwitchConfig switchConfig[CPN_MAX_SWITCHES];
void switchConfigClear();
bool switchPositionAllowed(int index) const;
bool switchSourceAllowed(int index) const;
+3 -3
View File
@@ -1814,7 +1814,7 @@ AbstractStaticItemModel * ModelData::funcSwitchGroupsModel()
mdl->setName(AIM_MODELDATA_FUNCSWITCHGROUPS);
mdl->appendToItemList(tr("---"), 0);
for (unsigned int i = 1; i <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups); i += 1) {
for (int i = 1; i <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups); i++) {
mdl->appendToItemList(tr("Group ") + QString::number(i), i);
}
@@ -1838,7 +1838,7 @@ void ModelData::setFuncSwitchGroup(unsigned int index, unsigned int value)
unsigned int ModelData::getFuncSwitchAlwaysOnGroup(unsigned int group) const
{
if (group > 0 && group <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups)) {
if (group > 0 && group <= (unsigned int)Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups)) {
return cfsGroupOn[group];
}
else
@@ -1855,7 +1855,7 @@ unsigned int ModelData::getFuncSwitchAlwaysOnGroupForSwitch(unsigned int index)
void ModelData::setFuncSwitchAlwaysOnGroup(unsigned int group, unsigned int value)
{
if (group > 0 && group <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups)) {
if (group > 0 && group <= (unsigned int)Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups)) {
cfsGroupOn[group] = value;
}
}