xartigas pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=92a4fab5d79f69dfea118f65f494bb014117b4f2

commit 92a4fab5d79f69dfea118f65f494bb014117b4f2
Author: Marcel Hollerbach <[email protected]>
Date:   Wed Oct 30 15:30:09 2019 +0100

    efl_canvas_animation: be more explicit with errors
    
    Summary:
    with this commit invalid values are not accepted silently anymore. But
    rather a error will be raised.
    Depends on D10350
    
    Reviewers: segfaultxavi, Jaehyun_Cho
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8288
    
    Differential Revision: https://phab.enlightenment.org/D10558
---
 src/lib/evas/canvas/efl_canvas_animation.c         | 10 ++++------
 src/lib/evas/canvas/efl_canvas_animation_types.eot |  3 ++-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/lib/evas/canvas/efl_canvas_animation.c 
b/src/lib/evas/canvas/efl_canvas_animation.c
index b8c7c99861..119384b5eb 100644
--- a/src/lib/evas/canvas/efl_canvas_animation.c
+++ b/src/lib/evas/canvas/efl_canvas_animation.c
@@ -38,9 +38,8 @@ _efl_canvas_animation_repeat_mode_set(Eo *eo_obj EINA_UNUSED,
                                Efl_Canvas_Animation_Data *pd,
                                Efl_Canvas_Animation_Repeat_Mode mode)
 {
-   if ((mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_RESTART) ||
-       (mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE))
-     pd->repeat_mode = mode;
+   EINA_SAFETY_ON_FALSE_RETURN(mode >= 0 && mode < 
EFL_CANVAS_ANIMATION_REPEAT_MODE_LAST);
+   pd->repeat_mode = mode;
 }
 
 EOLIAN static Efl_Canvas_Animation_Repeat_Mode
@@ -54,8 +53,7 @@ _efl_canvas_animation_repeat_count_set(Eo *eo_obj EINA_UNUSED,
                                 Efl_Canvas_Animation_Data *pd,
                                 int count)
 {
-   //EFL_ANIMATION_REPEAT_INFINITE repeats animation infinitely
-   if ((count < 0) && (count != EFL_ANIMATION_REPEAT_INFINITE)) return;
+   EINA_SAFETY_ON_FALSE_RETURN(count >= EFL_ANIMATION_REPEAT_INFINITE);
 
    pd->repeat_count = count;
 }
@@ -71,7 +69,7 @@ _efl_canvas_animation_start_delay_set(Eo *eo_obj EINA_UNUSED,
                                Efl_Canvas_Animation_Data *pd,
                                double sec)
 {
-   if (sec < 0.0) return;
+   EINA_SAFETY_ON_FALSE_RETURN(sec < 0.0);
 
    pd->start_delay_time = sec;
 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_types.eot 
b/src/lib/evas/canvas/efl_canvas_animation_types.eot
index 23e89aef0d..cfdda2d490 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_types.eot
+++ b/src/lib/evas/canvas/efl_canvas_animation_types.eot
@@ -8,5 +8,6 @@ enum @beta Efl.Canvas.Animation_Repeat_Mode
    [[Animation repeat mode]]
 
    restart = 0, [[Restart animation when the animation ends.]]
-   reverse      [[Reverse animation when the animation ends.]]
+   reverse = 1, [[Reverse animation when the animation ends.]]
+   last
 }

-- 


Reply via email to