[FL-2520] FW build with -Wextra (#1185)
* Fixing compiler warnings with -Wextra * More warnings suppression, WIP * Even more warning fixes * Added new lines at end of text files. * Padding fix * Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline * Fixes for Secplus v1 * -additional warnings * +-Wredundant-decls fixes * FuriHal: print stack overflow task name in console * FuriHal: add missing include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -12,7 +12,9 @@ static void infrared_common_decoder_reset_state(InfraredCommonDecoder* decoder);
|
||||
static inline size_t consume_samples(uint32_t* array, size_t len, size_t shift) {
|
||||
furi_assert(len >= shift);
|
||||
len -= shift;
|
||||
for(int i = 0; i < len; ++i) array[i] = array[i + shift];
|
||||
for(size_t i = 0; i < len; ++i) {
|
||||
array[i] = array[i + shift];
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -83,8 +85,8 @@ static InfraredStatus infrared_common_decode_bits(InfraredCommonDecoder* decoder
|
||||
if(timings->min_split_time && !level) {
|
||||
if(timing > timings->min_split_time) {
|
||||
/* long low timing - check if we're ready for any of protocol modification */
|
||||
for(int i = 0; decoder->protocol->databit_len[i] &&
|
||||
(i < COUNT_OF(decoder->protocol->databit_len));
|
||||
for(size_t i = 0; decoder->protocol->databit_len[i] &&
|
||||
(i < COUNT_OF(decoder->protocol->databit_len));
|
||||
++i) {
|
||||
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
|
||||
return InfraredStatusReady;
|
||||
@@ -153,8 +155,8 @@ InfraredStatus
|
||||
InfraredStatus
|
||||
infrared_common_decode_manchester(InfraredCommonDecoder* decoder, bool level, uint32_t timing) {
|
||||
furi_assert(decoder);
|
||||
uint16_t bit = decoder->protocol->timings.bit1_mark;
|
||||
uint16_t tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
uint32_t bit = decoder->protocol->timings.bit1_mark;
|
||||
uint32_t tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
|
||||
bool* switch_detect = &decoder->switch_detect;
|
||||
furi_assert((*switch_detect == true) || (*switch_detect == false));
|
||||
@@ -196,7 +198,7 @@ InfraredMessage* infrared_common_decoder_check_ready(InfraredCommonDecoder* deco
|
||||
InfraredMessage* message = NULL;
|
||||
bool found_length = false;
|
||||
|
||||
for(int i = 0;
|
||||
for(size_t i = 0;
|
||||
decoder->protocol->databit_len[i] && (i < COUNT_OF(decoder->protocol->databit_len));
|
||||
++i) {
|
||||
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
|
||||
@@ -280,7 +282,7 @@ void* infrared_common_decoder_alloc(const InfraredCommonProtocolSpec* protocol)
|
||||
furi_assert(protocol);
|
||||
|
||||
/* protocol->databit_len[0] has to contain biggest value of bits that can be decoded */
|
||||
for(int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
|
||||
for(size_t i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
|
||||
furi_assert(protocol->databit_len[i] <= protocol->databit_len[0]);
|
||||
}
|
||||
|
||||
|
@@ -146,7 +146,7 @@ void* infrared_common_encoder_alloc(const InfraredCommonProtocolSpec* protocol)
|
||||
}
|
||||
|
||||
/* protocol->databit_len[0] has to contain biggest value of bits that can be decoded */
|
||||
for(int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
|
||||
for(size_t i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
|
||||
furi_assert(protocol->databit_len[i] <= protocol->databit_len[0]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void infrared_common_encoder_reset(InfraredCommonEncoder* encoder) {
|
||||
|
||||
uint8_t max_databit_len = 0;
|
||||
|
||||
for(int i = 0; i < COUNT_OF(encoder->protocol->databit_len); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(encoder->protocol->databit_len); ++i) {
|
||||
max_databit_len = MAX(max_databit_len, encoder->protocol->databit_len[i]);
|
||||
}
|
||||
|
||||
|
@@ -123,7 +123,7 @@ const InfraredMessage*
|
||||
InfraredMessage* message = NULL;
|
||||
InfraredMessage* result = NULL;
|
||||
|
||||
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
if(infrared_encoder_decoder[i].decoder.decode) {
|
||||
message = infrared_encoder_decoder[i].decoder.decode(handler->ctx[i], level, duration);
|
||||
if(!result && message) {
|
||||
@@ -139,7 +139,7 @@ InfraredDecoderHandler* infrared_alloc_decoder(void) {
|
||||
InfraredDecoderHandler* handler = malloc(sizeof(InfraredDecoderHandler));
|
||||
handler->ctx = malloc(sizeof(void*) * COUNT_OF(infrared_encoder_decoder));
|
||||
|
||||
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
handler->ctx[i] = 0;
|
||||
if(infrared_encoder_decoder[i].decoder.alloc)
|
||||
handler->ctx[i] = infrared_encoder_decoder[i].decoder.alloc();
|
||||
@@ -153,7 +153,7 @@ void infrared_free_decoder(InfraredDecoderHandler* handler) {
|
||||
furi_assert(handler);
|
||||
furi_assert(handler->ctx);
|
||||
|
||||
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
if(infrared_encoder_decoder[i].decoder.free)
|
||||
infrared_encoder_decoder[i].decoder.free(handler->ctx[i]);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void infrared_free_decoder(InfraredDecoderHandler* handler) {
|
||||
}
|
||||
|
||||
void infrared_reset_decoder(InfraredDecoderHandler* handler) {
|
||||
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
if(infrared_encoder_decoder[i].decoder.reset)
|
||||
infrared_encoder_decoder[i].decoder.reset(handler->ctx[i]);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ const InfraredMessage* infrared_check_decoder_ready(InfraredDecoderHandler* hand
|
||||
InfraredMessage* message = NULL;
|
||||
InfraredMessage* result = NULL;
|
||||
|
||||
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
if(infrared_encoder_decoder[i].decoder.check_ready) {
|
||||
message = infrared_encoder_decoder[i].decoder.check_ready(handler->ctx[i]);
|
||||
if(!result && message) {
|
||||
@@ -209,7 +209,7 @@ void infrared_free_encoder(InfraredEncoderHandler* handler) {
|
||||
}
|
||||
|
||||
static int infrared_find_index_by_protocol(InfraredProtocol protocol) {
|
||||
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
|
||||
if(infrared_encoder_decoder[i].get_protocol_spec(protocol)) {
|
||||
return i;
|
||||
}
|
||||
|
@@ -20,7 +20,9 @@ bool infrared_decoder_nec_interpret(InfraredCommonDecoder* decoder) {
|
||||
uint8_t address_inverse = decoder->data[1];
|
||||
uint8_t command = decoder->data[2];
|
||||
uint8_t command_inverse = decoder->data[3];
|
||||
if((command == (uint8_t)~command_inverse) && (address == (uint8_t)~address_inverse)) {
|
||||
uint8_t inverse_command_inverse = (uint8_t)~command_inverse;
|
||||
uint8_t inverse_address_inverse = (uint8_t)~address_inverse;
|
||||
if((command == inverse_command_inverse) && (address == inverse_address_inverse)) {
|
||||
decoder->message.protocol = InfraredProtocolNEC;
|
||||
decoder->message.address = address;
|
||||
decoder->message.command = command;
|
||||
|
@@ -60,8 +60,8 @@ InfraredStatus infrared_decoder_rc6_decode_manchester(
|
||||
uint32_t timing) {
|
||||
// 4th bit lasts 2x times more
|
||||
InfraredStatus status = InfraredStatusError;
|
||||
uint16_t bit = decoder->protocol->timings.bit1_mark;
|
||||
uint16_t tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
uint32_t bit = decoder->protocol->timings.bit1_mark;
|
||||
uint32_t tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
|
||||
bool single_timing = MATCH_TIMING(timing, bit, tolerance);
|
||||
bool double_timing = MATCH_TIMING(timing, 2 * bit, tolerance);
|
||||
|
@@ -17,8 +17,9 @@ bool infrared_decoder_samsung32_interpret(InfraredCommonDecoder* decoder) {
|
||||
uint8_t address2 = decoder->data[1];
|
||||
uint8_t command = decoder->data[2];
|
||||
uint8_t command_inverse = decoder->data[3];
|
||||
uint8_t inverse_command_inverse = (uint8_t)~command_inverse;
|
||||
|
||||
if((address1 == address2) && (command == (uint8_t)~command_inverse)) {
|
||||
if((address1 == address2) && (command == inverse_command_inverse)) {
|
||||
decoder->message.command = command;
|
||||
decoder->message.address = address1;
|
||||
decoder->message.protocol = InfraredProtocolSamsung32;
|
||||
|
@@ -38,7 +38,7 @@ InfraredStatus infrared_encoder_sirc_encode_repeat(
|
||||
bool* level) {
|
||||
furi_assert(encoder);
|
||||
|
||||
furi_assert(encoder->timings_encoded == (1 + 2 + encoder->bits_to_encode * 2 - 1));
|
||||
furi_assert(encoder->timings_encoded == (1u + 2 + encoder->bits_to_encode * 2 - 1));
|
||||
|
||||
furi_assert(encoder->timings_sum < INFRARED_SIRC_REPEAT_PERIOD);
|
||||
*duration = INFRARED_SIRC_REPEAT_PERIOD - encoder->timings_sum;
|
||||
|
Reference in New Issue
Block a user