mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
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:
@@ -21,12 +21,12 @@
|
||||
|
||||
UpdateManifest* update_manifest_alloc() {
|
||||
UpdateManifest* update_manifest = malloc(sizeof(UpdateManifest));
|
||||
string_init(update_manifest->version);
|
||||
string_init(update_manifest->firmware_dfu_image);
|
||||
string_init(update_manifest->radio_image);
|
||||
string_init(update_manifest->staged_loader_file);
|
||||
string_init(update_manifest->resource_bundle);
|
||||
string_init(update_manifest->splash_file);
|
||||
update_manifest->version = furi_string_alloc();
|
||||
update_manifest->firmware_dfu_image = furi_string_alloc();
|
||||
update_manifest->radio_image = furi_string_alloc();
|
||||
update_manifest->staged_loader_file = furi_string_alloc();
|
||||
update_manifest->resource_bundle = furi_string_alloc();
|
||||
update_manifest->splash_file = furi_string_alloc();
|
||||
update_manifest->target = 0;
|
||||
update_manifest->manifest_version = 0;
|
||||
memset(update_manifest->ob_reference.bytes, 0, FURI_HAL_FLASH_OB_RAW_SIZE_BYTES);
|
||||
@@ -38,12 +38,12 @@ UpdateManifest* update_manifest_alloc() {
|
||||
|
||||
void update_manifest_free(UpdateManifest* update_manifest) {
|
||||
furi_assert(update_manifest);
|
||||
string_clear(update_manifest->version);
|
||||
string_clear(update_manifest->firmware_dfu_image);
|
||||
string_clear(update_manifest->radio_image);
|
||||
string_clear(update_manifest->staged_loader_file);
|
||||
string_clear(update_manifest->resource_bundle);
|
||||
string_clear(update_manifest->splash_file);
|
||||
furi_string_free(update_manifest->version);
|
||||
furi_string_free(update_manifest->firmware_dfu_image);
|
||||
furi_string_free(update_manifest->radio_image);
|
||||
furi_string_free(update_manifest->staged_loader_file);
|
||||
furi_string_free(update_manifest->resource_bundle);
|
||||
furi_string_free(update_manifest->splash_file);
|
||||
free(update_manifest);
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ static bool
|
||||
furi_assert(update_manifest);
|
||||
furi_assert(flipper_file);
|
||||
|
||||
string_t filetype;
|
||||
FuriString* filetype;
|
||||
|
||||
// TODO: compare filetype?
|
||||
string_init(filetype);
|
||||
filetype = furi_string_alloc();
|
||||
update_manifest->valid =
|
||||
flipper_format_read_header(flipper_file, filetype, &update_manifest->manifest_version) &&
|
||||
flipper_format_read_string(flipper_file, MANIFEST_KEY_INFO, update_manifest->version) &&
|
||||
@@ -68,7 +68,7 @@ static bool
|
||||
MANIFEST_KEY_LOADER_CRC,
|
||||
(uint8_t*)&update_manifest->staged_loader_crc,
|
||||
sizeof(uint32_t));
|
||||
string_clear(filetype);
|
||||
furi_string_free(filetype);
|
||||
|
||||
if(update_manifest->valid) {
|
||||
/* Optional fields - we can have dfu, radio, resources, or any combination */
|
||||
@@ -114,9 +114,9 @@ static bool
|
||||
flipper_file, MANIFEST_KEY_SPLASH_FILE, update_manifest->splash_file);
|
||||
|
||||
update_manifest->valid =
|
||||
(!string_empty_p(update_manifest->firmware_dfu_image) ||
|
||||
!string_empty_p(update_manifest->radio_image) ||
|
||||
!string_empty_p(update_manifest->resource_bundle));
|
||||
(!furi_string_empty(update_manifest->firmware_dfu_image) ||
|
||||
!furi_string_empty(update_manifest->radio_image) ||
|
||||
!furi_string_empty(update_manifest->resource_bundle));
|
||||
}
|
||||
|
||||
return update_manifest->valid;
|
||||
|
||||
Reference in New Issue
Block a user