From 303cec8cb6ec25c4b50530caa3fdc0e9a6ff194d Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Mon, 20 Apr 2009 11:10:06 +0300 Subject: [PATCH] Supress compiler warnings. Now able to compile project with make CFLAGS=-Werror --- edit/editcmd.c | 15 ++++++++++----- src/charsets.c | 8 ++++---- src/strutil.c | 2 +- src/util.c | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/edit/editcmd.c b/edit/editcmd.c index 4c4080357..6e65b7808 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -1489,6 +1489,7 @@ edit_find_string (long start, unsigned char *exp, int *len, long last_byte, edit int n = 0; gchar *tmp_exp1, *tmp_exp2; unsigned char *tmp_exp3; + char *tmp_exp4; gchar *c; for (p = 0; p < l; p++) /* count conversions... */ @@ -1512,10 +1513,12 @@ edit_find_string (long start, unsigned char *exp, int *len, long last_byte, edit buf[p - start] = *(*get_byte) (data, p); } else { tmp_exp3 = exp; + tmp_exp4 = (char *)tmp_exp3; + tmp_exp1 = tmp_exp2 = g_strdup((gchar *)exp); tmp_len = str_length((char *)exp); - while (str_tolower(tmp_exp1, &tmp_exp3, &tmp_len)) + while (str_tolower(tmp_exp1, (char **) &tmp_exp4, &tmp_len)) tmp_exp1+=str_length_char(tmp_exp1); g_free(tmp_exp2); @@ -1653,7 +1656,8 @@ edit_find_string (long start, unsigned char *exp, int *len, long last_byte, edit tmp_exp3 = exp; tmp_exp1 = tmp_exp2 = g_strdup((gchar *)exp); tmp_len = strlen((char *) exp); - while (str_tolower(tmp_exp1, &tmp_exp3, &tmp_len)) + tmp_exp4 = (char *) tmp_exp3; + while (str_tolower(tmp_exp1, &tmp_exp4, &tmp_len)) tmp_exp1+=str_length_char(tmp_exp1); g_free(tmp_exp2); @@ -3149,7 +3153,7 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int int start_x, start_y, offset, i; char *curr = NULL; - etags_hash_t *curr_def; + etags_hash_t *curr_def = NULL; Dlg_head *def_dlg; WListbox *def_list; int def_dlg_h; /* dialog height */ @@ -3199,7 +3203,8 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int /* apply the choosen completion */ if ( def_dlg->ret_value == B_ENTER ) { - listbox_get_current (def_list, &curr, (etags_hash_t *) &curr_def); + char *tmp_curr_def = (char *) curr_def; + listbox_get_current (def_list, &curr, &tmp_curr_def); int do_moveto = 0; if ( edit->modified ) { if ( !edit_query_dialog2 @@ -3225,7 +3230,7 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int edit->curs_row + 1; edit_stack_iterator++; g_free( edit_history_moveto[edit_stack_iterator].filename ); - edit_history_moveto[edit_stack_iterator].filename = g_strdup(curr_def->fullpath); + edit_history_moveto[edit_stack_iterator].filename = g_strdup((char *)curr_def->fullpath); edit_history_moveto[edit_stack_iterator].line = curr_def->line; edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].filename, edit_history_moveto[edit_stack_iterator].line); diff --git a/src/charsets.c b/src/charsets.c index 227fb68b9..3539ed2a7 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -39,8 +39,8 @@ struct codepage_desc *codepages; unsigned char conv_displ[256]; unsigned char conv_input[256]; -static char *cp_display = NULL; -static char *cp_source = NULL; +static const char *cp_display = NULL; +static const char *cp_source = NULL; int @@ -195,8 +195,8 @@ init_translation_table (int cpsource, int cpdisplay) conv_input[i] = i; } - cp_display = cpsour = codepages[cpsource].id; - cp_source = cpdisp = codepages[cpdisplay].id; + cp_display = cpsour = (char *) codepages[cpsource].id; + cp_source = cpdisp = (char *) codepages[cpdisplay].id; /* display <- inpit table */ diff --git a/src/strutil.c b/src/strutil.c index d5ca6f95d..a403637e1 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -284,7 +284,7 @@ str_translate_char (GIConv conv, const char *keys, size_t ch_size, left = (ch_size == (size_t) (-1)) ? strlen (keys) : ch_size; - cnv = g_iconv (conv, &keys, &left, &output, &out_size); + cnv = g_iconv (conv, (gchar **) &keys, &left, &output, &out_size); if (cnv == (size_t)(-1)) { if (errno == EINVAL) return ESTR_PROBLEM; else return ESTR_FAILURE; } else { diff --git a/src/util.c b/src/util.c index 23c15aa98..1a03406a9 100644 --- a/src/util.c +++ b/src/util.c @@ -1278,7 +1278,7 @@ concat_dir_and_file (const char *dir, const char *file) GList * list_append_unique (GList *list, char *text) { - GList *link, *newlink; + GList *link, *newlink, *tmp; /* * Go to the last position and traverse the list backwards @@ -1293,7 +1293,7 @@ list_append_unique (GList *list, char *text) newlink = g_list_previous (link); if (!strcmp ((char *) link->data, text)) { g_free (link->data); - g_list_remove_link (list, link); + tmp = g_list_remove_link (list, link); g_list_free_1 (link); } link = newlink;