Companion GCC8 warnings removed

This commit is contained in:
Bertrand Songis
2018-08-05 19:33:28 +02:00
parent 8a51682190
commit 2c47883cc2
11 changed files with 26 additions and 26 deletions
@@ -26,7 +26,7 @@
void CustomFunctionData::clear()
{
memset(this, 0, sizeof(CustomFunctionData));
memset(reinterpret_cast<void *>(this), 0, sizeof(CustomFunctionData));
if (!getCurrentFirmware()->getCapability(SafetyChannelCustomFunction)) {
func = FuncTrainer;
}
+9 -9
View File
@@ -306,31 +306,31 @@ void GeneralSettings::convert(RadioDataConversionState & cstate)
// SE and SG are skipped on X7 board
if (IS_TARANIS_X7(cstate.toType)) {
if (IS_TARANIS_X9(cstate.fromType) || IS_HORUS(cstate.fromType)) {
strncpy(switchName[4], switchName[5], sizeof(switchName[0]));
strncpy(switchName[5], switchName[7], sizeof(switchName[0]));
strncpy(switchName[4], switchName[5], sizeof(switchName[4]));
strncpy(switchName[5], switchName[7], sizeof(switchName[5]));
}
}
else if (IS_TARANIS_X7(cstate.fromType)) {
if (IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) {
strncpy(switchName[5], switchName[4], sizeof(switchName[0]));
strncpy(switchName[7], switchName[5], sizeof(switchName[0]));
strncpy(switchName[5], switchName[4], sizeof(switchName[5]));
strncpy(switchName[7], switchName[5], sizeof(switchName[7]));
}
}
// LS and RS sliders are after 2 aux sliders on X12 and X9E
if ((IS_HORUS_X12S(cstate.toType) || IS_TARANIS_X9E(cstate.toType)) && !IS_HORUS_X12S(cstate.fromType) && !IS_TARANIS_X9E(cstate.fromType)) {
strncpy(sliderName[0], sliderName[2], sizeof(sliderName[0]));
strncpy(sliderName[1], sliderName[3], sizeof(sliderName[0]));
strncpy(sliderName[1], sliderName[3], sizeof(sliderName[1]));
}
else if (!IS_TARANIS_X9E(cstate.toType) && !IS_HORUS_X12S(cstate.toType) && (IS_HORUS_X12S(cstate.fromType) || IS_TARANIS_X9E(cstate.fromType))) {
strncpy(sliderName[2], sliderName[0], sizeof(sliderName[0]));
strncpy(sliderName[3], sliderName[1], sizeof(sliderName[0]));
strncpy(sliderName[2], sliderName[0], sizeof(sliderName[2]));
strncpy(sliderName[3], sliderName[1], sizeof(sliderName[3]));
}
if (IS_HORUS(cstate.toType)) {
// 6P switch is only on Horus (by default)
if (cstate.fromBoard.getCapability(Board::FactoryInstalledPots) == 2) {
strncpy(potName[2], potName[1], sizeof(potName[0]));
strncpy(potName[2], potName[1], sizeof(potName[2]));
potName[1][0] = '\0';
}
}
@@ -338,7 +338,7 @@ void GeneralSettings::convert(RadioDataConversionState & cstate)
if (IS_TARANIS(cstate.toType)) {
// No S3 pot on Taranis boards by default
if (cstate.fromBoard.getCapability(Board::FactoryInstalledPots) > 2)
strncpy(potName[1], potName[2], sizeof(potName[0]));
strncpy(potName[1], potName[2], sizeof(potName[1]));
contrast = qBound<int>(getCurrentFirmware()->getCapability(MinContrast), contrast, getCurrentFirmware()->getCapability(MaxContrast));
}
+2 -2
View File
@@ -48,7 +48,7 @@ class TrainerMix {
RawSwitch swtch;
int weight;
unsigned int mode; // off, add-mode, subst-mode
void clear() { memset(this, 0, sizeof(TrainerMix)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TrainerMix)); }
};
class TrainerData {
@@ -56,7 +56,7 @@ class TrainerData {
TrainerData() { clear(); }
int calib[4];
TrainerMix mix[4];
void clear() { memset(this, 0, sizeof(TrainerData)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TrainerData)); }
};
class GeneralSettings {
+2 -2
View File
@@ -80,7 +80,7 @@ QString LimitData::offsetToString() const
void LimitData::clear()
{
memset(this, 0, sizeof(LimitData));
memset(reinterpret_cast<void *>(this), 0, sizeof(LimitData));
min = -1000;
max = +1000;
}
@@ -123,7 +123,7 @@ QString CurveData::nameToString(const int idx) const
void FlightModeData::clear(const int phase)
{
memset(this, 0, sizeof(FlightModeData));
memset(reinterpret_cast<void *>(this), 0, sizeof(FlightModeData));
if (phase != 0) {
for (int idx=0; idx<CPN_MAX_GVARS; idx++) {
gvars[idx] = 1025;
+3 -3
View File
@@ -53,7 +53,7 @@ class ExpoData {
CurveReference curve;
int carryTrim;
char name[10+1];
void clear() { memset(this, 0, sizeof(ExpoData)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(ExpoData)); }
void convert(RadioDataConversionState & cstate);
};
@@ -89,7 +89,7 @@ class MixData {
int sOffset;
char name[MIXDATA_NAME_LEN+1];
void clear() { memset(this, 0, sizeof(MixData)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(MixData)); }
};
class LimitData {
@@ -173,7 +173,7 @@ class SwashRingData {
RawSource aileronSource;
RawSource elevatorSource;
unsigned int value;
void clear() { memset(this, 0, sizeof(SwashRingData)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(SwashRingData)); }
};
#endif // IO_DATA_H
+2 -2
View File
@@ -83,7 +83,7 @@ ModelData::ModelData(const ModelData & src)
ModelData & ModelData::operator = (const ModelData & src)
{
memcpy(this, &src, sizeof(ModelData));
memcpy(reinterpret_cast<void *>(this), &src, sizeof(ModelData));
return *this;
}
@@ -184,7 +184,7 @@ void ModelData::clearMixes()
void ModelData::clear()
{
memset(this, 0, sizeof(ModelData));
memset(reinterpret_cast<void *>(this), 0, sizeof(ModelData));
modelIndex = -1; // an invalid index, this is managed by the TreeView data model
moduleData[0].channelsCount = 8;
moduleData[1].channelsStart = 0;
+2 -2
View File
@@ -74,7 +74,7 @@ class TimerData {
unsigned int val;
unsigned int persistent;
int pvalue;
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
void convert(RadioDataConversionState & cstate);
};
@@ -86,7 +86,7 @@ class ScriptData {
char filename[10+1];
char name[10+1];
int inputs[CPN_MAX_SCRIPT_INPUTS];
void clear() { memset(this, 0, sizeof(ScriptData)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(ScriptData)); }
};
/*
+1 -1
View File
@@ -47,7 +47,7 @@ RawSourceRange FrSkyChannelData::getRange() const
void FrSkyScreenData::clear()
{
memset(this, 0, sizeof(FrSkyScreenData));
memset(reinterpret_cast<void *>(this), 0, sizeof(FrSkyScreenData));
if (!IS_ARM(getCurrentBoard())) {
type = TELEMETRY_SCREEN_NUMBERS;
}
+1 -1
View File
@@ -64,7 +64,7 @@ class FrSkyChannelData {
float getRatio() const;
RawSourceRange getRange() const;
void clear() { memset(this, 0, sizeof(FrSkyChannelData)); }
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(FrSkyChannelData)); }
static QString unitString(int units)
{
+2 -2
View File
@@ -155,7 +155,7 @@ bool MixesPanel::gm_insertMix(int idx)
int i = model->mixData[idx].destCh;
memmove(&model->mixData[idx+1], &model->mixData[idx],
(firmware->getCapability(Mixes)-(idx+1)) * sizeof(MixData) );
memset(&model->mixData[idx], 0, sizeof(MixData));
memset(reinterpret_cast<void *>(&model->mixData[idx]), 0, sizeof(MixData));
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
model->mixData[idx].destCh = i;
model->mixData[idx].weight = 100;
@@ -166,7 +166,7 @@ void MixesPanel::gm_deleteMix(int index)
{
memmove(&model->mixData[index], &model->mixData[index+1],
(firmware->getCapability(Mixes)-(index+1)) * sizeof(MixData));
memset(&model->mixData[firmware->getCapability(Mixes)-1], 0, sizeof(MixData));
memset(reinterpret_cast<void *>(&model->mixData[firmware->getCapability(Mixes)-1]), 0, sizeof(MixData));
}
void MixesPanel::gm_openMix(int index)
+1 -1
View File
@@ -498,7 +498,7 @@ void TelemetryCustomScreen::updateBar(int line)
void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
{
if (!lock) {
memset(&screen.body, 0, sizeof(screen.body));
memset(reinterpret_cast<void *>(&screen.body), 0, sizeof(screen.body));
update();
emit modified();
}