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:
@@ -220,14 +220,14 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
|
||||
return 0;
|
||||
}
|
||||
|
||||
string_t full_extracted_fname;
|
||||
FuriString* full_extracted_fname;
|
||||
if(header->type == MTAR_TDIR) {
|
||||
string_init(full_extracted_fname);
|
||||
full_extracted_fname = furi_string_alloc();
|
||||
path_concat(op_params->work_dir, header->name, full_extracted_fname);
|
||||
|
||||
bool create_res =
|
||||
storage_simply_mkdir(archive->storage, string_get_cstr(full_extracted_fname));
|
||||
string_clear(full_extracted_fname);
|
||||
storage_simply_mkdir(archive->storage, furi_string_get_cstr(full_extracted_fname));
|
||||
furi_string_free(full_extracted_fname);
|
||||
return create_res ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -238,19 +238,19 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
|
||||
|
||||
FURI_LOG_D(TAG, "Extracting %d bytes to '%s'", header->size, header->name);
|
||||
|
||||
string_t converted_fname;
|
||||
string_init_set(converted_fname, header->name);
|
||||
FuriString* converted_fname = furi_string_alloc_set(header->name);
|
||||
if(op_params->converter) {
|
||||
op_params->converter(converted_fname);
|
||||
}
|
||||
|
||||
string_init(full_extracted_fname);
|
||||
path_concat(op_params->work_dir, string_get_cstr(converted_fname), full_extracted_fname);
|
||||
full_extracted_fname = furi_string_alloc();
|
||||
path_concat(op_params->work_dir, furi_string_get_cstr(converted_fname), full_extracted_fname);
|
||||
|
||||
bool success = archive_extract_current_file(archive, string_get_cstr(full_extracted_fname));
|
||||
bool success =
|
||||
archive_extract_current_file(archive, furi_string_get_cstr(full_extracted_fname));
|
||||
|
||||
string_clear(converted_fname);
|
||||
string_clear(full_extracted_fname);
|
||||
furi_string_free(converted_fname);
|
||||
furi_string_free(full_extracted_fname);
|
||||
return success ? 0 : -1;
|
||||
}
|
||||
|
||||
@@ -333,32 +333,32 @@ bool tar_archive_add_dir(TarArchive* archive, const char* fs_full_path, const ch
|
||||
break;
|
||||
}
|
||||
|
||||
string_t element_name, element_fs_abs_path;
|
||||
string_init(element_name);
|
||||
string_init(element_fs_abs_path);
|
||||
FuriString* element_name = furi_string_alloc();
|
||||
FuriString* element_fs_abs_path = furi_string_alloc();
|
||||
|
||||
path_concat(fs_full_path, name, element_fs_abs_path);
|
||||
if(strlen(path_prefix)) {
|
||||
path_concat(path_prefix, name, element_name);
|
||||
} else {
|
||||
string_init_set(element_name, name);
|
||||
furi_string_set(element_name, name);
|
||||
}
|
||||
|
||||
if(file_info.flags & FSF_DIRECTORY) {
|
||||
success = tar_archive_dir_add_element(archive, string_get_cstr(element_name)) &&
|
||||
tar_archive_add_dir(
|
||||
archive,
|
||||
string_get_cstr(element_fs_abs_path),
|
||||
string_get_cstr(element_name));
|
||||
success =
|
||||
tar_archive_dir_add_element(archive, furi_string_get_cstr(element_name)) &&
|
||||
tar_archive_add_dir(
|
||||
archive,
|
||||
furi_string_get_cstr(element_fs_abs_path),
|
||||
furi_string_get_cstr(element_name));
|
||||
} else {
|
||||
success = tar_archive_add_file(
|
||||
archive,
|
||||
string_get_cstr(element_fs_abs_path),
|
||||
string_get_cstr(element_name),
|
||||
furi_string_get_cstr(element_fs_abs_path),
|
||||
furi_string_get_cstr(element_name),
|
||||
file_info.size);
|
||||
}
|
||||
string_clear(element_name);
|
||||
string_clear(element_fs_abs_path);
|
||||
furi_string_free(element_name);
|
||||
furi_string_free(element_fs_abs_path);
|
||||
|
||||
if(!success) {
|
||||
break;
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <m-string.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user