Keys Dict: fix PVS warnings (#3299)

* keys dict: fix PVS warnings
* nfc app: suppress PVS warning
This commit is contained in:
gornekich 2023-12-19 16:11:35 +04:00 committed by GitHub
parent 25d24f1e4c
commit 6f6074dc01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -343,7 +343,7 @@ bool nfc_load_file(NfcApp* instance, FuriString* path, bool show_dialog) {
nfc_supported_cards_load_cache(instance->nfc_supported_cards); nfc_supported_cards_load_cache(instance->nfc_supported_cards);
FuriString* load_path = furi_string_alloc(); FuriString* load_path = furi_string_alloc();
if(nfc_has_shadow_file_internal(instance, path)) { if(nfc_has_shadow_file_internal(instance, path)) { //-V1051
nfc_set_shadow_file_path(path, load_path); nfc_set_shadow_file_path(path, load_path);
} else if(furi_string_end_with(path, NFC_APP_SHADOW_EXTENSION)) { } else if(furi_string_end_with(path, NFC_APP_SHADOW_EXTENSION)) {
size_t path_len = furi_string_size(path); size_t path_len = furi_string_size(path);

View file

@ -108,7 +108,7 @@ KeysDict* keys_dict_alloc(const char* path, KeysDictMode mode, size_t key_size)
} }
} }
stream_rewind(instance->stream); stream_rewind(instance->stream);
FURI_LOG_I(TAG, "Loaded dictionary with %u keys", instance->total_keys); FURI_LOG_I(TAG, "Loaded dictionary with %zu keys", instance->total_keys);
furi_string_free(line); furi_string_free(line);
@ -299,13 +299,12 @@ bool keys_dict_delete_key(KeysDict* instance, const uint8_t* key, size_t key_siz
furi_assert(key); furi_assert(key);
bool key_removed = false; bool key_removed = false;
bool is_endfile = false;
uint8_t* temp_key = malloc(key_size); uint8_t* temp_key = malloc(key_size);
stream_rewind(instance->stream); stream_rewind(instance->stream);
while(!key_removed && !is_endfile) { while(!key_removed) {
if(!keys_dict_get_next_key(instance, temp_key, key_size)) { if(!keys_dict_get_next_key(instance, temp_key, key_size)) {
break; break;
} }
@ -332,4 +331,4 @@ bool keys_dict_delete_key(KeysDict* instance, const uint8_t* key, size_t key_siz
free(temp_key); free(temp_key);
return key_removed; return key_removed;
} }