Skip to content

Commit

Permalink
chore(cpn): remove compiler warnings (#5719)
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower authored Dec 19, 2024
1 parent 12e84b5 commit d1423af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions companion/src/firmwares/boardjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ const QString BoardJson::getTrimYamlName(int index, YamlLookupType ylt) const

const bool BoardJson::isInputAvailable(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputAvailable(m_inputs->at(index)) : false;
return (index >=0 && index < (int)m_inputs->size()) ? isInputAvailable(m_inputs->at(index)) : false;
}

// static
Expand All @@ -641,7 +641,7 @@ bool BoardJson::isInputAvailable(const InputDefn & defn)

const bool BoardJson::isInputCalibrated(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputCalibrated(m_inputs->at(index)) : false;
return (index >=0 && index < (int)m_inputs->size()) ? isInputCalibrated(m_inputs->at(index)) : false;
}

// static
Expand All @@ -652,7 +652,7 @@ bool BoardJson::isInputCalibrated(const InputDefn & defn)

const bool BoardJson::isInputConfigurable(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputConfigurable(m_inputs->at(index)) : false;
return (index >=0 && index < (int)m_inputs->size()) ? isInputConfigurable(m_inputs->at(index)) : false;
}

// static
Expand All @@ -663,7 +663,7 @@ bool BoardJson::isInputConfigurable(const InputDefn & defn)

const bool BoardJson::isInputIgnored(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputIgnored(m_inputs->at(index)) : true;
return (index >=0 && index < (int)m_inputs->size()) ? isInputIgnored(m_inputs->at(index)) : true;
}

// static
Expand Down Expand Up @@ -698,7 +698,7 @@ bool BoardJson::isInputFlexJoystickAxis(const InputDefn & defn)

const bool BoardJson::isInputFlexPot(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputFlexPot(m_inputs->at(index)) : false;
return (index >=0 && index < (int)m_inputs->size()) ? isInputFlexPot(m_inputs->at(index)) : false;
}

// static
Expand Down Expand Up @@ -741,7 +741,7 @@ bool BoardJson::isInputRTCBat(const InputDefn & defn)

const bool BoardJson::isInputStick(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputStick(m_inputs->at(index)) : false;
return (index >=0 && index < (int)m_inputs->size()) ? isInputStick(m_inputs->at(index)) : false;
}

// static
Expand All @@ -752,7 +752,7 @@ bool BoardJson::isInputStick(const InputDefn & defn)

const bool BoardJson::isInputSwitch(int index) const
{
return (index >=0 && index < m_inputs->size()) ? isInputSwitch(m_inputs->at(index)) : false;
return (index >=0 && index < (int)m_inputs->size()) ? isInputSwitch(m_inputs->at(index)) : false;
}

// static
Expand Down Expand Up @@ -792,7 +792,7 @@ bool BoardJson::isSwitchStd(const SwitchDefn & defn)

const bool BoardJson::isSwitchFlex(int index) const
{
return (index >=0 && index < m_switches->size()) ? isSwitchFlex(m_switches->at(index)) : false;
return (index >=0 && index < (int)m_switches->size()) ? isSwitchFlex(m_switches->at(index)) : false;
}

// static
Expand All @@ -806,7 +806,7 @@ bool BoardJson::isSwitchFlex(const SwitchDefn & defn)

const bool BoardJson::isSwitchFunc(int index) const
{
return (index >=0 && index < m_switches->size()) ? isSwitchFunc(m_switches->at(index)) : false;
return (index >=0 && index < (int)m_switches->size()) ? isSwitchFunc(m_switches->at(index)) : false;
}

// static
Expand Down
6 changes: 3 additions & 3 deletions companion/src/firmwares/modeldata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ AbstractStaticItemModel * ModelData::funcSwitchGroupStartSwitchModel(int switchc
mdl->setName(AIM_MODELDATA_FUNCSWITCHGROUPSTARTSWITCH);

mdl->appendToItemList(tr("Restore"), 0);
for (unsigned int i = 1; i <= switchcnt; i += 1) {
for (int i = 1; i <= switchcnt; i += 1) {
mdl->appendToItemList(tr("SW") + QString::number(i), i);
}
mdl->appendToItemList(tr("Off"), switchcnt + 1);
Expand Down Expand Up @@ -1857,7 +1857,7 @@ void ModelData::setFuncGroupSwitchStart(unsigned int group, unsigned int value,
if (getFuncSwitchGroup(i) == group)
setFuncSwitchStart(i, value ? ModelData::FUNC_SWITCH_START_OFF : ModelData::FUNC_SWITCH_START_PREVIOUS);
}
if (value > 0 && value <= switchcnt) {
if (value > 0 && value <= (unsigned int)switchcnt) {
setFuncSwitchStart(value - 1, ModelData::FUNC_SWITCH_START_ON);
}
}
Expand All @@ -1873,7 +1873,7 @@ void ModelData::setGroupSwitchState(uint8_t group, int switchcnt)
setFuncSwitchConfig(j, FUNC_SWITCH_CONFIG_2POS); // Toggle not valid
}
}
if (getFuncGroupSwitchStart(group, switchcnt) == switchcnt + 1) {
if (getFuncGroupSwitchStart(group, switchcnt) == (unsigned int)switchcnt + 1) {
// Start state for all switches is off - set all to 'last'
for (int j = 0; j < switchcnt; j += 1)
if (getFuncSwitchGroup(j) == group)
Expand Down

0 comments on commit d1423af

Please sign in to comment.