From c54eb7b6f2737b5c4ff8c549e5c7a5bf0a678d2b Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 19 May 2014 19:19:12 +0100 Subject: [PATCH] Tidying up lots of warnings and fixing issues along the way --- src/bin/edi_build_main.c | 12 +++++++----- src/bin/edi_consolepanel.c | 39 +++++++++++--------------------------- src/bin/edi_filepanel.c | 25 ++++++++++++------------ src/bin/edi_mainview.c | 7 +++---- src/lib/edi.c | 4 ++-- 5 files changed, 36 insertions(+), 51 deletions(-) diff --git a/src/bin/edi_build_main.c b/src/bin/edi_build_main.c index 9cc4282..50a887a 100644 --- a/src/bin/edi_build_main.c +++ b/src/bin/edi_build_main.c @@ -18,10 +18,12 @@ #define COPYRIGHT "Copyright © 2014 Andy Williams and various contributors (see AUTHORS)." static Eina_Bool -exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev) +_exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info) { + Ecore_Exe_Event_Data *ev; Ecore_Exe_Event_Data_Line *el; + ev = event_info; for (el = ev->lines; el && el->line; el++) fprintf(stdout, "%s\n", el->line); @@ -29,7 +31,7 @@ exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev) } static Eina_Bool -exe_del(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev) +_exe_del(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info EINA_UNUSED) { ecore_main_loop_quit(); @@ -100,9 +102,9 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED) goto exit; } - ecore_event_handler_add(ECORE_EXE_EVENT_DATA, exe_data, NULL); - ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, exe_data, NULL); - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, exe_del, NULL); + ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _exe_data, NULL); + ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _exe_data, NULL); + ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _exe_del, NULL); edi_builder_build(); ecore_main_loop_begin(); diff --git a/src/bin/edi_consolepanel.c b/src/bin/edi_consolepanel.c index fd5a312..c8a00e4 100644 --- a/src/bin/edi_consolepanel.c +++ b/src/bin/edi_consolepanel.c @@ -43,7 +43,7 @@ static Eina_Bool _startswith_location(const char *line) } static void _edi_consolepanel_clicked_cb(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, Evas_Event_Mouse_Down *ev) + Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Edi_Path_Options *options; @@ -71,7 +71,8 @@ static void _edi_consolepanel_parse_directory(const char *line) static void _edi_consolepanel_append_line_type(const char *line, Eina_Bool err) { Evas_Object *txt, *icon, *box; - const char *buf, *pos, *file, *path, *type = NULL, *cursor = NULL; + char *buf, *path; + const char *pos, *file, *type = NULL, *cursor = NULL; int length; txt = elm_label_add(_console_box); @@ -158,33 +159,13 @@ void edi_consolepanel_clear() elm_box_clear(_console_box); } -static Eina_Bool _stdin_handler_cb(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED) -{ - char message[BUFFER_SIZE]; - - if (!fgets(message, BUFFER_SIZE, stdin)) - return ECORE_CALLBACK_RENEW; - - edi_consolepanel_append_line(message); - return ECORE_CALLBACK_RENEW; -} - -static Eina_Bool _stderr_handler_cb(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED) -{ - char message[BUFFER_SIZE]; - - if (!fgets(message, BUFFER_SIZE, stderr)) - return ECORE_CALLBACK_RENEW; - - edi_consolepanel_append_error_line(message); - return ECORE_CALLBACK_RENEW; -} - static Eina_Bool -exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev) +_exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info) { + Ecore_Exe_Event_Data *ev; Ecore_Exe_Event_Data_Line *el; + ev = event_info; for (el = ev->lines; el && el->line; el++) edi_consolepanel_append_line(el->line); @@ -192,10 +173,12 @@ exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev) } static Eina_Bool -exe_error(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Data *ev) +_exe_error(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info) { + Ecore_Exe_Event_Data *ev; Ecore_Exe_Event_Data_Line *el; + ev = event_info; for (el = ev->lines; el && el->line; el++) edi_consolepanel_append_error_line(el->line); @@ -221,6 +204,6 @@ void edi_consolepanel_add(Evas_Object *parent) elm_object_content_set(parent, scroll); - ecore_event_handler_add(ECORE_EXE_EVENT_DATA, exe_data, NULL); - ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, exe_error, NULL); + ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _exe_data, NULL); + ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _exe_error, NULL); } diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c index f9cda6c..3ae1568 100644 --- a/src/bin/edi_filepanel.c +++ b/src/bin/edi_filepanel.c @@ -23,7 +23,7 @@ static void _populate(Evas_Object *obj, const char *path, Elm_Object_Item *parent_it, const char *selected); static void -_item_menu_open_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +_item_menu_open_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { if (ecore_file_is_dir(_menu_cb_path)) @@ -33,7 +33,7 @@ _item_menu_open_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNUSED } static void -_item_menu_open_window_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +_item_menu_open_window_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { if (ecore_file_is_dir(_menu_cb_path)) @@ -43,7 +43,7 @@ _item_menu_open_window_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA } static void -_item_menu_xdgopen_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +_item_menu_xdgopen_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { int pid = fork(); @@ -56,14 +56,14 @@ _item_menu_xdgopen_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNU } static void -_item_menu_open_as_text_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +_item_menu_open_as_text_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { _open_cb(_menu_cb_path, "text", EINA_FALSE); } static void -_item_menu_open_as_image_cb(Elm_Object_Item *it EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +_item_menu_open_as_image_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { _open_cb(_menu_cb_path, "image", EINA_FALSE); @@ -97,11 +97,13 @@ _item_menu_create(Evas_Object *win) static void _item_clicked_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, - Evas_Event_Mouse_Down *ev) + void *event_info) { + Evas_Event_Mouse_Down *ev; Elm_Object_Item *it; const char *path; + ev = event_info; if (ev->button != 3) return; it = elm_genlist_at_xy_item_get(obj, ev->output.x, ev->output.y, NULL); @@ -134,7 +136,7 @@ _content_get(void *data, Evas_Object *obj, const char *source) iconpath = efreet_mime_type_icon_get(data, "hicolor", 128); if (iconpath) - elm_icon_file_set(ic, iconpath, NULL); + elm_image_file_set(ic, iconpath, NULL); else elm_icon_standard_set(ic, "file"); @@ -146,7 +148,7 @@ _content_get(void *data, Evas_Object *obj, const char *source) } static void -_item_del(void *data, Evas_Object *obj) +_item_del(void *data, Evas_Object *obj EINA_UNUSED) { eina_stringshare_del(data); } @@ -161,7 +163,7 @@ _item_sel(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED } static Evas_Object * -_content_dir_get(void *data, Evas_Object *obj, const char *source) +_content_dir_get(void *data EINA_UNUSED, Evas_Object *obj, const char *source) { if (!strcmp(source, "elm.swallow.icon")) { @@ -177,8 +179,7 @@ _content_dir_get(void *data, Evas_Object *obj, const char *source) } static Eina_Bool -_ls_filter_cb(void *data, - Eio_File *handler EINA_UNUSED, +_ls_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info) { return info->path[info->name_start] != '.'; @@ -297,7 +298,7 @@ _ls_done_cb(void *data, Eio_File *handler EINA_UNUSED) } static void -_ls_error_cb(void *data, Eio_File *handler, int error EINA_UNUSED) +_ls_error_cb(void *data, Eio_File *handler EINA_UNUSED, int error EINA_UNUSED) { Listing_Request *lreq = data; diff --git a/src/bin/edi_mainview.c b/src/bin/edi_mainview.c index fde5b8e..5d02a01 100644 --- a/src/bin/edi_mainview.c +++ b/src/bin/edi_mainview.c @@ -28,7 +28,7 @@ edi_mainview_item_prev() { Eina_List *item; Elm_Object_Item *current; - Edi_Mainview_Item *it, *prev; + Edi_Mainview_Item *it, *prev = NULL; current = elm_naviframe_top_item_get(nf); @@ -102,7 +102,7 @@ _get_item_for_path(const char *path) } static Edi_Mainview_Item * -_edi_mainview_item_add(const char *path, Elm_Object_Item *tab, Evas_Object *view, +_edi_mainview_item_add(const char *path, Elm_Object_Item *tab, Elm_Object_Item *view, Evas_Object *win) { Edi_Mainview_Item *item; @@ -162,7 +162,6 @@ _edi_mainview_item_tab_add(Edi_Path_Options *options) if (options->line) edi_mainview_goto(options->line); - it = elm_naviframe_item_simple_push(nf, content); elm_naviframe_item_style_set(it, "overlap"); tab = elm_toolbar_item_append(tb, NULL, basename(options->path), _promote, it); @@ -250,7 +249,7 @@ _edi_mainview_choose_type_close_cb(void *data EINA_UNUSED, } static void -_edi_mainview_choose_type(Evas_Object *parent, Edi_Path_Options *options, void *cb) +_edi_mainview_choose_type(Evas_Object *parent EINA_UNUSED, Edi_Path_Options *options, void *cb) { Evas_Object *popup, *cancel, *icon; diff --git a/src/lib/edi.c b/src/lib/edi.c index b2655aa..7d667ed 100644 --- a/src/lib/edi.c +++ b/src/lib/edi.c @@ -76,7 +76,7 @@ edi_project_get() EAPI const char * edi_project_file_path_get(const char *file) { - const char *path; + char *path; int len; len = strlen(file) + strlen(edi_project_get()) + 2; @@ -95,6 +95,6 @@ edi_project_file_exists(const char *file) path = edi_project_file_path_get(file); exists = ecore_file_exists(path); - free(path); + free((void *)path); return exists; }