[FL-2274] Inventing streams and moving FFF to them (#981)
* Streams: string stream * String stream: updated insert/delete api * Streams: generic stream interface and string stream implementation * Streams: helpers for insert and delete_and_insert * FFF: now compatible with streams * MinUnit: introduced tests with arguments * FFF: stream access violation * Streams: copy data between streams * Streams: file stream * FFF: documentation * FFStream: documentation * FFF: alloc as file * MinUnit: support for nested tests * Streams: changed delete_and_insert, now it returns success flag. Added ability dump stream inner parameters and data to cout. * FFF: simplified file open function * Streams: unit tests * FFF: tests * Streams: declare cache_size constant as define, to allow variable modified arrays * FFF: lib moved to a separate folder * iButton: new FFF * RFID: new FFF * Animations: new FFF * IR: new FFF * NFC: new FFF * Flipper file format: delete lib * U2F: new FFF * Subghz: new FFF and streams * Streams: read line * Streams: split * FuriCore: implement memset with extra asserts * FuriCore: implement extra heap asserts without inventing memset * Scene manager: protected access to the scene id stack with a size check * NFC worker: dirty fix for issue where hal_nfc was busy on app start * Furi: update allocator to erase memory on allocation. Replace furi_alloc with malloc. * FuriCore: cleanup memmgr code. * Furi HAL: furi_hal_init is split into critical and non-critical parts. The critical part is currently clock and console. * Memmgr: added ability to track allocations and deallocations through console. * FFStream: some speedup * Streams, FF: minor fixes * Tests: restore * File stream: a slightly more thread-safe version of file_stream_delete_and_insert Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -258,7 +258,7 @@ static void animation_manager_replace_current_animation(
|
||||
}
|
||||
|
||||
AnimationManager* animation_manager_alloc(void) {
|
||||
AnimationManager* animation_manager = furi_alloc(sizeof(AnimationManager));
|
||||
AnimationManager* animation_manager = malloc(sizeof(AnimationManager));
|
||||
animation_manager->animation_view = bubble_animation_view_alloc();
|
||||
animation_manager->view_stack = view_stack_alloc();
|
||||
View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <flipper_file.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
#include <furi.h>
|
||||
#include <furi/dangerous_defines.h>
|
||||
#include <storage/storage.h>
|
||||
@@ -30,41 +30,41 @@ static bool animation_storage_load_single_manifest_info(
|
||||
|
||||
bool result = false;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
FlipperFile* file = flipper_file_alloc(storage);
|
||||
flipper_file_set_strict_mode(file, true);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
string_t read_string;
|
||||
string_init(read_string);
|
||||
|
||||
do {
|
||||
uint32_t u32value;
|
||||
if(FSE_OK != storage_sd_status(storage)) break;
|
||||
if(!flipper_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
|
||||
if(!flipper_format_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
|
||||
|
||||
if(!flipper_file_read_header(file, read_string, &u32value)) break;
|
||||
if(!flipper_format_read_header(file, read_string, &u32value)) break;
|
||||
if(string_cmp_str(read_string, "Flipper Animation Manifest")) break;
|
||||
|
||||
manifest_info->name = NULL;
|
||||
|
||||
/* skip other animation names */
|
||||
flipper_file_set_strict_mode(file, false);
|
||||
while(flipper_file_read_string(file, "Name", read_string) &&
|
||||
flipper_format_set_strict_mode(file, false);
|
||||
while(flipper_format_read_string(file, "Name", read_string) &&
|
||||
string_cmp_str(read_string, name))
|
||||
;
|
||||
if(string_cmp_str(read_string, name)) break;
|
||||
flipper_file_set_strict_mode(file, true);
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
|
||||
manifest_info->name = furi_alloc(string_size(read_string) + 1);
|
||||
manifest_info->name = malloc(string_size(read_string) + 1);
|
||||
strcpy((char*)manifest_info->name, string_get_cstr(read_string));
|
||||
|
||||
if(!flipper_file_read_uint32(file, "Min butthurt", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Min butthurt", &u32value, 1)) break;
|
||||
manifest_info->min_butthurt = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Max butthurt", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Max butthurt", &u32value, 1)) break;
|
||||
manifest_info->max_butthurt = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Min level", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Min level", &u32value, 1)) break;
|
||||
manifest_info->min_level = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Max level", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Max level", &u32value, 1)) break;
|
||||
manifest_info->max_level = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Weight", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Weight", &u32value, 1)) break;
|
||||
manifest_info->weight = u32value;
|
||||
result = true;
|
||||
} while(0);
|
||||
@@ -73,8 +73,7 @@ static bool animation_storage_load_single_manifest_info(
|
||||
free((void*)manifest_info->name);
|
||||
}
|
||||
string_clear(read_string);
|
||||
flipper_file_close(file);
|
||||
flipper_file_free(file);
|
||||
flipper_format_free(file);
|
||||
|
||||
furi_record_close("storage");
|
||||
|
||||
@@ -86,9 +85,9 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
||||
furi_assert(!StorageAnimationList_size(*animation_list));
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
FlipperFile* file = flipper_file_alloc(storage);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
/* Forbid skipping fields */
|
||||
flipper_file_set_strict_mode(file, true);
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
string_t read_string;
|
||||
string_init(read_string);
|
||||
|
||||
@@ -97,28 +96,28 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
||||
StorageAnimation* storage_animation = NULL;
|
||||
|
||||
if(FSE_OK != storage_sd_status(storage)) break;
|
||||
if(!flipper_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
|
||||
if(!flipper_file_read_header(file, read_string, &u32value)) break;
|
||||
if(!flipper_format_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
|
||||
if(!flipper_format_read_header(file, read_string, &u32value)) break;
|
||||
if(string_cmp_str(read_string, "Flipper Animation Manifest")) break;
|
||||
do {
|
||||
storage_animation = furi_alloc(sizeof(StorageAnimation));
|
||||
storage_animation = malloc(sizeof(StorageAnimation));
|
||||
storage_animation->external = true;
|
||||
storage_animation->animation = NULL;
|
||||
storage_animation->manifest_info.name = NULL;
|
||||
|
||||
if(!flipper_file_read_string(file, "Name", read_string)) break;
|
||||
storage_animation->manifest_info.name = furi_alloc(string_size(read_string) + 1);
|
||||
if(!flipper_format_read_string(file, "Name", read_string)) break;
|
||||
storage_animation->manifest_info.name = malloc(string_size(read_string) + 1);
|
||||
strcpy((char*)storage_animation->manifest_info.name, string_get_cstr(read_string));
|
||||
|
||||
if(!flipper_file_read_uint32(file, "Min butthurt", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Min butthurt", &u32value, 1)) break;
|
||||
storage_animation->manifest_info.min_butthurt = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Max butthurt", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Max butthurt", &u32value, 1)) break;
|
||||
storage_animation->manifest_info.max_butthurt = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Min level", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Min level", &u32value, 1)) break;
|
||||
storage_animation->manifest_info.min_level = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Max level", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Max level", &u32value, 1)) break;
|
||||
storage_animation->manifest_info.max_level = u32value;
|
||||
if(!flipper_file_read_uint32(file, "Weight", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(file, "Weight", &u32value, 1)) break;
|
||||
storage_animation->manifest_info.weight = u32value;
|
||||
|
||||
StorageAnimationList_push_back(*animation_list, storage_animation);
|
||||
@@ -128,8 +127,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
||||
} while(0);
|
||||
|
||||
string_clear(read_string);
|
||||
flipper_file_close(file);
|
||||
flipper_file_free(file);
|
||||
flipper_format_free(file);
|
||||
|
||||
// add hard-coded animations
|
||||
for(int i = 0; i < dolphin_internal_size; ++i) {
|
||||
@@ -162,7 +160,7 @@ StorageAnimation* animation_storage_find_animation(const char* name) {
|
||||
|
||||
/* look through external animations */
|
||||
if(!storage_animation) {
|
||||
storage_animation = furi_alloc(sizeof(StorageAnimation));
|
||||
storage_animation = malloc(sizeof(StorageAnimation));
|
||||
storage_animation->external = true;
|
||||
|
||||
bool result = false;
|
||||
@@ -288,7 +286,7 @@ static bool animation_storage_load_frames(
|
||||
FURI_CONST_ASSIGN(icon->frame_rate, 0);
|
||||
FURI_CONST_ASSIGN(icon->height, height);
|
||||
FURI_CONST_ASSIGN(icon->width, width);
|
||||
icon->frames = furi_alloc(sizeof(const uint8_t*) * icon->frame_count);
|
||||
icon->frames = malloc(sizeof(const uint8_t*) * icon->frame_count);
|
||||
|
||||
bool frames_ok = false;
|
||||
File* file = storage_file_alloc(storage);
|
||||
@@ -317,7 +315,7 @@ static bool animation_storage_load_frames(
|
||||
break;
|
||||
}
|
||||
|
||||
FURI_CONST_ASSIGN_PTR(icon->frames[i], furi_alloc(file_info.size));
|
||||
FURI_CONST_ASSIGN_PTR(icon->frames[i], malloc(file_info.size));
|
||||
if(storage_file_read(file, (void*)icon->frames[i], file_info.size) != file_info.size) {
|
||||
FURI_LOG_E(TAG, "Read failed: \'%s\'", string_get_cstr(filename));
|
||||
break;
|
||||
@@ -348,7 +346,7 @@ static bool animation_storage_load_frames(
|
||||
return frames_ok;
|
||||
}
|
||||
|
||||
static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFile* ff) {
|
||||
static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFormat* ff) {
|
||||
uint32_t u32value;
|
||||
string_t str;
|
||||
string_init(str);
|
||||
@@ -356,7 +354,7 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
|
||||
furi_assert(!animation->frame_bubble_sequences);
|
||||
|
||||
do {
|
||||
if(!flipper_file_read_uint32(ff, "Bubble slots", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Bubble slots", &u32value, 1)) break;
|
||||
if(u32value > 20) break;
|
||||
animation->frame_bubble_sequences_count = u32value;
|
||||
if(animation->frame_bubble_sequences_count == 0) {
|
||||
@@ -365,22 +363,22 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
|
||||
break;
|
||||
}
|
||||
animation->frame_bubble_sequences =
|
||||
furi_alloc(sizeof(FrameBubble*) * animation->frame_bubble_sequences_count);
|
||||
malloc(sizeof(FrameBubble*) * animation->frame_bubble_sequences_count);
|
||||
|
||||
uint32_t current_slot = 0;
|
||||
for(int i = 0; i < animation->frame_bubble_sequences_count; ++i) {
|
||||
FURI_CONST_ASSIGN_PTR(
|
||||
animation->frame_bubble_sequences[i], furi_alloc(sizeof(FrameBubble)));
|
||||
animation->frame_bubble_sequences[i], malloc(sizeof(FrameBubble)));
|
||||
}
|
||||
|
||||
const FrameBubble* bubble = animation->frame_bubble_sequences[0];
|
||||
int8_t index = -1;
|
||||
for(;;) {
|
||||
if(!flipper_file_read_uint32(ff, "Slot", ¤t_slot, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Slot", ¤t_slot, 1)) break;
|
||||
if((current_slot != 0) && (index == -1)) break;
|
||||
|
||||
if(current_slot == index) {
|
||||
FURI_CONST_ASSIGN_PTR(bubble->next_bubble, furi_alloc(sizeof(FrameBubble)));
|
||||
FURI_CONST_ASSIGN_PTR(bubble->next_bubble, malloc(sizeof(FrameBubble)));
|
||||
bubble = bubble->next_bubble;
|
||||
} else if(current_slot == index + 1) {
|
||||
++index;
|
||||
@@ -392,27 +390,27 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
|
||||
}
|
||||
if(index >= animation->frame_bubble_sequences_count) break;
|
||||
|
||||
if(!flipper_file_read_uint32(ff, "X", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "X", &u32value, 1)) break;
|
||||
FURI_CONST_ASSIGN(bubble->bubble.x, u32value);
|
||||
if(!flipper_file_read_uint32(ff, "Y", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Y", &u32value, 1)) break;
|
||||
FURI_CONST_ASSIGN(bubble->bubble.y, u32value);
|
||||
|
||||
if(!flipper_file_read_string(ff, "Text", str)) break;
|
||||
if(!flipper_format_read_string(ff, "Text", str)) break;
|
||||
if(string_size(str) > 100) break;
|
||||
|
||||
string_replace_all_str(str, "\\n", "\n");
|
||||
|
||||
FURI_CONST_ASSIGN_PTR(bubble->bubble.text, furi_alloc(string_size(str) + 1));
|
||||
FURI_CONST_ASSIGN_PTR(bubble->bubble.text, malloc(string_size(str) + 1));
|
||||
strcpy((char*)bubble->bubble.text, string_get_cstr(str));
|
||||
|
||||
if(!flipper_file_read_string(ff, "AlignH", str)) break;
|
||||
if(!flipper_format_read_string(ff, "AlignH", str)) break;
|
||||
if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_h)) break;
|
||||
if(!flipper_file_read_string(ff, "AlignV", str)) break;
|
||||
if(!flipper_format_read_string(ff, "AlignV", str)) break;
|
||||
if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_v)) break;
|
||||
|
||||
if(!flipper_file_read_uint32(ff, "StartFrame", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "StartFrame", &u32value, 1)) break;
|
||||
FURI_CONST_ASSIGN(bubble->start_frame, u32value);
|
||||
if(!flipper_file_read_uint32(ff, "EndFrame", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "EndFrame", &u32value, 1)) break;
|
||||
FURI_CONST_ASSIGN(bubble->end_frame, u32value);
|
||||
}
|
||||
success = (index + 1) == animation->frame_bubble_sequences_count;
|
||||
@@ -431,15 +429,15 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
|
||||
|
||||
static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
||||
furi_assert(name);
|
||||
BubbleAnimation* animation = furi_alloc(sizeof(BubbleAnimation));
|
||||
BubbleAnimation* animation = malloc(sizeof(BubbleAnimation));
|
||||
|
||||
uint32_t height = 0;
|
||||
uint32_t width = 0;
|
||||
uint32_t* u32array = NULL;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
FlipperFile* ff = flipper_file_alloc(storage);
|
||||
FlipperFormat* ff = flipper_format_file_alloc(storage);
|
||||
/* Forbid skipping fields */
|
||||
flipper_file_set_strict_mode(ff, true);
|
||||
flipper_format_set_strict_mode(ff, true);
|
||||
string_t str;
|
||||
string_init(str);
|
||||
animation->frame_bubble_sequences = NULL;
|
||||
@@ -451,28 +449,28 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
||||
if(FSE_OK != storage_sd_status(storage)) break;
|
||||
|
||||
string_printf(str, ANIMATION_DIR "/%s/" ANIMATION_META_FILE, name);
|
||||
if(!flipper_file_open_existing(ff, string_get_cstr(str))) break;
|
||||
if(!flipper_file_read_header(ff, str, &u32value)) break;
|
||||
if(!flipper_format_file_open_existing(ff, string_get_cstr(str))) break;
|
||||
if(!flipper_format_read_header(ff, str, &u32value)) break;
|
||||
if(string_cmp_str(str, "Flipper Animation")) break;
|
||||
|
||||
if(!flipper_file_read_uint32(ff, "Width", &width, 1)) break;
|
||||
if(!flipper_file_read_uint32(ff, "Height", &height, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Width", &width, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Height", &height, 1)) break;
|
||||
|
||||
if(!flipper_file_read_uint32(ff, "Passive frames", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Passive frames", &u32value, 1)) break;
|
||||
animation->passive_frames = u32value;
|
||||
if(!flipper_file_read_uint32(ff, "Active frames", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Active frames", &u32value, 1)) break;
|
||||
animation->active_frames = u32value;
|
||||
|
||||
uint8_t frames = animation->passive_frames + animation->active_frames;
|
||||
uint32_t count = 0;
|
||||
if(!flipper_file_get_value_count(ff, "Frames order", &count)) break;
|
||||
if(!flipper_format_get_value_count(ff, "Frames order", &count)) break;
|
||||
if(count != frames) {
|
||||
FURI_LOG_E(TAG, "Error loading animation: frames order");
|
||||
break;
|
||||
}
|
||||
u32array = furi_alloc(sizeof(uint32_t) * frames);
|
||||
if(!flipper_file_read_uint32(ff, "Frames order", u32array, frames)) break;
|
||||
animation->frame_order = furi_alloc(sizeof(uint8_t) * frames);
|
||||
u32array = malloc(sizeof(uint32_t) * frames);
|
||||
if(!flipper_format_read_uint32(ff, "Frames order", u32array, frames)) break;
|
||||
animation->frame_order = malloc(sizeof(uint8_t) * frames);
|
||||
for(int i = 0; i < frames; ++i) {
|
||||
FURI_CONST_ASSIGN(animation->frame_order[i], u32array[i]);
|
||||
}
|
||||
@@ -481,13 +479,13 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
||||
if(!animation_storage_load_frames(storage, name, animation, u32array, width, height))
|
||||
break;
|
||||
|
||||
if(!flipper_file_read_uint32(ff, "Active cycles", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break;
|
||||
animation->active_cycles = u32value;
|
||||
if(!flipper_file_read_uint32(ff, "Frame rate", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
|
||||
FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value);
|
||||
if(!flipper_file_read_uint32(ff, "Duration", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Duration", &u32value, 1)) break;
|
||||
animation->duration = u32value;
|
||||
if(!flipper_file_read_uint32(ff, "Active cooldown", &u32value, 1)) break;
|
||||
if(!flipper_format_read_uint32(ff, "Active cooldown", &u32value, 1)) break;
|
||||
animation->active_cooldown = u32value;
|
||||
|
||||
if(!animation_storage_load_bubbles(animation, ff)) break;
|
||||
@@ -495,8 +493,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
||||
} while(0);
|
||||
|
||||
string_clear(str);
|
||||
flipper_file_close(ff);
|
||||
flipper_file_free(ff);
|
||||
flipper_format_free(ff);
|
||||
if(u32array) {
|
||||
free(u32array);
|
||||
}
|
||||
|
@@ -256,17 +256,17 @@ static Icon* bubble_animation_clone_first_frame(const Icon* icon_orig) {
|
||||
furi_assert(icon_orig->frames);
|
||||
furi_assert(icon_orig->frames[0]);
|
||||
|
||||
Icon* icon_clone = furi_alloc(sizeof(Icon));
|
||||
Icon* icon_clone = malloc(sizeof(Icon));
|
||||
memcpy(icon_clone, icon_orig, sizeof(Icon));
|
||||
|
||||
icon_clone->frames = furi_alloc(sizeof(uint8_t*));
|
||||
icon_clone->frames = malloc(sizeof(uint8_t*));
|
||||
/* icon bitmap can be either compressed or not. It is compressed if
|
||||
* compressed size is less than original, so max size for bitmap is
|
||||
* uncompressed (width * height) + 1 byte (in uncompressed case)
|
||||
* for compressed header
|
||||
*/
|
||||
size_t max_bitmap_size = ROUND_UP_TO(icon_orig->width, 8) * icon_orig->height + 1;
|
||||
FURI_CONST_ASSIGN_PTR(icon_clone->frames[0], furi_alloc(max_bitmap_size));
|
||||
FURI_CONST_ASSIGN_PTR(icon_clone->frames[0], malloc(max_bitmap_size));
|
||||
memcpy((void*)icon_clone->frames[0], icon_orig->frames[0], max_bitmap_size);
|
||||
FURI_CONST_ASSIGN(icon_clone->frame_count, 1);
|
||||
|
||||
@@ -304,7 +304,7 @@ static void bubble_animation_exit(void* context) {
|
||||
}
|
||||
|
||||
BubbleAnimationView* bubble_animation_view_alloc(void) {
|
||||
BubbleAnimationView* view = furi_alloc(sizeof(BubbleAnimationView));
|
||||
BubbleAnimationView* view = malloc(sizeof(BubbleAnimationView));
|
||||
view->view = view_alloc();
|
||||
view->interact_callback = NULL;
|
||||
view->timer = osTimerNew(bubble_animation_timer_callback, osTimerPeriodic, view, NULL);
|
||||
|
@@ -78,7 +78,7 @@ static bool one_shot_view_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
OneShotView* one_shot_view_alloc(void) {
|
||||
OneShotView* view = furi_alloc(sizeof(OneShotView));
|
||||
OneShotView* view = malloc(sizeof(OneShotView));
|
||||
view->view = view_alloc();
|
||||
view->update_timer =
|
||||
xTimerCreate(NULL, 1000, pdTRUE, view, one_shot_view_update_timer_callback);
|
||||
|
@@ -39,7 +39,7 @@ static void desktop_tick_event_callback(void* context) {
|
||||
}
|
||||
|
||||
Desktop* desktop_alloc() {
|
||||
Desktop* desktop = furi_alloc(sizeof(Desktop));
|
||||
Desktop* desktop = malloc(sizeof(Desktop));
|
||||
|
||||
desktop->unload_animation_semaphore = osSemaphoreNew(1, 0, NULL);
|
||||
desktop->animation_manager = animation_manager_alloc();
|
||||
|
@@ -19,7 +19,7 @@ static bool desktop_settings_back_event_callback(void* context) {
|
||||
}
|
||||
|
||||
DesktopSettingsApp* desktop_settings_app_alloc() {
|
||||
DesktopSettingsApp* app = furi_alloc(sizeof(DesktopSettingsApp));
|
||||
DesktopSettingsApp* app = malloc(sizeof(DesktopSettingsApp));
|
||||
|
||||
app->gui = furi_record_open("gui");
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
|
@@ -55,7 +55,7 @@ void desktop_settings_view_pin_setup_howto_set_callback(
|
||||
}
|
||||
|
||||
DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() {
|
||||
DesktopSettingsViewPinSetupHowto* view = furi_alloc(sizeof(DesktopSettingsViewPinSetupHowto));
|
||||
DesktopSettingsViewPinSetupHowto* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto));
|
||||
view->view = view_alloc();
|
||||
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
|
||||
view_set_context(view->view, view);
|
||||
|
@@ -77,8 +77,7 @@ void desktop_settings_view_pin_setup_howto2_set_ok_callback(
|
||||
}
|
||||
|
||||
DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() {
|
||||
DesktopSettingsViewPinSetupHowto2* view =
|
||||
furi_alloc(sizeof(DesktopSettingsViewPinSetupHowto2));
|
||||
DesktopSettingsViewPinSetupHowto2* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto2));
|
||||
view->view = view_alloc();
|
||||
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
|
||||
view_set_context(view->view, view);
|
||||
|
@@ -16,7 +16,7 @@ void desktop_scene_hw_mismatch_on_enter(void* context) {
|
||||
furi_assert(desktop);
|
||||
Popup* popup = desktop->hw_mismatch_popup;
|
||||
|
||||
char* text_buffer = furi_alloc(256);
|
||||
char* text_buffer = malloc(256);
|
||||
scene_manager_set_scene_state(
|
||||
desktop->scene_manager, DesktopSceneHwMismatch, (uint32_t)text_buffer);
|
||||
|
||||
|
@@ -80,7 +80,7 @@ void desktop_scene_pin_input_on_enter(void* context) {
|
||||
desktop_view_pin_input_set_done_callback(
|
||||
desktop->pin_input_view, desktop_scene_pin_input_done_callback);
|
||||
|
||||
DesktopScenePinInputState* state = furi_alloc(sizeof(DesktopScenePinInputState));
|
||||
DesktopScenePinInputState* state = malloc(sizeof(DesktopScenePinInputState));
|
||||
state->timer =
|
||||
xTimerCreate(NULL, 10000, pdFALSE, desktop, desktop_scene_pin_input_timer_callback);
|
||||
scene_manager_set_scene_state(desktop->scene_manager, DesktopScenePinInput, (uint32_t)state);
|
||||
|
@@ -150,7 +150,7 @@ bool desktop_debug_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
DesktopDebugView* desktop_debug_alloc() {
|
||||
DesktopDebugView* debug_view = furi_alloc(sizeof(DesktopDebugView));
|
||||
DesktopDebugView* debug_view = malloc(sizeof(DesktopDebugView));
|
||||
debug_view->view = view_alloc();
|
||||
view_allocate_model(debug_view->view, ViewModelTypeLocking, sizeof(DesktopDebugViewModel));
|
||||
view_set_context(debug_view->view, debug_view);
|
||||
|
@@ -131,7 +131,7 @@ static void desktop_first_start_exit(void* context) {
|
||||
}
|
||||
|
||||
DesktopFirstStartView* desktop_first_start_alloc() {
|
||||
DesktopFirstStartView* instance = furi_alloc(sizeof(DesktopFirstStartView));
|
||||
DesktopFirstStartView* instance = malloc(sizeof(DesktopFirstStartView));
|
||||
instance->view = view_alloc();
|
||||
view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(DesktopFirstStartViewModel));
|
||||
view_set_context(instance->view, instance);
|
||||
|
@@ -112,7 +112,7 @@ bool desktop_lock_menu_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
DesktopLockMenuView* desktop_lock_menu_alloc() {
|
||||
DesktopLockMenuView* lock_menu = furi_alloc(sizeof(DesktopLockMenuView));
|
||||
DesktopLockMenuView* lock_menu = malloc(sizeof(DesktopLockMenuView));
|
||||
lock_menu->view = view_alloc();
|
||||
view_allocate_model(lock_menu->view, ViewModelTypeLocking, sizeof(DesktopLockMenuViewModel));
|
||||
view_set_context(lock_menu->view, lock_menu);
|
||||
|
@@ -184,7 +184,7 @@ static bool desktop_view_locked_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
DesktopViewLocked* desktop_view_locked_alloc() {
|
||||
DesktopViewLocked* locked_view = furi_alloc(sizeof(DesktopViewLocked));
|
||||
DesktopViewLocked* locked_view = malloc(sizeof(DesktopViewLocked));
|
||||
locked_view->view = view_alloc();
|
||||
locked_view->timer =
|
||||
xTimerCreate(NULL, 1000 / 16, pdTRUE, locked_view, locked_view_timer_callback);
|
||||
|
@@ -58,7 +58,7 @@ bool desktop_main_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
DesktopMainView* desktop_main_alloc() {
|
||||
DesktopMainView* main_view = furi_alloc(sizeof(DesktopMainView));
|
||||
DesktopMainView* main_view = malloc(sizeof(DesktopMainView));
|
||||
|
||||
main_view->view = view_alloc();
|
||||
view_allocate_model(main_view->view, ViewModelTypeLockFree, 1);
|
||||
|
@@ -185,7 +185,7 @@ static void desktop_view_pin_input_exit(void* context) {
|
||||
}
|
||||
|
||||
DesktopViewPinInput* desktop_view_pin_input_alloc(void) {
|
||||
DesktopViewPinInput* pin_input = furi_alloc(sizeof(DesktopViewPinInput));
|
||||
DesktopViewPinInput* pin_input = malloc(sizeof(DesktopViewPinInput));
|
||||
pin_input->view = view_alloc();
|
||||
view_allocate_model(pin_input->view, ViewModelTypeLocking, sizeof(DesktopViewPinInputModel));
|
||||
view_set_context(pin_input->view, pin_input);
|
||||
|
@@ -57,7 +57,7 @@ void desktop_view_pin_done_set_callback(
|
||||
}
|
||||
|
||||
DesktopViewPinSetupDone* desktop_view_pin_done_alloc() {
|
||||
DesktopViewPinSetupDone* view = furi_alloc(sizeof(DesktopViewPinSetupDone));
|
||||
DesktopViewPinSetupDone* view = malloc(sizeof(DesktopViewPinSetupDone));
|
||||
view->view = view_alloc();
|
||||
view_allocate_model(view->view, ViewModelTypeLockFree, 1);
|
||||
view_set_context(view->view, view);
|
||||
|
@@ -77,7 +77,7 @@ void desktop_view_pin_timeout_free(DesktopViewPinTimeout* instance) {
|
||||
}
|
||||
|
||||
DesktopViewPinTimeout* desktop_view_pin_timeout_alloc(void) {
|
||||
DesktopViewPinTimeout* instance = furi_alloc(sizeof(DesktopViewPinTimeout));
|
||||
DesktopViewPinTimeout* instance = malloc(sizeof(DesktopViewPinTimeout));
|
||||
instance->timer = xTimerCreate(
|
||||
NULL, pdMS_TO_TICKS(1000), pdTRUE, instance, desktop_view_pin_timeout_timer_callback);
|
||||
|
||||
|
Reference in New Issue
Block a user