clang: Fix warnings and compilation errors

enventor wouldn't compile with clang. Also, it would print
a lot of warnings.
This commit is contained in:
Jean-Philippe Andre 2016-08-10 15:05:13 +09:00
parent b5e27c58d6
commit 3af6ede5e5
17 changed files with 37 additions and 32 deletions

View File

@ -85,7 +85,7 @@ set_console_error_msg(Evas_Object *console, const char *src)
free(color_msg); free(color_msg);
} }
static char* char*
error_msg_syntax_color_set(char *text) error_msg_syntax_color_set(char *text)
{ {
char *color_error_msg; char *color_error_msg;

View File

@ -132,7 +132,7 @@ file_genlist_item_append(brows_file *file, Elm_Object_Item *parent_it,
//Keep Main Item //Keep Main Item
if (file->main) if (file->main)
{ {
brows_data *bd = g_bd; bd = g_bd;
bd->main_it = file->it; bd->main_it = file->it;
} }
@ -261,7 +261,7 @@ gl_contract_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
} }
static void static void
gl_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info) gl_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
brows_data *bd = g_bd; brows_data *bd = g_bd;
if (!bd) return; if (!bd) return;
@ -300,7 +300,7 @@ gl_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
} }
static void static void
gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info) gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
brows_data *bd = g_bd; brows_data *bd = g_bd;
if (!bd) return; if (!bd) return;

View File

@ -289,7 +289,6 @@ file_mgr_main_file_set(const char *path)
} }
} }
Eina_List *list;
Enventor_Item *it; Enventor_Item *it;
//If this file is already openend with sub file, remove it. //If this file is already openend with sub file, remove it.
@ -457,4 +456,5 @@ file_mgr_file_open(const char *file_path)
//This selected file hasn't been opened yet, so let's open this file newly. //This selected file hasn't been opened yet, so let's open this file newly.
file_mgr_sub_file_add(file_path, EINA_TRUE); file_mgr_sub_file_add(file_path, EINA_TRUE);
return EINA_TRUE;
} }

View File

