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

@@ -92,19 +92,19 @@ static void storage_settings_scene_benchmark(StorageSettings* app) {
app->fs_api, bench_size[i], bench_data, &bench_w_speed[i]))
break;
if(i > 0) string_cat_printf(app->text_string, "\n");
string_cat_printf(app->text_string, "%ub : W %luK ", bench_size[i], bench_w_speed[i]);
if(i > 0) furi_string_cat_printf(app->text_string, "\n");
furi_string_cat_printf(app->text_string, "%ub : W %luK ", bench_size[i], bench_w_speed[i]);
dialog_ex_set_header(dialog_ex, NULL, 0, 0, AlignCenter, AlignCenter);
dialog_ex_set_text(
dialog_ex, string_get_cstr(app->text_string), 0, 32, AlignLeft, AlignCenter);
dialog_ex, furi_string_get_cstr(app->text_string), 0, 32, AlignLeft, AlignCenter);
if(!storage_settings_scene_bench_read(
app->fs_api, bench_size[i], bench_data, &bench_r_speed[i]))
break;
string_cat_printf(app->text_string, "R %luK", bench_r_speed[i]);
furi_string_cat_printf(app->text_string, "R %luK", bench_r_speed[i]);
dialog_ex_set_text(
dialog_ex, string_get_cstr(app->text_string), 0, 32, AlignLeft, AlignCenter);
dialog_ex, furi_string_get_cstr(app->text_string), 0, 32, AlignLeft, AlignCenter);
}
free(bench_data);
@@ -159,5 +159,5 @@ void storage_settings_scene_benchmark_on_exit(void* context) {
dialog_ex_reset(dialog_ex);
string_reset(app->text_string);
furi_string_reset(app->text_string);
}

View File

@@ -49,13 +49,13 @@ bool storage_settings_scene_factory_reset_on_event(void* context, SceneManagerEv
case DialogExResultRight:
counter++;
if(counter < STORAGE_SETTINGS_SCENE_FACTORY_RESET_CONFIRM_COUNT) {
string_printf(
furi_string_printf(
app->text_string,
"%ld presses left",
STORAGE_SETTINGS_SCENE_FACTORY_RESET_CONFIRM_COUNT - counter);
dialog_ex_set_text(
app->dialog_ex,
string_get_cstr(app->text_string),
furi_string_get_cstr(app->text_string),
64,
32,
AlignCenter,
@@ -83,5 +83,5 @@ void storage_settings_scene_factory_reset_on_exit(void* context) {
dialog_ex_reset(dialog_ex);
string_reset(app->text_string);
furi_string_reset(app->text_string);
}

View File

@@ -25,14 +25,14 @@ void storage_settings_scene_internal_info_on_enter(void* context) {
dialog_ex_set_text(
dialog_ex, storage_error_get_desc(error), 64, 32, AlignCenter, AlignCenter);
} else {
string_printf(
furi_string_printf(
app->text_string,
"Label: %s\nType: LittleFS\n%lu KB total\n%lu KB free",
furi_hal_version_get_name_ptr() ? furi_hal_version_get_name_ptr() : "Unknown",
(uint32_t)(total_space / 1024),
(uint32_t)(free_space / 1024));
dialog_ex_set_text(
dialog_ex, string_get_cstr(app->text_string), 4, 4, AlignLeft, AlignTop);
dialog_ex, furi_string_get_cstr(app->text_string), 4, 4, AlignLeft, AlignTop);
}
view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx);
@@ -58,5 +58,5 @@ void storage_settings_scene_internal_info_on_exit(void* context) {
dialog_ex_reset(dialog_ex);
string_reset(app->text_string);
furi_string_reset(app->text_string);
}

View File

@@ -24,7 +24,7 @@ void storage_settings_scene_sd_info_on_enter(void* context) {
dialog_ex, "Try to reinsert\nor format SD\ncard.", 3, 19, AlignLeft, AlignTop);
dialog_ex_set_center_button_text(dialog_ex, "Ok");
} else {
string_printf(
furi_string_printf(
app->text_string,
"Label: %s\nType: %s\n%lu KB total\n%lu KB free",
sd_info.label,
@@ -32,7 +32,7 @@ void storage_settings_scene_sd_info_on_enter(void* context) {
sd_info.kb_total,
sd_info.kb_free);
dialog_ex_set_text(
dialog_ex, string_get_cstr(app->text_string), 4, 4, AlignLeft, AlignTop);
dialog_ex, furi_string_get_cstr(app->text_string), 4, 4, AlignLeft, AlignTop);
}
view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx);
@@ -70,5 +70,5 @@ void storage_settings_scene_sd_info_on_exit(void* context) {
dialog_ex_reset(dialog_ex);
string_reset(app->text_string);
furi_string_reset(app->text_string);
}

View File

@@ -21,7 +21,7 @@ static StorageSettings* storage_settings_alloc() {
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&storage_settings_scene_handlers, app);
string_init(app->text_string);
app->text_string = furi_string_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
@@ -60,7 +60,7 @@ static void storage_settings_free(StorageSettings* app) {
furi_record_close(RECORD_STORAGE);
furi_record_close(RECORD_NOTIFICATION);
string_clear(app->text_string);
furi_string_free(app->text_string);
free(app);
}

View File

@@ -34,7 +34,7 @@ typedef struct {
DialogEx* dialog_ex;
// text
string_t text_string;
FuriString* text_string;
} StorageSettings;
typedef enum {