M*LIB: non-inlined strings, FuriString primitive (#1795)
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -143,8 +143,8 @@ ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) {
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
ProtocolId result = PROTOCOL_NO;
|
||||
uint8_t* data = malloc(protocol_dict_get_max_data_size(dict));
|
||||
string_t str_result;
|
||||
string_init(str_result);
|
||||
FuriString* str_result;
|
||||
str_result = furi_string_alloc();
|
||||
|
||||
do {
|
||||
if(!flipper_format_file_open_existing(file, filename)) break;
|
||||
@@ -152,16 +152,16 @@ ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) {
|
||||
// header
|
||||
uint32_t version;
|
||||
if(!flipper_format_read_header(file, str_result, &version)) break;
|
||||
if(string_cmp_str(str_result, LFRFID_DICT_FILETYPE) != 0) break;
|
||||
if(furi_string_cmp_str(str_result, LFRFID_DICT_FILETYPE) != 0) break;
|
||||
if(version != 1) break;
|
||||
|
||||
// type
|
||||
if(!flipper_format_read_string(file, "Key type", str_result)) break;
|
||||
ProtocolId protocol;
|
||||
protocol = protocol_dict_get_protocol_by_name(dict, string_get_cstr(str_result));
|
||||
protocol = protocol_dict_get_protocol_by_name(dict, furi_string_get_cstr(str_result));
|
||||
|
||||
if(protocol == PROTOCOL_NO) {
|
||||
protocol = lfrfid_dict_protocol_fallback(dict, string_get_cstr(str_result), file);
|
||||
protocol = lfrfid_dict_protocol_fallback(dict, furi_string_get_cstr(str_result), file);
|
||||
if(protocol == PROTOCOL_NO) break;
|
||||
} else {
|
||||
// data
|
||||
@@ -174,7 +174,7 @@ ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) {
|
||||
} while(false);
|
||||
|
||||
free(data);
|
||||
string_clear(str_result);
|
||||
furi_string_free(str_result);
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
|
Reference in New Issue
Block a user