mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 04:41:26 +04:00
Api Symbols: replace asserts with checks (#3507)
* Api Symbols: replace asserts with checks * Api Symbols: replace asserts with checks part 2 * Update no args function signatures with void, to help compiler to track incorrect usage * More unavoidable void * Update PVS config and code to make it happy * Format sources * nfc: fix checks * dead code cleanup & include fixes Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
@@ -4,18 +4,22 @@
|
||||
#include <furi.h>
|
||||
|
||||
IconAnimation* icon_animation_alloc(const Icon* icon) {
|
||||
furi_assert(icon);
|
||||
furi_check(icon);
|
||||
|
||||
IconAnimation* instance = malloc(sizeof(IconAnimation));
|
||||
instance->icon = icon;
|
||||
instance->timer =
|
||||
furi_timer_alloc(icon_animation_timer_callback, FuriTimerTypePeriodic, instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void icon_animation_free(IconAnimation* instance) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
icon_animation_stop(instance);
|
||||
furi_timer_free(instance->timer);
|
||||
|
||||
free(instance);
|
||||
}
|
||||
|
||||
@@ -23,7 +27,8 @@ void icon_animation_set_update_callback(
|
||||
IconAnimation* instance,
|
||||
IconAnimationCallback callback,
|
||||
void* context) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
instance->callback = callback;
|
||||
instance->callback_context = context;
|
||||
}
|
||||
@@ -51,17 +56,20 @@ void icon_animation_timer_callback(void* context) {
|
||||
}
|
||||
|
||||
uint8_t icon_animation_get_width(const IconAnimation* instance) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
return instance->icon->width;
|
||||
}
|
||||
|
||||
uint8_t icon_animation_get_height(const IconAnimation* instance) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
return instance->icon->height;
|
||||
}
|
||||
|
||||
void icon_animation_start(IconAnimation* instance) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
if(!instance->animating) {
|
||||
instance->animating = true;
|
||||
furi_assert(instance->icon->frame_rate);
|
||||
@@ -73,7 +81,8 @@ void icon_animation_start(IconAnimation* instance) {
|
||||
}
|
||||
|
||||
void icon_animation_stop(IconAnimation* instance) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
if(instance->animating) {
|
||||
instance->animating = false;
|
||||
furi_timer_stop(instance->timer);
|
||||
@@ -82,6 +91,7 @@ void icon_animation_stop(IconAnimation* instance) {
|
||||
}
|
||||
|
||||
bool icon_animation_is_last_frame(const IconAnimation* instance) {
|
||||
furi_assert(instance);
|
||||
furi_check(instance);
|
||||
|
||||
return instance->icon->frame_count - instance->frame <= 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user