[FL-2811] Fix PVS-Studio warnings (#2142)
Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
@@ -107,7 +107,7 @@ static InfraredStatus infrared_common_decode_bits(InfraredCommonDecoder* decoder
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
|
||||
|
||||
/* check if largest protocol version can be decoded */
|
||||
if(level && (decoder->protocol->databit_len[0] == decoder->databit_cnt) &&
|
||||
if(level && (decoder->protocol->databit_len[0] == decoder->databit_cnt) && //-V1051
|
||||
!timings->min_split_time) {
|
||||
status = InfraredStatusReady;
|
||||
break;
|
||||
|
@@ -94,7 +94,6 @@ InfraredStatus
|
||||
case InfraredCommonEncoderStateSilence:
|
||||
*duration = encoder->protocol->timings.silence_time;
|
||||
*level = false;
|
||||
status = InfraredStatusOk;
|
||||
encoder->state = InfraredCommonEncoderStatePreamble;
|
||||
++encoder->timings_encoded;
|
||||
encoder->timings_sum = 0;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include "infrared.h"
|
||||
#include "infrared_i.h"
|
||||
|
||||
#define MATCH_TIMING(x, v, delta) (((x) < (v + delta)) && ((x) > (v - delta)))
|
||||
#define MATCH_TIMING(x, v, delta) (((x) < ((v) + (delta))) && ((x) > ((v) - (delta))))
|
||||
|
||||
typedef struct InfraredCommonDecoder InfraredCommonDecoder;
|
||||
typedef struct InfraredCommonEncoder InfraredCommonEncoder;
|
||||
|
@@ -67,7 +67,7 @@ void infrared_send_raw(const uint32_t timings[], uint32_t timings_cnt, bool star
|
||||
|
||||
FuriHalInfraredTxGetDataState
|
||||
infrared_get_data_callback(void* context, uint32_t* duration, bool* level) {
|
||||
FuriHalInfraredTxGetDataState state = FuriHalInfraredTxGetDataStateLastDone;
|
||||
FuriHalInfraredTxGetDataState state;
|
||||
InfraredEncoderHandler* handler = context;
|
||||
InfraredStatus status = InfraredStatusError;
|
||||
|
||||
@@ -82,9 +82,10 @@ FuriHalInfraredTxGetDataState
|
||||
} else if(status == InfraredStatusOk) {
|
||||
state = FuriHalInfraredTxGetDataStateOk;
|
||||
} else if(status == InfraredStatusDone) {
|
||||
state = FuriHalInfraredTxGetDataStateDone;
|
||||
if(--infrared_tx_number_of_transmissions == 0) {
|
||||
state = FuriHalInfraredTxGetDataStateLastDone;
|
||||
} else {
|
||||
state = FuriHalInfraredTxGetDataStateDone;
|
||||
}
|
||||
} else {
|
||||
furi_crash(NULL);
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <furi.h>
|
||||
#include <float_tools.h>
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
|
||||
@@ -397,8 +398,9 @@ static bool infrared_get_new_signal(InfraredWorker* instance) {
|
||||
}
|
||||
|
||||
instance->tx.tx_raw_cnt = 0;
|
||||
instance->tx.need_reinitialization = (new_tx_frequency != instance->tx.frequency) ||
|
||||
(new_tx_duty_cycle != instance->tx.duty_cycle);
|
||||
instance->tx.need_reinitialization =
|
||||
(new_tx_frequency != instance->tx.frequency) ||
|
||||
!float_is_equal(new_tx_duty_cycle, instance->tx.duty_cycle);
|
||||
instance->tx.frequency = new_tx_frequency;
|
||||
instance->tx.duty_cycle = new_tx_duty_cycle;
|
||||
if(instance->signal.decoded) {
|
||||
|
@@ -7,7 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_TIMINGS_AMOUNT 1024
|
||||
#define MAX_TIMINGS_AMOUNT 1024U
|
||||
|
||||
/** Interface struct of infrared worker */
|
||||
typedef struct InfraredWorker InfraredWorker;
|
||||
|
Reference in New Issue
Block a user