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:
Sergey Gavrilov
2022-10-06 01:15:23 +10:00
committed by GitHub
parent 0f9ea925d3
commit 4bf29827f8
370 changed files with 5597 additions and 3963 deletions

View File

@@ -43,7 +43,7 @@ void subghz_keystore_free(SubGhzKeystore* instance) {
for
M_EACH(manufacture_code, instance->data, SubGhzKeyArray_t) {
string_clear(manufacture_code->name);
furi_string_free(manufacture_code->name);
manufacture_code->key = 0;
}
SubGhzKeyArray_clear(instance->data);
@@ -57,7 +57,7 @@ static void subghz_keystore_add_key(
uint64_t key,
uint16_t type) {
SubGhzKey* manufacture_code = SubGhzKeyArray_push_raw(instance->data);
string_init_set_str(manufacture_code->name, name);
manufacture_code->name = furi_string_alloc_set(name);
manufacture_code->key = key;
manufacture_code->type = type;
}
@@ -191,8 +191,8 @@ bool subghz_keystore_load(SubGhzKeystore* instance, const char* file_name) {
uint32_t version;
SubGhzKeystoreEncryption encryption;
string_t filetype;
string_init(filetype);
FuriString* filetype;
filetype = furi_string_alloc();
FURI_LOG_I(TAG, "Loading keystore %s", file_name);
@@ -213,7 +213,7 @@ bool subghz_keystore_load(SubGhzKeystore* instance, const char* file_name) {
break;
}
if(strcmp(string_get_cstr(filetype), SUBGHZ_KEYSTORE_FILE_TYPE) != 0 ||
if(strcmp(furi_string_get_cstr(filetype), SUBGHZ_KEYSTORE_FILE_TYPE) != 0 ||
version != SUBGHZ_KEYSTORE_FILE_VERSION) {
FURI_LOG_E(TAG, "Type or version mismatch");
break;
@@ -238,7 +238,7 @@ bool subghz_keystore_load(SubGhzKeystore* instance, const char* file_name) {
furi_record_close(RECORD_STORAGE);
string_clear(filetype);
furi_string_free(filetype);
return result;
}
@@ -294,7 +294,7 @@ bool subghz_keystore_save(SubGhzKeystore* instance, const char* file_name, uint8
(uint32_t)(key->key >> 32),
(uint32_t)key->key,
key->type,
string_get_cstr(key->name));
furi_string_get_cstr(key->name));
// Verify length and align
furi_assert(len > 0);
if(len % 16 != 0) {
@@ -349,8 +349,8 @@ bool subghz_keystore_raw_encrypted_save(
uint8_t* iv) {
bool encrypted = false;
uint32_t version;
string_t filetype;
string_init(filetype);
FuriString* filetype;
filetype = furi_string_alloc();
SubGhzKeystoreEncryption encryption;
Storage* storage = furi_record_open(RECORD_STORAGE);
@@ -373,7 +373,7 @@ bool subghz_keystore_raw_encrypted_save(
break;
}
if(strcmp(string_get_cstr(filetype), SUBGHZ_KEYSTORE_FILE_RAW_TYPE) != 0 ||
if(strcmp(furi_string_get_cstr(filetype), SUBGHZ_KEYSTORE_FILE_RAW_TYPE) != 0 ||
version != SUBGHZ_KEYSTORE_FILE_VERSION) {
FURI_LOG_E(TAG, "Type or version mismatch");
break;
@@ -392,7 +392,9 @@ bool subghz_keystore_raw_encrypted_save(
break;
}
if(!flipper_format_write_header_cstr(
output_flipper_format, string_get_cstr(filetype), SUBGHZ_KEYSTORE_FILE_VERSION)) {
output_flipper_format,
furi_string_get_cstr(filetype),
SUBGHZ_KEYSTORE_FILE_VERSION)) {
FURI_LOG_E(TAG, "Unable to add header");
break;
}
@@ -488,8 +490,8 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t*
uint32_t version;
SubGhzKeystoreEncryption encryption;
string_t str_temp;
string_init(str_temp);
FuriString* str_temp;
str_temp = furi_string_alloc();
Storage* storage = furi_record_open(RECORD_STORAGE);
char* decrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_DECRYPTED_LINE_SIZE);
@@ -509,7 +511,7 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t*
break;
}
if(strcmp(string_get_cstr(str_temp), SUBGHZ_KEYSTORE_FILE_RAW_TYPE) != 0 ||
if(strcmp(furi_string_get_cstr(str_temp), SUBGHZ_KEYSTORE_FILE_RAW_TYPE) != 0 ||
version != SUBGHZ_KEYSTORE_FILE_VERSION) {
FURI_LOG_E(TAG, "Type or version mismatch");
break;
@@ -605,7 +607,7 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t*
free(decrypted_line);
string_clear(str_temp);
furi_string_free(str_temp);
return result;
}