From: Christopher Michael Date: Fri, 21 May 2010 19:26:57 +0000 (+0000) Subject: Proper fix for compiler warnings by adding const to the _get functions X-Git-Tag: v1.0.0~4588 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=908be9b265a3014a9ae1f2ded98a61b1ed50eacf;p=platform%2Fupstream%2Felementary.git Proper fix for compiler warnings by adding const to the _get functions (thanks k-s). Fix formatting & remove some whitespace. NB: Please take notice, do not format if statements like this: if (val && !val2). You will get spanked...hard :P Proper if formatting should be: if ((val) && (!val2)) This avoids potential evaluation errors (as was recently seen in ecore_con). SVN revision: 49111 --- diff --git a/src/edje_externals/elm_fileselector_button.c b/src/edje_externals/elm_fileselector_button.c index d898d36..bfa0650 100644 --- a/src/edje_externals/elm_fileselector_button.c +++ b/src/edje_externals/elm_fileselector_button.c @@ -139,7 +139,7 @@ external_fileselector_button_param_get(void *data __UNUSED__, const Evas_Object { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) { - param->i = elm_fileselector_button_is_save_get((Evas_Object *)obj); + param->i = elm_fileselector_button_is_save_get(obj); return EINA_TRUE; } } @@ -147,7 +147,7 @@ external_fileselector_button_param_get(void *data __UNUSED__, const Evas_Object { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) { - param->i = elm_fileselector_button_folder_only_get((Evas_Object *)obj); + param->i = elm_fileselector_button_folder_only_get(obj); return EINA_TRUE; } } @@ -155,7 +155,7 @@ external_fileselector_button_param_get(void *data __UNUSED__, const Evas_Object { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) { - param->i = elm_fileselector_button_expandable_get((Evas_Object *)obj); + param->i = elm_fileselector_button_expandable_get(obj); return EINA_TRUE; } } @@ -163,7 +163,7 @@ external_fileselector_button_param_get(void *data __UNUSED__, const Evas_Object { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) { - param->i = elm_fileselector_button_inwin_mode_get((Evas_Object *)obj); + param->i = elm_fileselector_button_inwin_mode_get(obj); return EINA_TRUE; } } diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 13b9f71..5ad9af4 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -437,19 +437,19 @@ extern "C" { EAPI void elm_fileselector_button_icon_set(Evas_Object *obj, Evas_Object *icon); EAPI Evas_Object *elm_fileselector_button_icon_get(const Evas_Object *obj); EAPI void elm_fileselector_button_window_title_set(Evas_Object *obj, const char *title); - EAPI const char *elm_fileselector_button_window_title_get(Evas_Object *obj); + EAPI const char *elm_fileselector_button_window_title_get(const Evas_Object *obj); EAPI void elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height); - EAPI void elm_fileselector_button_window_size_get(Evas_Object *obj, Evas_Coord *width, Evas_Coord *height); + EAPI void elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height); EAPI void elm_fileselector_button_path_set(Evas_Object *obj, const char *path); - EAPI const char *elm_fileselector_button_path_get(Evas_Object *obj); + EAPI const char *elm_fileselector_button_path_get(const Evas_Object *obj); EAPI void elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value); - EAPI Eina_Bool elm_fileselector_button_expandable_get(Evas_Object *obj); + EAPI Eina_Bool elm_fileselector_button_expandable_get(const Evas_Object *obj); EAPI void elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value); - EAPI Eina_Bool elm_fileselector_button_folder_only_get(Evas_Object *obj); + EAPI Eina_Bool elm_fileselector_button_folder_only_get(const Evas_Object *obj); EAPI void elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value); - EAPI Eina_Bool elm_fileselector_button_is_save_get(Evas_Object *obj); + EAPI Eina_Bool elm_fileselector_button_is_save_get(const Evas_Object *obj); EAPI void elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value); - EAPI Eina_Bool elm_fileselector_button_inwin_mode_get(Evas_Object *obj); + EAPI Eina_Bool elm_fileselector_button_inwin_mode_get(const Evas_Object *obj); EAPI void elm_fileselector_button_selected_set(Evas_Object *obj, const char *path); EAPI const char *elm_fileselector_button_selected_get(const Evas_Object *obj); diff --git a/src/lib/elc_fileselector_button.c b/src/lib/elc_fileselector_button.c index f753588..08ba775 100644 --- a/src/lib/elc_fileselector_button.c +++ b/src/lib/elc_fileselector_button.c @@ -45,11 +45,12 @@ static void _selection_done(void *data, Evas_Object *obj, void *event_info); static const char SIG_CLICKED[] = "clicked"; static const char SIG_UNPRESSED[] = "unpressed"; static const char SIG_FILE_CHOSEN[] = "file,chosen"; -static const Evas_Smart_Cb_Description _signals[] = { - {SIG_CLICKED, ""}, - {SIG_UNPRESSED, ""}, - {SIG_FILE_CHOSEN, "s"}, - {NULL, NULL} +static const Evas_Smart_Cb_Description _signals[] = +{ + {SIG_CLICKED, ""}, + {SIG_UNPRESSED, ""}, + {SIG_FILE_CHOSEN, "s"}, + {NULL, NULL} }; static void @@ -107,8 +108,8 @@ _theme_hook(Evas_Object *obj) edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm"); edje_object_part_text_set(wd->btn, "elm.text", wd->btn_label); edje_object_message_signal_process(wd->btn); - edje_object_scale_set(wd->btn, elm_widget_scale_get(obj) * \ - _elm_config->scale); + edje_object_scale_set(wd->btn, + elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } @@ -167,7 +168,6 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) static void _signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) { - Widget_Data *wd = elm_widget_data_get(data); if (!wd) return; @@ -245,7 +245,7 @@ _fs_launch(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSE } } - if (!wd->inwin_mode || win_fallback) + if ((!wd->inwin_mode) || (win_fallback)) { win = _new_window_add(wd); evas_object_data_set(fs_btn, "win", win); @@ -262,7 +262,7 @@ _fs_launch(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSE evas_object_smart_callback_add(wd->fs, "done", _selection_done, fs_btn); evas_object_show(wd->fs); - if (wd->inwin_mode && !win_fallback) + if ((wd->inwin_mode) && (!win_fallback)) { elm_win_inwin_content_set(iw, wd->fs); elm_win_inwin_activate(iw); @@ -415,7 +415,6 @@ elm_fileselector_button_selected_set(Evas_Object *obj, const char *path) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - eina_stringshare_replace(&wd->fsd.path, path); } @@ -466,7 +465,7 @@ elm_fileselector_button_window_title_set(Evas_Object *obj, const char *title) * @ingroup File_Selector_Button */ EAPI const char * -elm_fileselector_button_window_title_get(Evas_Object *obj) +elm_fileselector_button_window_title_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); @@ -492,7 +491,6 @@ elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->w = width; wd->h = height; } @@ -507,12 +505,11 @@ elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas * @ingroup File_Selector_Button */ EAPI void -elm_fileselector_button_window_size_get(Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) +elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - if (width) *width = wd->w; if (height) *height = wd->h; } @@ -544,7 +541,7 @@ elm_fileselector_button_path_set(Evas_Object *obj, const char *path) * @ingroup File_Selector_Button */ EAPI const char * -elm_fileselector_button_path_get(Evas_Object *obj) +elm_fileselector_button_path_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); @@ -569,7 +566,6 @@ elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->fsd.expandable = value; } @@ -582,12 +578,11 @@ elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value) * @ingroup File_Selector_Button */ EAPI Eina_Bool -elm_fileselector_button_expandable_get(Evas_Object *obj) +elm_fileselector_button_expandable_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - return wd->fsd.expandable; } @@ -606,7 +601,6 @@ elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->fsd.folder_only = value; } @@ -619,12 +613,11 @@ elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value) * @ingroup File_Selector_Button */ EAPI Eina_Bool -elm_fileselector_button_folder_only_get(Evas_Object *obj) +elm_fileselector_button_folder_only_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - return wd->fsd.folder_only; } @@ -643,7 +636,6 @@ elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->fsd.is_save = value; } @@ -656,12 +648,11 @@ elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value) * @ingroup File_Selector_Button */ EAPI Eina_Bool -elm_fileselector_button_is_save_get(Evas_Object *obj) +elm_fileselector_button_is_save_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - return wd->fsd.is_save; } @@ -681,7 +672,6 @@ elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value) ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->inwin_mode = value; } @@ -694,12 +684,11 @@ elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value) * @ingroup File_Selector_Button */ EAPI Eina_Bool -elm_fileselector_button_inwin_mode_get(Evas_Object *obj) +elm_fileselector_button_inwin_mode_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - return wd->inwin_mode; }