Code cleanup: srand, PVS warnings (#1974)
* Remove srand invocation * PVS High priority fixes * PVS High errors part 2 * Furi: heap tracing inheritance * Furi add __builtin_unreachable to furi_thread_catch
This commit is contained in:
@@ -313,7 +313,7 @@ bool flipper_format_stream_write_value_line(Stream* stream, FlipperStreamWriteDa
|
||||
furi_crash("Unknown FF type");
|
||||
}
|
||||
|
||||
if((size_t)(i + 1) < write_data->data_size) {
|
||||
if(((size_t)i + 1) < write_data->data_size) {
|
||||
furi_string_cat(value, " ");
|
||||
}
|
||||
|
||||
|
@@ -85,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(size_t i = 0; decoder->protocol->databit_len[i] &&
|
||||
(i < COUNT_OF(decoder->protocol->databit_len));
|
||||
for(size_t i = 0; i < COUNT_OF(decoder->protocol->databit_len) &&
|
||||
decoder->protocol->databit_len[i];
|
||||
++i) {
|
||||
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
|
||||
return InfraredStatusReady;
|
||||
@@ -199,7 +199,7 @@ InfraredMessage* infrared_common_decoder_check_ready(InfraredCommonDecoder* deco
|
||||
bool found_length = false;
|
||||
|
||||
for(size_t i = 0;
|
||||
decoder->protocol->databit_len[i] && (i < COUNT_OF(decoder->protocol->databit_len));
|
||||
i < COUNT_OF(decoder->protocol->databit_len) && decoder->protocol->databit_len[i];
|
||||
++i) {
|
||||
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
|
||||
found_length = true;
|
||||
|
@@ -140,9 +140,8 @@ size_t lfrfid_worker_dict_get_data_size(LFRFIDWorker* worker, LFRFIDProtocol pro
|
||||
|
||||
static int32_t lfrfid_worker_thread(void* thread_context) {
|
||||
LFRFIDWorker* worker = thread_context;
|
||||
bool running = true;
|
||||
|
||||
while(running) {
|
||||
while(true) {
|
||||
uint32_t flags = furi_thread_flags_wait(LFRFIDEventAll, FuriFlagWaitAny, FuriWaitForever);
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
// stop thread
|
||||
|
@@ -541,7 +541,7 @@ static size_t _etoa(
|
||||
exp2 = (int)(expval * 3.321928094887362 + 0.5);
|
||||
const double z = expval * 2.302585092994046 - exp2 * 0.6931471805599453;
|
||||
const double z2 = z * z;
|
||||
conv.U = (uint64_t)(exp2 + 1023) << 52U;
|
||||
conv.U = ((uint64_t)exp2 + 1023) << 52U;
|
||||
// compute exp(z) using continued fractions, see https://en.wikipedia.org/wiki/Exponential_function#Continued_fractions_for_ex
|
||||
conv.F *= 1 + 2 * z / (2 - z + (z2 / (6 + (z2 / (10 + z2 / 14)))));
|
||||
// correct for rounding errors
|
||||
|
@@ -312,7 +312,6 @@ void subghz_protocol_decoder_power_smart_feed(
|
||||
if((instance->decoder.decode_data & POWER_SMART_PACKET_HEADER_MASK) ==
|
||||
POWER_SMART_PACKET_HEADER) {
|
||||
if(subghz_protocol_power_smart_chek_valid(instance->decoder.decode_data)) {
|
||||
instance->decoder.decode_data = instance->decoder.decode_data;
|
||||
instance->generic.data = instance->decoder.decode_data;
|
||||
instance->generic.data_count_bit =
|
||||
subghz_protocol_power_smart_const.min_count_bit_for_found;
|
||||
|
@@ -464,7 +464,7 @@ bool subghz_keystore_raw_encrypted_save(
|
||||
}
|
||||
stream_write_cstring(output_stream, encrypted_line);
|
||||
|
||||
} while(ret > 0 && result);
|
||||
} while(result);
|
||||
|
||||
flipper_format_free(output_flipper_format);
|
||||
|
||||
|
@@ -5,12 +5,6 @@
|
||||
#include <furi.h>
|
||||
|
||||
void set_random_name(char* name, uint8_t max_name_size) {
|
||||
static bool rand_generator_inited = false;
|
||||
|
||||
if(!rand_generator_inited) {
|
||||
srand(DWT->CYCCNT);
|
||||
rand_generator_inited = true;
|
||||
}
|
||||
const char* prefix[] = {
|
||||
"ancient", "hollow", "strange", "disappeared", "unknown",
|
||||
"unthinkable", "unnamable", "nameless", "my", "concealed",
|
||||
|
Reference in New Issue
Block a user