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

@@ -40,14 +40,14 @@ static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selec
LoaderStatus status;
if(selected->is_app) {
char* param = strrchr(string_get_cstr(selected->path), '/');
char* param = strrchr(furi_string_get_cstr(selected->path), '/');
if(param != NULL) {
param++;
}
status = loader_start(loader, flipper_app_name[selected->type], param);
} else {
status = loader_start(
loader, flipper_app_name[selected->type], string_get_cstr(selected->path));
loader, flipper_app_name[selected->type], furi_string_get_cstr(selected->path));
}
if(status != LoaderStatusOk) {
@@ -159,13 +159,13 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;
case ArchiveBrowserEventEnterFavMove:
string_set(archive->fav_move_str, selected->path);
furi_string_set(archive->fav_move_str, selected->path);
archive_show_file_menu(browser, false);
archive_favorites_move_mode(archive->browser, true);
consumed = true;
break;
case ArchiveBrowserEventExitFavMove:
archive_update_focus(browser, string_get_cstr(archive->fav_move_str));
archive_update_focus(browser, furi_string_get_cstr(archive->fav_move_str));
archive_favorites_move_mode(archive->browser, false);
consumed = true;
break;

View File

@@ -4,7 +4,6 @@
#include "../helpers/archive_apps.h"
#include "../helpers/archive_browser.h"
#include "toolbox/path.h"
#include "m-string.h"
#define SCENE_DELETE_CUSTOM_EVENT (0UL)
#define MAX_TEXT_INPUT_LEN 22
@@ -26,18 +25,18 @@ void archive_scene_delete_on_enter(void* context) {
widget_add_button_element(
app->widget, GuiButtonTypeRight, "Delete", archive_scene_delete_widget_callback, app);
string_t filename;
string_init(filename);
FuriString* filename;
filename = furi_string_alloc();
ArchiveFile_t* current = archive_get_current_file(app->browser);
path_extract_filename(current->path, filename, false);
char delete_str[64];
snprintf(delete_str, sizeof(delete_str), "\e#Delete %s?\e#", string_get_cstr(filename));
snprintf(delete_str, sizeof(delete_str), "\e#Delete %s?\e#", furi_string_get_cstr(filename));
widget_add_text_box_element(
app->widget, 0, 0, 128, 23, AlignCenter, AlignCenter, delete_str, false);
string_clear(filename);
furi_string_free(filename);
view_dispatcher_switch_to_view(app->view_dispatcher, ArchiveViewWidget);
}

View File

@@ -19,10 +19,10 @@ void archive_scene_rename_on_enter(void* context) {
TextInput* text_input = archive->text_input;
ArchiveFile_t* current = archive_get_current_file(archive->browser);
string_t filename;
string_init(filename);
FuriString* filename;
filename = furi_string_alloc();
path_extract_filename(current->path, filename, true);
strlcpy(archive->text_store, string_get_cstr(filename), MAX_NAME_LEN);
strlcpy(archive->text_store, furi_string_get_cstr(filename), MAX_NAME_LEN);
path_extract_extension(current->path, archive->file_extension, MAX_EXT_LEN);
@@ -37,10 +37,10 @@ void archive_scene_rename_on_enter(void* context) {
false);
ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
string_get_cstr(archive->browser->path), archive->file_extension, "");
furi_string_get_cstr(archive->browser->path), archive->file_extension, "");
text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
string_clear(filename);
furi_string_free(filename);
view_dispatcher_switch_to_view(archive->view_dispatcher, ArchiveViewTextInput);
}
@@ -56,19 +56,19 @@ bool archive_scene_rename_on_event(void* context, SceneManagerEvent event) {
const char* path_src = archive_get_name(archive->browser);
ArchiveFile_t* file = archive_get_current_file(archive->browser);
string_t path_dst;
string_init(path_dst);
FuriString* path_dst;
path_dst = furi_string_alloc();
path_extract_dirname(path_src, path_dst);
string_cat_printf(path_dst, "/%s%s", archive->text_store, known_ext[file->type]);
furi_string_cat_printf(path_dst, "/%s%s", archive->text_store, known_ext[file->type]);
storage_common_rename(fs_api, path_src, string_get_cstr(path_dst));
storage_common_rename(fs_api, path_src, furi_string_get_cstr(path_dst));
furi_record_close(RECORD_STORAGE);
if(file->fav) {
archive_favorites_rename(path_src, string_get_cstr(path_dst));
archive_favorites_rename(path_src, furi_string_get_cstr(path_dst));
}
string_clear(path_dst);
furi_string_free(path_dst);
scene_manager_next_scene(archive->scene_manager, ArchiveAppSceneBrowser);
consumed = true;