jaehyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9f63fac2d2df7689f3ce7b8a542d36c46cf64689

commit 9f63fac2d2df7689f3ce7b8a542d36c46cf64689
Author: Woochan Lee <wc0917....@samsung.com>
Date:   Tue Feb 27 20:01:22 2018 +0900

    elm_datetime: Handle wrong param case for legacy.
    
    Summary:
    This wrapper didn't consider wrong param given case.
    
    @fix
    
    Test Plan: elementary_test -> elm_datetime sample.
    
    Reviewers: cedric, woohyun, Jaehyun_Cho
    
    Reviewed By: Jaehyun_Cho
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D5825
---
 src/lib/elementary/elm_datetime.c | 56 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 50 insertions(+), 6 deletions(-)

diff --git a/src/lib/elementary/elm_datetime.c 
b/src/lib/elementary/elm_datetime.c
index b857971e0d..ce61668667 100644
--- a/src/lib/elementary/elm_datetime.c
+++ b/src/lib/elementary/elm_datetime.c
@@ -46,12 +46,16 @@ EAPI void
 elm_datetime_format_set(Evas_Object *obj,
                         const char *fmt)
 {
+   EINA_SAFETY_ON_NULL_RETURN(obj);
+
    efl_ui_clock_format_set(obj, fmt);
 }
 
 EAPI const char *
 elm_datetime_format_get(const Evas_Object *obj)
 {
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+
    return efl_ui_clock_format_get(obj);
 }
 
@@ -88,65 +92,105 @@ adjust_field_type(Elm_Datetime_Field_Type type)
 EAPI void
 elm_datetime_field_limit_set(Evas_Object *obj, Elm_Datetime_Field_Type type, 
int min, int max)
 {
+   EINA_SAFETY_ON_NULL_RETURN(obj);
+
+   if ((type < ELM_DATETIME_YEAR) || (type >= ELM_DATETIME_AMPM)) return;
+
    efl_ui_clock_field_limit_set(obj, adjust_field_type(type), min, max);
 }
 
 EAPI void
 elm_datetime_field_limit_get(const Evas_Object *obj, Elm_Datetime_Field_Type 
fieldtype, int *min, int *max)
 {
+   EINA_SAFETY_ON_NULL_RETURN(obj);
+
+   if ((fieldtype < ELM_DATETIME_YEAR) || (fieldtype >= ELM_DATETIME_AMPM)) 
return;
+
    efl_ui_clock_field_limit_get(obj, adjust_field_type(fieldtype), min, max);
 }
 
 EAPI Eina_Bool
 elm_datetime_value_min_set(Evas_Object *obj, const Efl_Time *mintime)
 {
-   if (mintime) efl_ui_clock_time_min_set(obj, *mintime);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(mintime, EINA_FALSE);
+
+   efl_ui_clock_time_min_set(obj, *mintime);
+
    return EINA_TRUE;
 }
 
 EAPI Eina_Bool
 elm_datetime_value_min_get(const Evas_Object *obj, Efl_Time *mintime)
 {
-   if (mintime) *mintime = efl_ui_clock_time_min_get(obj);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(mintime, EINA_FALSE);
+
+   *mintime = efl_ui_clock_time_min_get(obj);
+
    return EINA_TRUE;
 }
 
 EAPI Eina_Bool
 elm_datetime_value_set(Evas_Object *obj, const Efl_Time *newtime)
 {
-   if (newtime) efl_ui_clock_time_set(obj, *newtime);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(newtime, EINA_FALSE);
+
+   efl_ui_clock_time_set(obj, *newtime);
+
    return EINA_TRUE;
 }
 
 EAPI Eina_Bool
 elm_datetime_value_get(const Evas_Object *obj, Efl_Time *currtime)
 {
-   if (currtime) *currtime = efl_ui_clock_time_get(obj);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(currtime, EINA_FALSE);
+
+   *currtime = efl_ui_clock_time_get(obj);
+
    return EINA_TRUE;
 }
 
 EAPI void
 elm_datetime_field_visible_set(Evas_Object *obj, Elm_Datetime_Field_Type 
fieldtype, Eina_Bool visible)
 {
+   EINA_SAFETY_ON_NULL_RETURN(obj);
+
+   if ((fieldtype < ELM_DATETIME_YEAR) || (fieldtype > ELM_DATETIME_AMPM)) 
return;
+
    efl_ui_clock_field_visible_set(obj, adjust_field_type(fieldtype), visible);
 }
 
 EAPI Eina_Bool elm_datetime_field_visible_get(const Evas_Object *obj, 
Elm_Datetime_Field_Type fieldtype)
 {
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+
+   if ((fieldtype < ELM_DATETIME_YEAR) || (fieldtype > ELM_DATETIME_AMPM)) 
return EINA_FALSE;
+
    return efl_ui_clock_field_visible_get(obj, adjust_field_type(fieldtype));
 }
 
 EAPI Eina_Bool
 elm_datetime_value_max_set(Evas_Object *obj, const Efl_Time *maxtime)
 {
-   if (maxtime) efl_ui_clock_time_max_set(obj, *maxtime);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(maxtime, EINA_FALSE);
+
+   efl_ui_clock_time_max_set(obj, *maxtime);
+
    return EINA_TRUE;
 }
 
 EAPI Eina_Bool
 elm_datetime_value_max_get(const Evas_Object *obj, Efl_Time *maxtime)
 {
-   if (maxtime) *maxtime = efl_ui_clock_time_max_get(obj);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(maxtime, EINA_FALSE);
+
+   *maxtime = efl_ui_clock_time_max_get(obj);
+
    return EINA_TRUE;
 }
 

-- 


Reply via email to