Using std::min from algorithm-header

This commit is contained in:
Gerhard Hoffmann 2023-04-18 14:43:30 +02:00
parent c99d0730ce
commit 01140c523b

View File

@ -1,4 +1,6 @@
#include <stdint.h>
#include <algorithm>
#include <QString>
#include <QDebug>
#include "storeINdata.h"
@ -1030,9 +1032,7 @@ void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data) {
}
void gpi_storeEmpSettings(uint8_t leng, uint8_t const *data) {
if (leng > 64) {
leng = 64;
}
leng = std::min(leng, (uint8_t)(64));
memset(&SharedMemBuffer::getData()->Sdata.emp_settingsBuff[0], 0x00,
sizeof(SharedMemBuffer::getData()->Sdata.emp_settingsBuff));
SharedMemBuffer::getData()->Sdata.empNrOfsettings = leng;
@ -1095,9 +1095,7 @@ void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal,
}
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t const *data) { // getestet am 12.4.23TS
if (leng > 64) {
leng = 64;
}
leng = std::min(leng, (uint8_t)(64));
SharedMemBuffer::getData()->Sdata.NrOfDeviceSetting = leng;
memset((char *)&SharedMemBuffer::getData()->Sdata.DeviceSettingBuff[0],
0x00, sizeof(SharedMemBuffer::getData()->Sdata.DeviceSettingBuff));
@ -1113,9 +1111,7 @@ void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data) { // getestet am
}
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t const *data) {
if (leng > 64) {
leng = 64;
}
leng = std::min(leng, (uint8_t)(64));
SharedMemBuffer::getData()->Sdata.NrOfMachineIDSetting = leng;
memset((char *)&SharedMemBuffer::getData()->Sdata.NrOfMachineIDBuff[0],
0x00, sizeof(SharedMemBuffer::getData()->Sdata.NrOfMachineIDBuff));
@ -1188,9 +1184,7 @@ uint64_t epi_getWakeSources(void) {
}
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data) {
if (leng > 64) {
leng = 64;
}
leng = std::min(leng, (uint8_t)(64));
SharedMemBuffer::getData()->store.rbDevParamLen = leng;
memset((char *)(&SharedMemBuffer::getData()->store.rbDevParams[0]), 0x00,
sizeof(SharedMemBuffer::getData()->store.rbDevParams));
@ -1207,9 +1201,7 @@ void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data) {
// store device conditions
void gpi_storeDeviceConditions(uint8_t leng, uint8_t const *data) {
if (leng > 64) {
leng = 64;
}
leng = std::min(leng, (uint8_t)(64));
SharedMemBuffer::getData()->store.deviceCondLen = leng;
memset((char *)(&SharedMemBuffer::getData()->store.deviceCond[0]), 0x00,
sizeof(SharedMemBuffer::getData()->store.deviceCond));