[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:
@@ -360,7 +360,7 @@ void infrared_text_store_set(Infrared* infrared, uint32_t bank, const char* text
|
||||
}
|
||||
|
||||
void infrared_text_store_clear(Infrared* infrared, uint32_t bank) {
|
||||
memset(infrared->text_store[bank], 0, INFRARED_TEXT_STORE_SIZE);
|
||||
memset(infrared->text_store[bank], 0, INFRARED_TEXT_STORE_SIZE + 1);
|
||||
}
|
||||
|
||||
void infrared_play_notification_message(Infrared* infrared, uint32_t message) {
|
||||
@@ -455,7 +455,7 @@ int32_t infrared_app(void* p) {
|
||||
} else {
|
||||
view_dispatcher_attach_to_gui(
|
||||
infrared->view_dispatcher, infrared->gui, ViewDispatcherTypeFullscreen);
|
||||
if(is_remote_loaded) {
|
||||
if(is_remote_loaded) { //-V547
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneRemote);
|
||||
} else {
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneStart);
|
||||
|
@@ -65,7 +65,7 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
|
||||
while(flipper_format_read_string(ff, "name", signal_name)) {
|
||||
InfraredBruteForceRecord* record =
|
||||
InfraredBruteForceRecordDict_get(brute_force->records, signal_name);
|
||||
if(record) {
|
||||
if(record) { //-V547
|
||||
++(record->count);
|
||||
}
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ static void signal_received_callback(void* context, InfraredWorkerSignal* receiv
|
||||
size_t timings_cnt;
|
||||
infrared_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
|
||||
|
||||
buf_cnt = snprintf(buf, sizeof(buf), "RAW, %d samples:\r\n", timings_cnt);
|
||||
buf_cnt = snprintf(buf, sizeof(buf), "RAW, %zu samples:\r\n", timings_cnt);
|
||||
cli_write(cli, (uint8_t*)buf, buf_cnt);
|
||||
for(size_t i = 0; i < timings_cnt; ++i) {
|
||||
buf_cnt = snprintf(buf, sizeof(buf), "%lu ", timings[i]);
|
||||
@@ -276,7 +276,9 @@ static bool infrared_cli_decode_file(FlipperFormat* input_file, FlipperFormat* o
|
||||
}
|
||||
InfraredRawSignal* raw_signal = infrared_signal_get_raw_signal(signal);
|
||||
printf(
|
||||
"Raw signal: %s, %u samples\r\n", furi_string_get_cstr(tmp), raw_signal->timings_size);
|
||||
"Raw signal: %s, %zu samples\r\n",
|
||||
furi_string_get_cstr(tmp),
|
||||
raw_signal->timings_size);
|
||||
if(!infrared_cli_decode_raw_signal(
|
||||
raw_signal, decoder, output_file, furi_string_get_cstr(tmp)))
|
||||
break;
|
||||
@@ -382,7 +384,7 @@ static void infrared_cli_list_remote_signals(FuriString* remote_name) {
|
||||
while(flipper_format_read_string(ff, "name", signal_name)) {
|
||||
furi_string_set_str(key, furi_string_get_cstr(signal_name));
|
||||
int* v = dict_signals_get(signals_dict, key);
|
||||
if(v != NULL) {
|
||||
if(v != NULL) { //-V547
|
||||
(*v)++;
|
||||
max = M_MAX(*v, max);
|
||||
} else {
|
||||
@@ -436,7 +438,7 @@ static void
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Sending %ld signal(s)...\r\n", record_count);
|
||||
printf("Sending %lu signal(s)...\r\n", record_count);
|
||||
printf("Press Ctrl-C to stop.\r\n");
|
||||
|
||||
int records_sent = 0;
|
||||
|
@@ -145,15 +145,14 @@ bool infrared_remote_load(InfraredRemote* remote, FuriString* path) {
|
||||
buf = furi_string_alloc();
|
||||
|
||||
FURI_LOG_I(TAG, "load file: \'%s\'", furi_string_get_cstr(path));
|
||||
bool success = flipper_format_buffered_file_open_existing(ff, furi_string_get_cstr(path));
|
||||
bool success = false;
|
||||
|
||||
if(success) {
|
||||
do {
|
||||
if(!flipper_format_buffered_file_open_existing(ff, furi_string_get_cstr(path))) break;
|
||||
uint32_t version;
|
||||
success = flipper_format_read_header(ff, buf, &version) &&
|
||||
!furi_string_cmp(buf, "IR signals file") && (version == 1);
|
||||
}
|
||||
if(!flipper_format_read_header(ff, buf, &version)) break;
|
||||
if(!furi_string_equal(buf, "IR signals file") || (version != 1)) break;
|
||||
|
||||
if(success) {
|
||||
path_extract_filename(path, buf, true);
|
||||
infrared_remote_clear_buttons(remote);
|
||||
infrared_remote_set_name(remote, furi_string_get_cstr(buf));
|
||||
@@ -169,7 +168,8 @@ bool infrared_remote_load(InfraredRemote* remote, FuriString* path) {
|
||||
infrared_remote_button_free(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
} while(false);
|
||||
|
||||
furi_string_free(buf);
|
||||
flipper_format_free(ff);
|
||||
|
@@ -74,7 +74,7 @@ static bool infrared_signal_is_raw_valid(InfraredRawSignal* raw) {
|
||||
} else if((raw->timings_size <= 0) || (raw->timings_size > MAX_TIMINGS_AMOUNT)) {
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Timings amount is out of range (0 - %X): %X",
|
||||
"Timings amount is out of range (0 - %X): %zX",
|
||||
MAX_TIMINGS_AMOUNT,
|
||||
raw->timings_size);
|
||||
return false;
|
||||
@@ -275,8 +275,8 @@ bool infrared_signal_search_and_read(
|
||||
is_name_found = furi_string_equal(name, tmp);
|
||||
if(is_name_found) break;
|
||||
}
|
||||
if(!is_name_found) break;
|
||||
if(!infrared_signal_read_body(signal, ff)) break;
|
||||
if(!is_name_found) break; //-V547
|
||||
if(!infrared_signal_read_body(signal, ff)) break; //-V779
|
||||
success = true;
|
||||
} while(false);
|
||||
|
||||
|
@@ -26,7 +26,7 @@ bool infrared_scene_debug_on_event(void* context, SceneManagerEvent event) {
|
||||
InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal);
|
||||
infrared_debug_view_set_text(debug_view, "RAW\n%d samples\n", raw->timings_size);
|
||||
|
||||
printf("RAW, %d samples:\r\n", raw->timings_size);
|
||||
printf("RAW, %zu samples:\r\n", raw->timings_size);
|
||||
for(size_t i = 0; i < raw->timings_size; ++i) {
|
||||
printf("%lu ", raw->timings[i]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user