@ -41,7 +41,7 @@ win_moved_cb(void *data EINA_UNUSED, Evas_Object *obj,
} }
static void static void
list_item_selected_cb(void *data, Evas_Object *obj, void *event_info) list_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{ {
Evas_Object *layout; Evas_Object *layout;
Evas_Object *label; Evas_Object *label;
@ -100,7 +100,7 @@ list_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
} }
static void static void
button_clicked_cb(void *data, Evas_Object *obj, void *event_info) button_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{ {
Evas_Object *layout = g_layout; Evas_Object *layout = g_layout;
Evas_Object *list = elm_object_part_content_get(layout, "swallow_list"); Evas_Object *list = elm_object_part_content_get(layout, "swallow_list");

View File

@ -1957,7 +1957,6 @@ info_text_init(live_data *ld)
int i; int i;
Evas *e = evas_object_evas_get(ld->layout); Evas *e = evas_object_evas_get(ld->layout);
double scale = elm_config_scale_get(); double scale = elm_config_scale_get();
Evas_Object *view_obj = view_obj_get(ld);
for (i = 0; i < Info_Text_Cnt; i++) for (i = 0; i < Info_Text_Cnt; i++)
{ {
Evas_Object *text = evas_object_text_add(e); Evas_Object *text = evas_object_text_add(e);

View File

@ -473,7 +473,7 @@ enventor_live_view_resized_cb(void *data EINA_UNUSED,
} }
static void static void
enventor_live_view_loaded_cb(void *data EINA_UNUSED, Enventor_Object *obj, enventor_live_view_loaded_cb(void *data EINA_UNUSED, Enventor_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
base_edc_navigator_group_update(); base_edc_navigator_group_update();
@ -556,8 +556,8 @@ enventor_ctxpopup_dismissed_cb(void *data EINA_UNUSED, Enventor_Object *obj,
} }
static void static void
enventor_file_open_requested_cb(void *data EINA_UNUSED, Enventor_Object *obj, enventor_file_open_requested_cb(void *data EINA_UNUSED, Enventor_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED) void *event_info)
{ {
const char *file_name = event_info; const char *file_name = event_info;
file_mgr_file_open(file_name); file_mgr_file_open(file_name);

View File

@ -2,4 +2,4 @@
Evas_Object *console_create(Evas_Object *parent); Evas_Object *console_create(Evas_Object *parent);
void console_text_set(Evas_Object *console, const char *text); void console_text_set(Evas_Object *console, const char *text);
static char *error_msg_syntax_color_set(char *text); char *error_msg_syntax_color_set(char *text);

View File

@ -738,6 +738,7 @@ entry_changed_cb(void *data, Evas_Object *obj EINA_UNUSED,
if (info->change.del.content[0] != ' ') if (info->change.del.content[0] != ' ')
{ {
entry_anchor_off(ad); entry_anchor_off(ad);
/* FIXME: abs() shouldn't be used here (size_t is unsigned) */
int cnt = abs(info->change.del.end - info->change.del.start); int cnt = abs(info->change.del.end - info->change.del.start);
pop_char(ad, cnt); pop_char(ad, cnt);
} }

View File

@ -721,7 +721,7 @@ candidate_reset(ctxpopup_data *ctxdata)
colorselector_changed_cb(ctxdata, ctxdata->colorselector, NULL); colorselector_changed_cb(ctxdata, ctxdata->colorselector, NULL);
} }
//Toggle Candidate //Toggle Candidate
else if ((attr->type == ATTR_VALUE_BOOLEAN)) else if (attr->type == ATTR_VALUE_BOOLEAN)
{ {
Eina_List *l; Eina_List *l;
Evas_Object *toggle; Evas_Object *toggle;

View File

@ -61,7 +61,7 @@ dummy_objs_update(dummy_obj *dummy)
if (!strcmp(po->name, part_name)) if (!strcmp(po->name, part_name))
{ {
type = edje_edit_part_type_get(dummy->layout, part_name); type = edje_edit_part_type_get(dummy->layout, part_name);
if ((type == EDJE_PART_TYPE_SWALLOW)) if (type == EDJE_PART_TYPE_SWALLOW)
removed = EINA_FALSE; removed = EINA_FALSE;
break; break;
} }
@ -87,7 +87,7 @@ dummy_objs_update(dummy_obj *dummy)
if (!strcmp(po->name, part_name)) if (!strcmp(po->name, part_name))
{ {
type = edje_edit_part_type_get(dummy->layout, part_name); type = edje_edit_part_type_get(dummy->layout, part_name);
if ((type == EDJE_PART_TYPE_SPACER)) if (type == EDJE_PART_TYPE_SPACER)
removed = EINA_FALSE; removed = EINA_FALSE;
break; break;
} }

View File

@ -984,7 +984,7 @@ edit_link_activate(edit_data *ed)
//Case 1. File Link? //Case 1. File Link?
char *file_link = utf8; char *file_link = utf8;
if (file_link = strstr(utf8, "#include ")) if ((file_link = strstr(utf8, "#include ")) != NULL)
{ {
file_link += 9; //strlen("#include ")) file_link += 9; //strlen("#include "))
char *name_begin = strstr(utf8, "\""); char *name_begin = strstr(utf8, "\"");

View File

@ -1855,7 +1855,7 @@ parser_styles_pos_get(const Evas_Object *entry, int *ret)
Eina_Bool Eina_Bool
parser_is_image_name(const Evas_Object *entry, const char *str) parser_is_image_name(const Evas_Object *entry, const char *str)
{ {
int start_pos, end_pos, i; int start_pos, end_pos = -1, i;
if (!parser_collections_block_pos_get(entry, "images", &start_pos)) if (!parser_collections_block_pos_get(entry, "images", &start_pos))
return EINA_FALSE; return EINA_FALSE;
@ -1870,6 +1870,8 @@ parser_is_image_name(const Evas_Object *entry, const char *str)
break; break;
} }
if (end_pos < 0) return EINA_FALSE;
char *candidate_str = alloca(end_pos - start_pos + 1); char *candidate_str = alloca(end_pos - start_pos + 1);
const char *src_str = elm_entry_markup_to_utf8(str); const char *src_str = elm_entry_markup_to_utf8(str);
strncpy(candidate_str, utf8 + start_pos, end_pos - start_pos); strncpy(candidate_str, utf8 + start_pos, end_pos - start_pos);
@ -1921,7 +1923,7 @@ parser_bracket_find(parser_data *pd, Evas_Object *entry,
} }
Eina_List * Eina_List *
parser_group_list_get(parser_data *pd, Evas_Object *entry) parser_group_list_get(parser_data *pd EINA_UNUSED, Evas_Object *entry)
{ {
const char *markup = elm_entry_entry_get(entry); const char *markup = elm_entry_entry_get(entry);
char *utf8 = elm_entry_markup_to_utf8(markup); char *utf8 = elm_entry_markup_to_utf8(markup);

View File

@ -3,6 +3,7 @@
#endif #endif
#define ELM_INTERNAL_API_ARGESFSDFEFC 1 #define ELM_INTERNAL_API_ARGESFSDFEFC 1
#define EFL_CANVAS_OBJECT_PROTECTED 1
#include <Enventor.h> #include <Enventor.h>
#include <Eio.h> #include <Eio.h>
@ -598,7 +599,7 @@ EOLIAN static Eina_Bool
_enventor_object_ctxpopup_visible_get(Eo *obj EINA_UNUSED, _enventor_object_ctxpopup_visible_get(Eo *obj EINA_UNUSED,
Enventor_Object_Data *pd) Enventor_Object_Data *pd)
{ {
if (!pd->focused_it) return; if (!pd->focused_it) return EINA_FALSE;
return edit_ctxpopup_visible_get(pd->focused_it->ed); return edit_ctxpopup_visible_get(pd->focused_it->ed);
} }
@ -1156,6 +1157,8 @@ enventor_item_del(Enventor_Item *it)
pd->sub_its = eina_list_remove(pd->sub_its, it); pd->sub_its = eina_list_remove(pd->sub_its, it);
free(it); free(it);
} }
return EINA_TRUE;
} }
EAPI Eina_Bool EAPI Eina_Bool

View File

@ -166,8 +166,7 @@ keyword_hierarchy_find(const char *text, const char *keyword_name)
if (!text) return NULL; if (!text) return NULL;
if (!keyword_name) return NULL; if (!keyword_name) return NULL;
Eina_List *keyword_hierarchy = eina_list_append(keyword_hierarchy, Eina_List *keyword_hierarchy = eina_list_append(NULL, strdup(keyword_name));
strdup(keyword_name));
//Check from the end of the text. //Check from the end of the text.
char *ptr = (char *)(text + ((strlen(text) - 1) * sizeof(char))); char *ptr = (char *)(text + ((strlen(text) - 1) * sizeof(char)));

View File

@ -510,19 +510,19 @@ macro_apply(Eina_Strbuf *strbuf, const char **src, int length, char **cur,
while (macro_end < (*src + length)) while (macro_end < (*src + length))
{ {
char *slash = strstr(macro_end, "\\"); char *slash = strstr(macro_end, "\\");
char *eol = strstr(macro_end, EOL); char *endeol = strstr(macro_end, EOL);
if ((!slash && eol) || if ((!slash && endeol) ||
((slash && eol) && (slash > eol))) ((slash && endeol) && (slash > endeol)))
{ {
macro_end = eol; macro_end = endeol;
break; break;
} }
if (!slash || !eol) break; if (!slash || !endeol) break;
if (eol < slash) break; if (endeol < slash) break;
macro_end = eol + 1; macro_end = endeol + 1;
} }
*cur = macro_end; *cur = macro_end;

View File

@ -642,7 +642,7 @@ indent_delete_apply(indent_data *id, const char *del, int cur_line)
while (len > 0) while (len > 0)
{ {
if ((utf8[(len - 1)] == ' ')) if (utf8[(len - 1)] == ' ')
{ {
eina_strbuf_append(diff, evas_textblock_cursor_content_get(cur)); eina_strbuf_append(diff, evas_textblock_cursor_content_get(cur));
evas_textblock_cursor_char_delete(cur); evas_textblock_cursor_char_delete(cur);

View File

@ -70,7 +70,6 @@ wireframes_objs_update(wireframes_obj *wireframes)
Evas_Object *o2 = Evas_Object *o2 =
elm_object_part_content_get(o, "elm.swallow.content"); elm_object_part_content_get(o, "elm.swallow.content");
if (!o2) goto end; if (!o2) goto end;
Evas *evas = evas_object_evas_get(scroller);
Evas_Coord part_lx = 0, part_ly = 0; Evas_Coord part_lx = 0, part_ly = 0;
evas_object_geometry_get(wireframes->layout, &part_lx, &part_ly, evas_object_geometry_get(wireframes->layout, &part_lx, &part_ly,
@ -115,6 +114,7 @@ end:
edje_edit_string_list_free(parts); edje_edit_string_list_free(parts);
} }
#if 0
static void static void
layout_geom_changed_cb(void *data, Evas *evas EINA_UNUSED, layout_geom_changed_cb(void *data, Evas *evas EINA_UNUSED,
Evas_Object *obj, void *ei EINA_UNUSED) Evas_Object *obj, void *ei EINA_UNUSED)
@ -135,6 +135,8 @@ layout_geom_changed_cb(void *data, Evas *evas EINA_UNUSED,
evas_object_move(po->obj, lx + x, ly + y); evas_object_move(po->obj, lx + x, ly + y);
} }
} }
#endif
static Eina_Bool static Eina_Bool
animator_cb(void *data) animator_cb(void *data)
{ {
@ -174,7 +176,6 @@ update_wireframe_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
//Update the wireframe of the part name. //Update the wireframe of the part name.
if (pobj) if (pobj)
{ {
Evas_Coord part_lx = 0, part_ly = 0;
Evas_Coord part_x = 0, part_y = 0, part_w = 0, part_h = 0; Evas_Coord part_x = 0, part_y = 0, part_w = 0, part_h = 0;
Evas_Object *part_obj = (Evas_Object *) Evas_Object *part_obj = (Evas_Object *)
@ -215,7 +216,7 @@ wireframes_callbacks_set(wireframes_obj *wireframes, Evas_Object *layout)
} }
static void static void
wireframes_callbacks_del(wireframes_obj *wireframes, Evas_Object *layout) wireframes_callbacks_del(wireframes_obj *wireframes EINA_UNUSED, Evas_Object *layout)
{ {
Eina_List *l = NULL; Eina_List *l = NULL;
Eina_Stringshare *part_name = NULL; Eina_Stringshare *part_name = NULL;