From 09fb1e60e3afdb6891bfead1dbeb707f4539c3e0 Mon Sep 17 00:00:00 2001 From: Mike Fellows Date: Sat, 30 May 2020 13:05:25 -0700 Subject: [PATCH] Fix visual studio compile errors in lv_anim code unary negation operator was being applied to an usigned int in three places. I'm not sure what the other compilers are doing to accept the current code , but I have cast the unsigned ints to a signed one before applying the unary operator. --- src/lv_misc/lv_anim.c | 4 ++-- src/lv_misc/lv_anim.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_misc/lv_anim.c b/src/lv_misc/lv_anim.c index 7f5be923f..0774bc4f9 100644 --- a/src/lv_misc/lv_anim.c +++ b/src/lv_misc/lv_anim.c @@ -529,11 +529,11 @@ static bool anim_ready_handler(lv_anim_t * a) } /*If the animation is not deleted then restart it*/ else { - a->act_time = -a->repeat_delay; /*Restart the animation*/ + a->act_time = -(int32_t)(a->repeat_delay); /*Restart the animation*/ /*Swap the start and end values in play back mode*/ if(a->playback_time != 0) { /*If now turning back use the 'playback_pause*/ - if(a->playback_now == 0) a->act_time = -a->playback_delay; + if(a->playback_now == 0) a->act_time = -(int32_t)(a->playback_delay); /*Toggle the play back state*/ a->playback_now = a->playback_now == 0 ? 1 : 0; diff --git a/src/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h index a73434c6f..a73c1e5db 100644 --- a/src/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -160,7 +160,7 @@ static inline void lv_anim_set_time(lv_anim_t * a, uint32_t duration) */ static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay) { - a->act_time = (int32_t)(-delay); + a->act_time = -(int32_t)(delay); } /**