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:
@@ -224,13 +224,12 @@ static void do_dir_test(Storage* api, const char* path) {
|
||||
}
|
||||
|
||||
static void do_test_start(Storage* api, const char* path) {
|
||||
string_t str_path;
|
||||
string_init_printf(str_path, "%s/test-folder", path);
|
||||
FuriString* str_path = furi_string_alloc_printf("%s/test-folder", path);
|
||||
|
||||
FURI_LOG_I(TAG, "--------- START \"%s\" ---------", path);
|
||||
|
||||
// mkdir
|
||||
FS_Error result = storage_common_mkdir(api, string_get_cstr(str_path));
|
||||
FS_Error result = storage_common_mkdir(api, furi_string_get_cstr(str_path));
|
||||
|
||||
if(result == FSE_OK) {
|
||||
FURI_LOG_I(TAG, "mkdir ok");
|
||||
@@ -240,7 +239,7 @@ static void do_test_start(Storage* api, const char* path) {
|
||||
|
||||
// stat
|
||||
FileInfo fileinfo;
|
||||
result = storage_common_stat(api, string_get_cstr(str_path), &fileinfo);
|
||||
result = storage_common_stat(api, furi_string_get_cstr(str_path), &fileinfo);
|
||||
|
||||
if(result == FSE_OK) {
|
||||
if(fileinfo.flags & FSF_DIRECTORY) {
|
||||
@@ -252,16 +251,14 @@ static void do_test_start(Storage* api, const char* path) {
|
||||
FURI_LOG_E(TAG, "stat #1, %s", storage_error_get_desc(result));
|
||||
}
|
||||
|
||||
string_clear(str_path);
|
||||
furi_string_free(str_path);
|
||||
}
|
||||
|
||||
static void do_test_end(Storage* api, const char* path) {
|
||||
uint64_t total_space;
|
||||
uint64_t free_space;
|
||||
string_t str_path_1;
|
||||
string_t str_path_2;
|
||||
string_init_printf(str_path_1, "%s/test-folder", path);
|
||||
string_init_printf(str_path_2, "%s/test-folder2", path);
|
||||
FuriString* str_path_1 = furi_string_alloc_printf("%s/test-folder", path);
|
||||
FuriString* str_path_2 = furi_string_alloc_printf("%s/test-folder2", path);
|
||||
|
||||
FURI_LOG_I(TAG, "--------- END \"%s\" ---------", path);
|
||||
|
||||
@@ -277,7 +274,8 @@ static void do_test_end(Storage* api, const char* path) {
|
||||
}
|
||||
|
||||
// rename #1
|
||||
result = storage_common_rename(api, string_get_cstr(str_path_1), string_get_cstr(str_path_2));
|
||||
result = storage_common_rename(
|
||||
api, furi_string_get_cstr(str_path_1), furi_string_get_cstr(str_path_2));
|
||||
if(result == FSE_OK) {
|
||||
FURI_LOG_I(TAG, "rename #1 ok");
|
||||
} else {
|
||||
@@ -285,7 +283,7 @@ static void do_test_end(Storage* api, const char* path) {
|
||||
}
|
||||
|
||||
// remove #1
|
||||
result = storage_common_remove(api, string_get_cstr(str_path_2));
|
||||
result = storage_common_remove(api, furi_string_get_cstr(str_path_2));
|
||||
if(result == FSE_OK) {
|
||||
FURI_LOG_I(TAG, "remove #1 ok");
|
||||
} else {
|
||||
@@ -293,10 +291,11 @@ static void do_test_end(Storage* api, const char* path) {
|
||||
}
|
||||
|
||||
// rename #2
|
||||
string_printf(str_path_1, "%s/test.txt", path);
|
||||
string_printf(str_path_2, "%s/test2.txt", path);
|
||||
furi_string_printf(str_path_1, "%s/test.txt", path);
|
||||
furi_string_printf(str_path_2, "%s/test2.txt", path);
|
||||
|
||||
result = storage_common_rename(api, string_get_cstr(str_path_1), string_get_cstr(str_path_2));
|
||||
result = storage_common_rename(
|
||||
api, furi_string_get_cstr(str_path_1), furi_string_get_cstr(str_path_2));
|
||||
if(result == FSE_OK) {
|
||||
FURI_LOG_I(TAG, "rename #2 ok");
|
||||
} else {
|
||||
@@ -304,15 +303,15 @@ static void do_test_end(Storage* api, const char* path) {
|
||||
}
|
||||
|
||||
// remove #2
|
||||
result = storage_common_remove(api, string_get_cstr(str_path_2));
|
||||
result = storage_common_remove(api, furi_string_get_cstr(str_path_2));
|
||||
if(result == FSE_OK) {
|
||||
FURI_LOG_I(TAG, "remove #2 ok");
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "remove #2, %s", storage_error_get_desc(result));
|
||||
}
|
||||
|
||||
string_clear(str_path_1);
|
||||
string_clear(str_path_2);
|
||||
furi_string_free(str_path_1);
|
||||
furi_string_free(str_path_2);
|
||||
}
|
||||
|
||||
int32_t storage_test_app(void* p) {
|
||||
|
Reference in New Issue
Block a user